From: Jo-Philipp Wich Date: Sun, 12 Jan 2014 12:45:11 +0000 (+0000) Subject: uci: rename uci.apply "commit" attribute to "roolback" and invert its logic X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=64633f313638b8afc179a55d56fd46e22d582146;p=oweals%2Frpcd.git uci: rename uci.apply "commit" attribute to "roolback" and invert its logic --- diff --git a/uci.c b/uci.c index e012998..ff122ab 100644 --- a/uci.c +++ b/uci.c @@ -156,14 +156,14 @@ static const struct blobmsg_policy rpc_uci_config_policy[__RPC_C_MAX] = { }; enum { - RPC_T_COMMIT, + RPC_T_ROLLBACK, RPC_T_TIMEOUT, RPC_T_SESSION, __RPC_T_MAX, }; static const struct blobmsg_policy rpc_uci_apply_policy[__RPC_T_MAX] = { - [RPC_T_COMMIT] = { .name = "commit", .type = BLOBMSG_TYPE_BOOL }, + [RPC_T_ROLLBACK] = { .name = "rollback", .type = BLOBMSG_TYPE_BOOL }, [RPC_T_TIMEOUT] = { .name = "timeout", .type = BLOBMSG_TYPE_INT32 }, [RPC_T_SESSION] = { .name = "ubus_rpc_session", .type = BLOBMSG_TYPE_STRING }, @@ -1351,7 +1351,7 @@ rpc_uci_apply(struct ubus_context *ctx, struct ubus_object *obj, struct blob_attr *tb[__RPC_T_MAX]; int timeout = RPC_APPLY_TIMEOUT; char tmp[PATH_MAX]; - bool commit = false; + bool rollback = false; int ret, i; char *sid; glob_t gl; @@ -1359,10 +1359,10 @@ rpc_uci_apply(struct ubus_context *ctx, struct ubus_object *obj, blobmsg_parse(rpc_uci_apply_policy, __RPC_T_MAX, tb, blob_data(msg), blob_len(msg)); - if (tb[RPC_T_COMMIT]) - commit = blobmsg_get_bool(tb[RPC_T_COMMIT]); + if (tb[RPC_T_ROLLBACK]) + rollback = blobmsg_get_bool(tb[RPC_T_ROLLBACK]); - if (apply_running && !commit) + if (apply_running && rollback) return UBUS_STATUS_PERMISSION_DENIED; if (!tb[RPC_T_SESSION]) @@ -1415,7 +1415,7 @@ rpc_uci_apply(struct ubus_context *ctx, struct ubus_object *obj, apply_ctx = ctx; } - if (apply_running && commit) { + if (apply_running && !rollback) { rpc_uci_purge_dir(RPC_SNAPSHOT_FILES); rpc_uci_purge_dir(RPC_SNAPSHOT_DELTA);