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.orgReview at https://gerrit.osmocom.org/1576 CTRL: remove boilerplate Use CTRL_CMD_DEFINE_WO() where appropriate to get rid of boilerplate code. Change-Id: I5bcea0b4f4b8f535bef2b423f2013b8b4a218b5b --- M openbsc/src/libbsc/bsc_ctrl_commands.c M openbsc/src/libmsc/ctrl_commands.c M openbsc/src/osmo-bsc_nat/bsc_nat_ctrl.c 3 files changed, 7 insertions(+), 49 deletions(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/76/1576/1 diff --git a/openbsc/src/libbsc/bsc_ctrl_commands.c b/openbsc/src/libbsc/bsc_ctrl_commands.c index 7e84797..0c7e84b 100644 --- a/openbsc/src/libbsc/bsc_ctrl_commands.c +++ b/openbsc/src/libbsc/bsc_ctrl_commands.c @@ -75,12 +75,6 @@ return 0; } -static int get_net_apply_config(struct ctrl_cmd *cmd, void *data) -{ - cmd->reply = "Write only attribute"; - return CTRL_CMD_ERROR; -} - static int set_net_apply_config(struct ctrl_cmd *cmd, void *data) { struct gsm_network *net = cmd->node; @@ -107,7 +101,7 @@ return CTRL_CMD_REPLY; } -CTRL_CMD_DEFINE(net_apply_config, "apply-configuration"); +CTRL_CMD_DEFINE_WO(net_apply_config, "apply-configuration"); static int verify_net_mcc_mnc_apply(struct ctrl_cmd *cmd, const char *value, void *d) { @@ -124,12 +118,6 @@ if (!mcc || !mnc) return 1; return 0; -} - -static int get_net_mcc_mnc_apply(struct ctrl_cmd *cmd, void *data) -{ - cmd->reply = "Write only attribute"; - return CTRL_CMD_ERROR; } static int set_net_mcc_mnc_apply(struct ctrl_cmd *cmd, void *data) @@ -165,7 +153,7 @@ cmd->reply = "OOM"; return CTRL_CMD_ERROR; } -CTRL_CMD_DEFINE(net_mcc_mnc_apply, "mcc-mnc-apply"); +CTRL_CMD_DEFINE_WO(net_mcc_mnc_apply, "mcc-mnc-apply"); /* BTS related commands below */ CTRL_CMD_DEFINE_RANGE(bts_lac, "location-area-code", struct gsm_bts, location_area_code, 0, 65535); @@ -174,12 +162,6 @@ static int verify_bts_apply_config(struct ctrl_cmd *cmd, const char *v, void *d) { return 0; -} - -static int get_bts_apply_config(struct ctrl_cmd *cmd, void *data) -{ - cmd->reply = "Write only attribute"; - return CTRL_CMD_ERROR; } static int set_bts_apply_config(struct ctrl_cmd *cmd, void *data) @@ -196,17 +178,11 @@ return CTRL_CMD_REPLY; } -CTRL_CMD_DEFINE(bts_apply_config, "apply-configuration"); +CTRL_CMD_DEFINE_WO(bts_apply_config, "apply-configuration"); static int verify_bts_si(struct ctrl_cmd *cmd, const char *v, void *d) { return 0; -} - -static int get_bts_si(struct ctrl_cmd *cmd, void *data) -{ - cmd->reply = "Write only attribute"; - return CTRL_CMD_ERROR; } static int set_bts_si(struct ctrl_cmd *cmd, void *data) @@ -223,7 +199,7 @@ cmd->reply = "Generated new System Information"; return CTRL_CMD_REPLY; } -CTRL_CMD_DEFINE(bts_si, "send-new-system-informations"); +CTRL_CMD_DEFINE_WO(bts_si, "send-new-system-informations"); static int verify_bts_chan_load(struct ctrl_cmd *cmd, const char *v, void *d) { diff --git a/openbsc/src/libmsc/ctrl_commands.c b/openbsc/src/libmsc/ctrl_commands.c index 79e136d..0747410 100644 --- a/openbsc/src/libmsc/ctrl_commands.c +++ b/openbsc/src/libmsc/ctrl_commands.c @@ -74,12 +74,6 @@ return rc; } -static int get_subscriber_modify(struct ctrl_cmd *cmd, void *data) -{ - cmd->reply = "Set only attribute"; - return CTRL_CMD_ERROR; -} - static int set_subscriber_modify(struct ctrl_cmd *cmd, void *data) { struct gsm_network *net = cmd->node; @@ -157,17 +151,11 @@ return CTRL_CMD_ERROR; } -CTRL_CMD_DEFINE(subscriber_modify, "subscriber-modify-v1"); +CTRL_CMD_DEFINE_WO(subscriber_modify, "subscriber-modify-v1"); static int verify_subscriber_delete(struct ctrl_cmd *cmd, const char *v, void *d) { return 0; -} - -static int get_subscriber_delete(struct ctrl_cmd *cmd, void *data) -{ - cmd->reply = "Set only attribute"; - return CTRL_CMD_ERROR; } static int set_subscriber_delete(struct ctrl_cmd *cmd, void *data) @@ -199,7 +187,7 @@ cmd->reply = was_used ? "Removed active subscriber" : "Removed"; return CTRL_CMD_REPLY; } -CTRL_CMD_DEFINE(subscriber_delete, "subscriber-delete-v1"); +CTRL_CMD_DEFINE_WO(subscriber_delete, "subscriber-delete-v1"); static int verify_subscriber_list(struct ctrl_cmd *cmd, const char *value, void *d) { diff --git a/openbsc/src/osmo-bsc_nat/bsc_nat_ctrl.c b/openbsc/src/osmo-bsc_nat/bsc_nat_ctrl.c index ec4243e..ce498c7 100644 --- a/openbsc/src/osmo-bsc_nat/bsc_nat_ctrl.c +++ b/openbsc/src/osmo-bsc_nat/bsc_nat_ctrl.c @@ -446,7 +446,7 @@ return 0; } -CTRL_CMD_DEFINE(net_save_cmd, "net 0 save-configuration"); +CTRL_CMD_DEFINE_WO(net_save_cmd, "net 0 save-configuration"); static int verify_net_save_cmd(struct ctrl_cmd *cmd, const char *v, void *d) { return 0; @@ -462,12 +462,6 @@ } return CTRL_CMD_REPLY; -} - -static int get_net_save_cmd(struct ctrl_cmd *cmd, void *data) -{ - cmd->reply = "Write only attribute"; - return CTRL_CMD_ERROR; } struct ctrl_handle *bsc_nat_controlif_setup(struct bsc_nat *nat, -- To view, visit https://gerrit.osmocom.org/1576 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I5bcea0b4f4b8f535bef2b423f2013b8b4a218b5b Gerrit-PatchSet: 1 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Max <msuraev at sysmocom.de>