mirror of https://gerrit.osmocom.org/libosmocore
ctrl: Introduce a macro for read-only attributes and use it
Certain attributes are read-only. Add a macro to make it more easy to define those.
This commit is contained in:
parent
141de62b06
commit
c08c55186f
|
@ -172,6 +172,20 @@ static struct ctrl_cmd_element cmd_##cmdname = { \
|
|||
.verify = &verify_##cmdname, \
|
||||
}
|
||||
|
||||
#define CTRL_CMD_DEFINE_RO(cmdname, cmdstr) \
|
||||
static int get_##cmdname(struct ctrl_cmd *cmd, void *data); \
|
||||
static int set_##cmdname(struct ctrl_cmd *cmd, void *data) \
|
||||
{ \
|
||||
cmd->reply = "Read Only attribute"; \
|
||||
return CTRL_CMD_ERROR; \
|
||||
} \
|
||||
static int verify_##cmdname(struct ctrl_cmd *cmd, const char *value, void *data) \
|
||||
{ \
|
||||
cmd->reply = "Read Only attribute"; \
|
||||
return 1; \
|
||||
} \
|
||||
CTRL_CMD_DEFINE(cmdname, cmdstr)
|
||||
|
||||
struct gsm_network;
|
||||
|
||||
#endif /* _CONTROL_CMD_H */
|
||||
|
|
Loading…
Reference in New Issue