projects
/
project
/
rpcd.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
382fd87
)
luci2: use shared rpc_data_policy for opkg config_set call
author
Jo-Philipp Wich
<jow@openwrt.org>
Tue, 16 Jul 2013 17:07:58 +0000
(19:07 +0200)
committer
Jo-Philipp Wich
<jow@openwrt.org>
Tue, 16 Jul 2013 17:07:58 +0000
(19:07 +0200)
luci2.c
patch
|
blob
|
history
diff --git
a/luci2.c
b/luci2.c
index
86b00fa
..
95564db
100644
(file)
--- a/
luci2.c
+++ b/
luci2.c
@@
-109,15
+109,6
@@
static const struct blobmsg_policy rpc_opkg_package_policy[__RPC_OP_MAX] = {
[RPC_OP_PACKAGE] = { .name = "package", .type = BLOBMSG_TYPE_STRING },
};
[RPC_OP_PACKAGE] = { .name = "package", .type = BLOBMSG_TYPE_STRING },
};
-enum {
- RPC_OC_CONFIG,
- __RPC_OC_MAX
-};
-
-static const struct blobmsg_policy rpc_opkg_config_policy[__RPC_OC_MAX] = {
- [RPC_OC_CONFIG] = { .name = "config", .type = BLOBMSG_TYPE_STRING },
-};
-
static int
rpc_errno_status(void)
static int
rpc_errno_status(void)
@@
-1690,25
+1681,22
@@
rpc_luci2_opkg_config_set(struct ubus_context *ctx, struct ubus_object *obj,
struct blob_attr *msg)
{
FILE *f;
struct blob_attr *msg)
{
FILE *f;
- struct blob_attr *tb[__RPC_
OC
_MAX];
+ struct blob_attr *tb[__RPC_
D
_MAX];
- blobmsg_parse(rpc_
opkg_package_policy, __RPC_OC
_MAX, tb,
+ blobmsg_parse(rpc_
data_policy, __RPC_D
_MAX, tb,
blob_data(msg), blob_len(msg));
blob_data(msg), blob_len(msg));
- if (!tb[RPC_
OC_CONFIG
])
+ if (!tb[RPC_
D_DATA
])
return UBUS_STATUS_INVALID_ARGUMENT;
return UBUS_STATUS_INVALID_ARGUMENT;
- if (blobmsg_type(tb[RPC_OC_CONFIG]) != BLOBMSG_TYPE_STRING)
- return UBUS_STATUS_INVALID_ARGUMENT;
-
- if (blobmsg_data_len(tb[RPC_OC_CONFIG]) >= 2048)
+ if (blobmsg_data_len(tb[RPC_D_DATA]) >= 2048)
return UBUS_STATUS_NOT_SUPPORTED;
if (!(f = fopen("/etc/opkg.conf", "w")))
return rpc_errno_status();
return UBUS_STATUS_NOT_SUPPORTED;
if (!(f = fopen("/etc/opkg.conf", "w")))
return rpc_errno_status();
- fwrite(blobmsg_data(tb[RPC_
OC_CONFIG
]),
- blobmsg_data_len(tb[RPC_
OC_CONFIG
]), 1, f);
+ fwrite(blobmsg_data(tb[RPC_
D_DATA
]),
+ blobmsg_data_len(tb[RPC_
D_DATA
]), 1, f);
fclose(f);
return 0;
fclose(f);
return 0;
@@
-1790,7
+1778,7
@@
int rpc_luci2_api_init(struct ubus_context *ctx)
UBUS_METHOD_NOARG("update", rpc_luci2_opkg_update),
UBUS_METHOD_NOARG("config_get", rpc_luci2_opkg_config_get),
UBUS_METHOD("config_set", rpc_luci2_opkg_config_set,
UBUS_METHOD_NOARG("update", rpc_luci2_opkg_update),
UBUS_METHOD_NOARG("config_get", rpc_luci2_opkg_config_get),
UBUS_METHOD("config_set", rpc_luci2_opkg_config_set,
- rpc_
opkg_config
_policy)
+ rpc_
data
_policy)
};
static struct ubus_object_type luci2_opkg_type =
};
static struct ubus_object_type luci2_opkg_type =