All of lore.kernel.org
 help / color / mirror / Atom feed
From: Anthony PERARD <anthony.perard@citrix.com>
To: xen-devel@lists.xenproject.org
Cc: Anthony PERARD <anthony.perard@gmail.com>,
	Ian Jackson <ian.jackson@eu.citrix.com>,
	Wei Liu <wei.liu2@citrix.com>,
	Anthony PERARD <anthony.perard@citrix.com>
Subject: [PATCH v8 15/17] libxl: Remove unused arg from libxl__sendmsg_fds
Date: Fri, 4 Jan 2019 15:30:54 +0000	[thread overview]
Message-ID: <20190104153056.19138-16-anthony.perard@citrix.com> (raw)
In-Reply-To: <20190104153056.19138-1-anthony.perard@citrix.com>

From: Anthony PERARD <anthony.perard@gmail.com>

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@citrix.com>
---

Notes:
    v8:
        new patch, just a follow-up

 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 77a8cd5aa5..c4968ca135 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 02ba156df9..131d94fb29 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 d53db8c37d..e123baa632 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 */
-- 
Anthony PERARD


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

  parent reply	other threads:[~2019-01-04 15:59 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-04 15:30 [PATCH v8 00/17] libxl: Enable save/restore/migration of a restricted QEMU + libxl__ev_qmp_* Anthony PERARD
2019-01-04 15:30 ` [PATCH v8 01/17] libxl: Enhance libxl__sendmsg_fds to deal with EINTR and EWOULDBLOCK Anthony PERARD
2019-01-04 15:30 ` [PATCH v8 02/17] libxl_qmp: Separate QMP message generation from qmp_send_prepare Anthony PERARD
2019-01-04 15:30 ` [PATCH v8 03/17] libxl_qmp: Change qmp_qemu_check_version to compare version Anthony PERARD
2019-01-04 15:30 ` [PATCH v8 04/17] libxl: Add wrapper around libxl__json_object_to_json JSON Anthony PERARD
2019-01-04 15:30 ` [PATCH v8 05/17] libxl: Design of an async API to issue QMP commands to QEMU Anthony PERARD
2019-01-04 15:30 ` [PATCH v8 06/17] libxl_qmp: Implementation of libxl__ev_qmp_* Anthony PERARD
2019-01-11 12:06   ` Ian Jackson
2019-01-11 12:16     ` Anthony PERARD
2019-01-11 12:21       ` Ian Jackson
2019-01-04 15:30 ` [PATCH v8 07/17] libxl_exec: Add libxl__spawn_initiate_failure Anthony PERARD
2019-01-04 15:30 ` [PATCH v8 08/17] libxl: Add init/dispose of for libxl__domain_build_state Anthony PERARD
2019-01-04 15:30 ` [PATCH v8 09/17] libxl_dm: Pre-open QMP socket for QEMU Anthony PERARD
2019-01-04 15:30 ` [PATCH v8 10/17] libxl: Add dmss_init/dispose for libxl__dm_spawn_state Anthony PERARD
2019-01-04 15:30 ` [PATCH v8 11/17] libxl: QEMU startup sync based on QMP Anthony PERARD
2019-01-04 15:30 ` [PATCH v8 12/17] libxl_qmp: Store advertised QEMU version in libxl__ev_qmp Anthony PERARD
2019-01-04 15:30 ` [PATCH v8 13/17] libxl: Change libxl__domain_suspend_device_model() to be async Anthony PERARD
2019-01-04 15:30 ` [PATCH v8 14/17] libxl: Re-implement domain_suspend_device_model using libxl__ev_qmp Anthony PERARD
2019-01-04 15:30 ` Anthony PERARD [this message]
2019-01-04 16:04   ` [PATCH v8 15/17] libxl: Remove unused arg from libxl__sendmsg_fds Ian Jackson
2019-01-04 15:30 ` [PATCH v8 16/17] libxl_json: Remove libxl__json_object_append_to from header Anthony PERARD
2019-01-04 16:03   ` Ian Jackson
2019-01-04 15:30 ` [PATCH v8 17/17] libxl: Add comments to libxl__json_*get* functions Anthony PERARD
2019-01-11 11:55   ` Ian Jackson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190104153056.19138-16-anthony.perard@citrix.com \
    --to=anthony.perard@citrix.com \
    --cc=anthony.perard@gmail.com \
    --cc=ian.jackson@eu.citrix.com \
    --cc=wei.liu2@citrix.com \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.