[PATCH] libosmocore[master]: CTRL: add write-only helper

Max gerrit-no-reply at lists.osmocom.org
Wed Jan 11 16:49:47 UTC 2017

Review at  https://gerrit.osmocom.org/1574

CTRL: add write-only helper

Similar to CTRL_CMD_DEFINE_RO() add helper for control commands which
are not meant to be read, only to set.

Change-Id: I66b7990db590c1f8e56326e392e6c1d2eafebd9a
M include/osmocom/ctrl/control_cmd.h
1 file changed, 10 insertions(+), 0 deletions(-)

  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/74/1574/1

diff --git a/include/osmocom/ctrl/control_cmd.h b/include/osmocom/ctrl/control_cmd.h
index 8f2eaa2..6d28d23 100644
--- a/include/osmocom/ctrl/control_cmd.h
+++ b/include/osmocom/ctrl/control_cmd.h
@@ -187,4 +187,14 @@
 }									\
 CTRL_CMD_DEFINE_STRUCT(cmdname, cmdstr, verify_##cmdname)
+#define CTRL_CMD_DEFINE_WO(cmdname, cmdstr)				\
+static int set_##cmdname(struct ctrl_cmd *cmd, void *data);		\
+static int get_##cmdname(struct ctrl_cmd *cmd, void *data)	\
+{									\
+	cmd->reply = "Write Only attribute";				\
+	return CTRL_CMD_ERROR;						\
+}									\
+static int verify_##cmdname(struct ctrl_cmd *cmd, const char *value, void *data); \
+CTRL_CMD_DEFINE_STRUCT(cmdname, cmdstr, verify_##cmdname)
 struct gsm_network;

To view, visit https://gerrit.osmocom.org/1574
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I66b7990db590c1f8e56326e392e6c1d2eafebd9a
Gerrit-PatchSet: 1
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Max <msuraev at sysmocom.de>

More information about the gerrit-log mailing list