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

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Max gerrit-no-reply at lists.osmocom.org
Wed Jan 11 17:46:45 UTC 2017


Hello Jenkins Builder,

I'd like you to reexamine a change.  Please visit

    https://gerrit.osmocom.org/1574

to look at the new patch set (#2).

CTRL: add write-only helpers

Similar to CTRL_CMD_DEFINE_RO() add helper for control commands which
are not meant to be read, only to set. Similarly, add
CTRL_CMD_DEFINE_WO_NOVRF() for commands which do not perform inbound
data verification.

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


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

diff --git a/include/osmocom/ctrl/control_cmd.h b/include/osmocom/ctrl/control_cmd.h
index 8f2eaa2..93825f8 100644
--- a/include/osmocom/ctrl/control_cmd.h
+++ b/include/osmocom/ctrl/control_cmd.h
@@ -187,4 +187,28 @@
 }									\
 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)
+
+
+#define CTRL_CMD_DEFINE_WO_NOVRF(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) \
+{					      				\
+	return 0;							\
+}									\
+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: newpatchset
Gerrit-Change-Id: I66b7990db590c1f8e56326e392e6c1d2eafebd9a
Gerrit-PatchSet: 2
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Max <msuraev at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder



More information about the gerrit-log mailing list