projects
/
project
/
ubus.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
libubus: expose ubus_connect_ctx() in public API
[project/ubus.git]
/
libubus-obj.c
diff --git
a/libubus-obj.c
b/libubus-obj.c
index
a1062e0
..
8bc83dc
100644
(file)
--- a/
libubus-obj.c
+++ b/
libubus-obj.c
@@
-91,15
+91,17
@@
send:
ubus_complete_deferred_request(ctx, &req, ret);
}
ubus_complete_deferred_request(ctx, &req, ret);
}
-void __hidden ubus_process_obj_msg(struct ubus_context *ctx, struct ubus_msghdr
*hdr
)
+void __hidden ubus_process_obj_msg(struct ubus_context *ctx, struct ubus_msghdr
_buf *buf
)
{
void (*cb)(struct ubus_context *, struct ubus_msghdr *,
struct ubus_object *, struct blob_attr **);
{
void (*cb)(struct ubus_context *, struct ubus_msghdr *,
struct ubus_object *, struct blob_attr **);
+ struct ubus_msghdr *hdr = &buf->hdr;
struct blob_attr **attrbuf;
struct ubus_object *obj;
uint32_t objid;
struct blob_attr **attrbuf;
struct ubus_object *obj;
uint32_t objid;
+ void *prev_data = NULL;
- attrbuf = ubus_parse_msg(
ubus_msghdr_data(hdr)
);
+ attrbuf = ubus_parse_msg(
buf->data
);
if (!attrbuf[UBUS_ATTR_OBJID])
return;
if (!attrbuf[UBUS_ATTR_OBJID])
return;
@@
-119,7
+121,20
@@
void __hidden ubus_process_obj_msg(struct ubus_context *ctx, struct ubus_msghdr
default:
return;
}
default:
return;
}
+
+ if (buf == &ctx->msgbuf) {
+ prev_data = buf->data;
+ buf->data = NULL;
+ }
+
cb(ctx, hdr, obj, attrbuf);
cb(ctx, hdr, obj, attrbuf);
+
+ if (prev_data) {
+ if (buf->data)
+ free(prev_data);
+ else
+ buf->data = prev_data;
+ }
}
static void ubus_add_object_cb(struct ubus_request *req, int type, struct blob_attr *msg)
}
static void ubus_add_object_cb(struct ubus_request *req, int type, struct blob_attr *msg)
@@
-146,8
+161,12
@@
static void ubus_push_method_data(const struct ubus_method *m)
mtbl = blobmsg_open_table(&b, m->name);
mtbl = blobmsg_open_table(&b, m->name);
- for (i = 0; i < m->n_policy; i++)
+ for (i = 0; i < m->n_policy; i++) {
+ if (m->mask && !(m->mask & (1 << i)))
+ continue;
+
blobmsg_add_u32(&b, m->policy[i].name, m->policy[i].type);
blobmsg_add_u32(&b, m->policy[i].name, m->policy[i].type);
+ }
blobmsg_close_table(&b, mtbl);
}
blobmsg_close_table(&b, mtbl);
}