[OpenWrt-Devel] [PATCH Request][rpcd] file: add reply to write function
Lazar Demin
lazar at onion.io
Wed May 18 11:09:26 EDT 2016
This patch adds a reply to the file write ubus call:
{
"code": 0,
"bytes": 9
}
Where code is the return code of the operation and bytes is the number of
bytes written.
Getting a response is helpful since it lets the user know if the write
operation was successful, knowing the number of bytes written allows for
further error checking.
Can this patch be merged into the rpcd repo?
Index: rpcd/file.c
===================================================================
--- rpcd.orig/file.c 2016-05-17 22:07:03.679363210 +0000
+++ rpcd/file.c 2016-05-17 22:08:15.627440178 +0000
@@ -315,6 +315,12 @@
close(fd);
sync();
+ blob_buf_init(&buf, 0);
+ blobmsg_add_u32 (&buf, "code", rv);
+ blobmsg_add_u32 (&buf, "bytes", (int)data_len);
+ ubus_send_reply (ctx, req, buf.head);
+ blob_buf_free(&buf);
+
if (rv)
return rpc_errno_status();
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.infradead.org/pipermail/openwrt-devel/attachments/20160518/2920d04e/attachment.htm>
-------------- next part --------------
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
More information about the openwrt-devel
mailing list