diff options
author | Felix Fietkau <nbd@openwrt.org> | 2012-12-14 19:48:26 +0100 |
---|---|---|
committer | Felix Fietkau <nbd@openwrt.org> | 2012-12-14 19:48:26 +0100 |
commit | 22246585804a2f6546a329a9e626598a82feb554 (patch) | |
tree | 1bcc365eb27a84b24720c400a9f1fd364643d06c /libubus-req.c | |
parent | 1579969983b4c54a4f454bfcc6df720cb829ade3 (diff) | |
download | ubus-22246585804a2f6546a329a9e626598a82feb554.tar.gz |
move ubus_start_request to libubus-req.c
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Diffstat (limited to 'libubus-req.c')
-rw-r--r-- | libubus-req.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/libubus-req.c b/libubus-req.c index 74286c0..88a5453 100644 --- a/libubus-req.c +++ b/libubus-req.c @@ -48,6 +48,22 @@ static void __ubus_process_req_data(struct ubus_request *req) } } +int __hidden ubus_start_request(struct ubus_context *ctx, struct ubus_request *req, + struct blob_attr *msg, int cmd, uint32_t peer) +{ + memset(req, 0, sizeof(*req)); + + if (msg && blob_pad_len(msg) > UBUS_MAX_MSGLEN) + return -1; + + INIT_LIST_HEAD(&req->list); + INIT_LIST_HEAD(&req->pending); + req->ctx = ctx; + req->peer = peer; + req->seq = ++ctx->request_seq; + return ubus_send_msg(ctx, req->seq, msg, cmd, peer); +} + void ubus_abort_request(struct ubus_context *ctx, struct ubus_request *req) { if (!list_empty(&req->list)) |