[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen master] libxl: Remove unused arg from libxl__sendmsg_fds



commit aa402adb0b8cdbaf49ee877cdfb7dd5a50203e0a
Author:     Anthony PERARD <anthony.perard@xxxxxxxxx>
AuthorDate: Wed Jan 2 16:55:44 2019 +0100
Commit:     Wei Liu <wei.liu2@xxxxxxxxxx>
CommitDate: Fri Jan 11 14:57:52 2019 +0000

    libxl: Remove unused arg from libxl__sendmsg_fds
    
    Now that `datalen' needs to be 1, we can remove it. Also change `data'
    parameter to be a singe byte.
    
    Signed-off-by: Anthony PERARD <anthony.perard@xxxxxxxxxx>
    Acked-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
---
 tools/libxl/libxl_aoutils.c  | 2 +-
 tools/libxl/libxl_internal.h | 4 ++--
 tools/libxl/libxl_qmp.c      | 2 +-
 tools/libxl/libxl_utils.c    | 7 +++----
 4 files changed, 7 insertions(+), 8 deletions(-)

diff --git a/tools/libxl/libxl_aoutils.c b/tools/libxl/libxl_aoutils.c
index 9e493cd487..e24e4eed53 100644
--- a/tools/libxl/libxl_aoutils.c
+++ b/tools/libxl/libxl_aoutils.c
@@ -477,7 +477,7 @@ int libxl__openptys(libxl__openpty_state *op,
             r = openpty(&ptyfds[i][0], &ptyfds[i][1], NULL, termp, winp);
             if (r) { LOGE(ERROR,"openpty failed"); _exit(-1); }
         }
-        rc = libxl__sendmsg_fds(gc, sockets[1], "",1,
+        rc = libxl__sendmsg_fds(gc, sockets[1], '\0',
                                 2*count, &ptyfds[0][0], "ptys");
         if (rc) { LOGE(ERROR,"sendmsg to parent failed"); _exit(-1); }
         _exit(0);
diff --git a/tools/libxl/libxl_internal.h b/tools/libxl/libxl_internal.h
index 7f46d7c828..c21d475102 100644
--- a/tools/libxl/libxl_internal.h
+++ b/tools/libxl/libxl_internal.h
@@ -2010,12 +2010,12 @@ _hidden void libxl__qmp_cleanup(libxl__gc *gc, uint32_t 
domid);
 _hidden int libxl__qmp_initializations(libxl__gc *gc, uint32_t domid,
                                        const libxl_domain_config 
*guest_config);
 
-/* `datalen` should be 1 byte
+/* `data' should contain a byte to send.
  * When dealing with a non-blocking fd, it returns
  *   ERROR_NOT_READY on EWOULDBLOCK
  * logs on other failures. */
 int libxl__sendmsg_fds(libxl__gc *gc, int carrier,
-                       const void *data, size_t datalen,
+                       const char data,
                        int nfds, const int fds[], const char *what);
 
 /* Insists on receiving exactly nfds and datalen.  On failure, logs
diff --git a/tools/libxl/libxl_qmp.c b/tools/libxl/libxl_qmp.c
index e53884ebdc..42c8ab8d8d 100644
--- a/tools/libxl/libxl_qmp.c
+++ b/tools/libxl/libxl_qmp.c
@@ -1725,7 +1725,7 @@ static int qmp_ev_callback_writable(libxl__gc *gc,
         ev->payload_fd >= 0 &&
         ev->tx_buf_off == 0) {
 
-        rc = libxl__sendmsg_fds(gc, fd, ev->tx_buf, 1,
+        rc = libxl__sendmsg_fds(gc, fd, ev->tx_buf[ev->tx_buf_off],
                                 1, &ev->payload_fd, "QMP socket");
         /* Check for EWOULDBLOCK, and return to try again later */
         if (rc == ERROR_NOT_READY)
diff --git a/tools/libxl/libxl_utils.c b/tools/libxl/libxl_utils.c
index 29a7dde59f..e50e094c48 100644
--- a/tools/libxl/libxl_utils.c
+++ b/tools/libxl/libxl_utils.c
@@ -1061,18 +1061,17 @@ void libxl_vcpuinfo_list_free(libxl_vcpuinfo *list, int 
nr)
 }
 
 int libxl__sendmsg_fds(libxl__gc *gc, int carrier,
-                       const void *data, size_t datalen,
+                       const char data,
                        int nfds, const int fds[], const char *what) {
     struct msghdr msg = { 0 };
     struct cmsghdr *cmsg;
     size_t spaceneeded = nfds * sizeof(fds[0]);
     char control[CMSG_SPACE(spaceneeded)];
+    const size_t datalen = 1;
     struct iovec iov;
     int r;
 
-    assert(datalen == 1);
-
-    iov.iov_base = (void*)data;
+    iov.iov_base = (void*)&data;
     iov.iov_len  = datalen;
 
     /* compose the message */
--
generated by git-patchbot for /home/xen/git/xen.git#master

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/xen-changelog

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.