qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PULL 0/3] Block patches
@ 2022-04-25  8:48 Stefan Hajnoczi
  2022-04-25  8:48 ` [PULL 1/3] Implements Backend Program conventions for vhost-user-scsi Stefan Hajnoczi
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Stefan Hajnoczi @ 2022-04-25  8:48 UTC (permalink / raw)
  To: qemu-devel; +Cc: Peter Maydell, Stefan Hajnoczi, qemu-block

The following changes since commit 9c125d17e9402c232c46610802e5931b3639d77b:

  Merge tag 'pull-tcg-20220420' of https://gitlab.com/rth7680/qemu into staging (2022-04-20 16:43:11 -0700)

are available in the Git repository at:

  https://gitlab.com/stefanha/qemu.git tags/block-pull-request

for you to fetch changes up to d45c83328feab2e4083991693160f0a417cfd9b0:

  virtiofsd: Add docs/helper for killpriv_v2/no_killpriv_v2 option (2022-04-21 12:05:15 +0200)

----------------------------------------------------------------
Pull request

Small contrib/vhost-user-blk, contrib/vhost-user-scsi, and tools/virtiofsd
improvements.

----------------------------------------------------------------

Liu Yiding (1):
  virtiofsd: Add docs/helper for killpriv_v2/no_killpriv_v2 option

Sakshi Kaushik (1):
  Implements Backend Program conventions for vhost-user-scsi

Stefan Hajnoczi (1):
  contrib/vhost-user-blk: add missing GOptionEntry NULL terminator

 docs/tools/virtiofsd.rst                  |  5 ++
 contrib/vhost-user-blk/vhost-user-blk.c   |  3 +-
 contrib/vhost-user-scsi/vhost-user-scsi.c | 77 +++++++++++++++--------
 tools/virtiofsd/helper.c                  |  3 +
 4 files changed, 62 insertions(+), 26 deletions(-)

-- 
2.35.1



^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PULL 1/3] Implements Backend Program conventions for vhost-user-scsi
  2022-04-25  8:48 [PULL 0/3] Block patches Stefan Hajnoczi
@ 2022-04-25  8:48 ` Stefan Hajnoczi
  2022-04-25  8:48 ` [PULL 2/3] contrib/vhost-user-blk: add missing GOptionEntry NULL terminator Stefan Hajnoczi
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Stefan Hajnoczi @ 2022-04-25  8:48 UTC (permalink / raw)
  To: qemu-devel; +Cc: Peter Maydell, Stefan Hajnoczi, qemu-block, Sakshi Kaushik

From: Sakshi Kaushik <sakshikaushik717@gmail.com>

Signed-off-by: Sakshi Kaushik <sakshikaushik717@gmail.com>
Message-id: 20220406162410.8536-1-sakshikaushik717@gmail.com

[Name the iSCSI URL long option --iscsi-uri instead of --iscsi_uri for
consistency, fix --fd which was rejected due to an outdated
--socket-path check, and add missing entries[] terminator.
--Stefan]

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
---
 contrib/vhost-user-scsi/vhost-user-scsi.c | 77 +++++++++++++++--------
 1 file changed, 52 insertions(+), 25 deletions(-)

diff --git a/contrib/vhost-user-scsi/vhost-user-scsi.c b/contrib/vhost-user-scsi/vhost-user-scsi.c
index 4f6e3e2a24..b2c0f98253 100644
--- a/contrib/vhost-user-scsi/vhost-user-scsi.c
+++ b/contrib/vhost-user-scsi/vhost-user-scsi.c
@@ -351,34 +351,59 @@ fail:
 
 /** vhost-user-scsi **/
 
+static int opt_fdnum = -1;
+static char *opt_socket_path;
+static gboolean opt_print_caps;
+static char *iscsi_uri;
+
+static GOptionEntry entries[] = {
+    { "print-capabilities", 'c', 0, G_OPTION_ARG_NONE, &opt_print_caps,
+      "Print capabilities", NULL },
+    { "fd", 'f', 0, G_OPTION_ARG_INT, &opt_fdnum,
+      "Use inherited fd socket", "FDNUM" },
+    { "iscsi-uri", 'i', 0, G_OPTION_ARG_FILENAME, &iscsi_uri,
+      "iSCSI URI to connect to", "FDNUM" },
+    { "socket-path", 's', 0, G_OPTION_ARG_FILENAME, &opt_socket_path,
+      "Use UNIX socket path", "PATH" },
+    { NULL, }
+};
+
 int main(int argc, char **argv)
 {
     VusDev *vdev_scsi = NULL;
-    char *unix_fn = NULL;
-    char *iscsi_uri = NULL;
-    int lsock = -1, csock = -1, opt, err = EXIT_SUCCESS;
+    int lsock = -1, csock = -1, err = EXIT_SUCCESS;
 
-    while ((opt = getopt(argc, argv, "u:i:")) != -1) {
-        switch (opt) {
-        case 'h':
-            goto help;
-        case 'u':
-            unix_fn = g_strdup(optarg);
-            break;
-        case 'i':
-            iscsi_uri = g_strdup(optarg);
-            break;
-        default:
-            goto help;
-        }
+    GError *error = NULL;
+    GOptionContext *context;
+
+    context = g_option_context_new(NULL);
+    g_option_context_add_main_entries(context, entries, NULL);
+    if (!g_option_context_parse(context, &argc, &argv, &error)) {
+        g_printerr("Option parsing failed: %s\n", error->message);
+        exit(EXIT_FAILURE);
+    }
+
+    if (opt_print_caps) {
+        g_print("{\n");
+        g_print("  \"type\": \"scsi\"\n");
+        g_print("}\n");
+        goto out;
     }
-    if (!unix_fn || !iscsi_uri) {
+
+    if (!iscsi_uri) {
         goto help;
     }
 
-    lsock = unix_sock_new(unix_fn);
-    if (lsock < 0) {
-        goto err;
+    if (opt_socket_path) {
+        lsock = unix_sock_new(opt_socket_path);
+        if (lsock < 0) {
+            exit(EXIT_FAILURE);
+        }
+    } else if (opt_fdnum < 0) {
+        g_print("%s\n", g_option_context_get_help(context, true, NULL));
+        exit(EXIT_FAILURE);
+    } else {
+        lsock = opt_fdnum;
     }
 
     csock = accept(lsock, NULL, NULL);
@@ -408,7 +433,7 @@ out:
     if (vdev_scsi) {
         g_main_loop_unref(vdev_scsi->loop);
         g_free(vdev_scsi);
-        unlink(unix_fn);
+        unlink(opt_socket_path);
     }
     if (csock >= 0) {
         close(csock);
@@ -416,7 +441,7 @@ out:
     if (lsock >= 0) {
         close(lsock);
     }
-    g_free(unix_fn);
+    g_free(opt_socket_path);
     g_free(iscsi_uri);
 
     return err;
@@ -426,10 +451,12 @@ err:
     goto out;
 
 help:
-    fprintf(stderr, "Usage: %s [ -u unix_sock_path -i iscsi_uri ] | [ -h ]\n",
+    fprintf(stderr, "Usage: %s [ -s socket-path -i iscsi-uri -f fd -p print-capabilities ] | [ -h ]\n",
             argv[0]);
-    fprintf(stderr, "          -u path to unix socket\n");
-    fprintf(stderr, "          -i iscsi uri for lun 0\n");
+    fprintf(stderr, "          -s, --socket-path=SOCKET_PATH path to unix socket\n");
+    fprintf(stderr, "          -i, --iscsi-uri=ISCSI_URI iscsi uri for lun 0\n");
+    fprintf(stderr, "          -f, --fd=FILE_DESCRIPTOR file-descriptor\n");
+    fprintf(stderr, "          -p, --print-capabilities=PRINT_CAPABILITIES denotes print-capabilities\n");
     fprintf(stderr, "          -h print help and quit\n");
 
     goto err;
-- 
2.35.1



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PULL 2/3] contrib/vhost-user-blk: add missing GOptionEntry NULL terminator
  2022-04-25  8:48 [PULL 0/3] Block patches Stefan Hajnoczi
  2022-04-25  8:48 ` [PULL 1/3] Implements Backend Program conventions for vhost-user-scsi Stefan Hajnoczi
@ 2022-04-25  8:48 ` Stefan Hajnoczi
  2022-04-25  8:48 ` [PULL 3/3] virtiofsd: Add docs/helper for killpriv_v2/no_killpriv_v2 option Stefan Hajnoczi
  2022-04-25 20:35 ` [PULL 0/3] Block patches Richard Henderson
  3 siblings, 0 replies; 5+ messages in thread
From: Stefan Hajnoczi @ 2022-04-25  8:48 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, Stefan Hajnoczi, qemu-block, Michael S . Tsirkin

The GLib documentation says "a NULL-terminated array of GOptionEntrys"
so we'd better make sure there is a terminator that lets
g_option_context_add_main_entries() know when the end of the array has
been reached.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Message-id: 20220411150057.3009667-1-stefanha@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
---
 contrib/vhost-user-blk/vhost-user-blk.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/contrib/vhost-user-blk/vhost-user-blk.c b/contrib/vhost-user-blk/vhost-user-blk.c
index d14b2896bf..cd4a5d7335 100644
--- a/contrib/vhost-user-blk/vhost-user-blk.c
+++ b/contrib/vhost-user-blk/vhost-user-blk.c
@@ -593,7 +593,8 @@ static GOptionEntry entries[] = {
     {"blk-file", 'b', 0, G_OPTION_ARG_FILENAME, &opt_blk_file,
      "block device or file path", "PATH"},
     { "read-only", 'r', 0, G_OPTION_ARG_NONE, &opt_read_only,
-      "Enable read-only", NULL }
+      "Enable read-only", NULL },
+    { NULL, },
 };
 
 int main(int argc, char **argv)
-- 
2.35.1



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PULL 3/3] virtiofsd: Add docs/helper for killpriv_v2/no_killpriv_v2 option
  2022-04-25  8:48 [PULL 0/3] Block patches Stefan Hajnoczi
  2022-04-25  8:48 ` [PULL 1/3] Implements Backend Program conventions for vhost-user-scsi Stefan Hajnoczi
  2022-04-25  8:48 ` [PULL 2/3] contrib/vhost-user-blk: add missing GOptionEntry NULL terminator Stefan Hajnoczi
@ 2022-04-25  8:48 ` Stefan Hajnoczi
  2022-04-25 20:35 ` [PULL 0/3] Block patches Richard Henderson
  3 siblings, 0 replies; 5+ messages in thread
From: Stefan Hajnoczi @ 2022-04-25  8:48 UTC (permalink / raw)
  To: qemu-devel; +Cc: Peter Maydell, Liu Yiding, Stefan Hajnoczi, qemu-block

From: Liu Yiding <liuyd.fnst@fujitsu.com>

virtiofsd has introduced killpriv_v2/no_killpriv_v2 for a while. Add
description of it to docs/helper.

Signed-off-by: Liu Yiding <liuyd.fnst@fujitsu.com>
Message-Id: <20220421095151.2231099-1-liuyd.fnst@fujitsu.com>

[Small documentation fixes: s/as client supports/as the client supports/
and s/.  /. /.
--Stefan]

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
---
 docs/tools/virtiofsd.rst | 5 +++++
 tools/virtiofsd/helper.c | 3 +++
 2 files changed, 8 insertions(+)

diff --git a/docs/tools/virtiofsd.rst b/docs/tools/virtiofsd.rst
index 0c0560203c..e457b13d56 100644
--- a/docs/tools/virtiofsd.rst
+++ b/docs/tools/virtiofsd.rst
@@ -111,6 +111,11 @@ Options
     label. Server will try to set that label on newly created file
     atomically wherever possible.
 
+  * killpriv_v2|no_killpriv_v2 -
+    Enable/disable ``FUSE_HANDLE_KILLPRIV_V2`` support. KILLPRIV_V2 is enabled
+    by default as long as the client supports it. Enabling this option helps
+    with performance in write path.
+
 .. option:: --socket-path=PATH
 
   Listen on vhost-user UNIX domain socket at PATH.
diff --git a/tools/virtiofsd/helper.c b/tools/virtiofsd/helper.c
index e226fc590f..f8981e5bdf 100644
--- a/tools/virtiofsd/helper.c
+++ b/tools/virtiofsd/helper.c
@@ -188,6 +188,9 @@ void fuse_cmdline_help(void)
            "    -o announce_submounts      Announce sub-mount points to the guest\n"
            "    -o posix_acl/no_posix_acl  Enable/Disable posix_acl. (default: disabled)\n"
            "    -o security_label/no_security_label  Enable/Disable security label. (default: disabled)\n"
+           "    -o killpriv_v2/no_killpriv_v2\n"
+           "                               Enable/Disable FUSE_HANDLE_KILLPRIV_V2.\n"
+           "                               (default: enabled as long as client supports it)\n"
            );
 }
 
-- 
2.35.1



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PULL 0/3] Block patches
  2022-04-25  8:48 [PULL 0/3] Block patches Stefan Hajnoczi
                   ` (2 preceding siblings ...)
  2022-04-25  8:48 ` [PULL 3/3] virtiofsd: Add docs/helper for killpriv_v2/no_killpriv_v2 option Stefan Hajnoczi
@ 2022-04-25 20:35 ` Richard Henderson
  3 siblings, 0 replies; 5+ messages in thread
From: Richard Henderson @ 2022-04-25 20:35 UTC (permalink / raw)
  To: Stefan Hajnoczi, qemu-devel; +Cc: Peter Maydell, qemu-block

On 4/25/22 01:48, Stefan Hajnoczi wrote:
> The following changes since commit 9c125d17e9402c232c46610802e5931b3639d77b:
> 
>    Merge tag 'pull-tcg-20220420' of https://gitlab.com/rth7680/qemu into staging (2022-04-20 16:43:11 -0700)
> 
> are available in the Git repository at:
> 
>    https://gitlab.com/stefanha/qemu.git tags/block-pull-request
> 
> for you to fetch changes up to d45c83328feab2e4083991693160f0a417cfd9b0:
> 
>    virtiofsd: Add docs/helper for killpriv_v2/no_killpriv_v2 option (2022-04-21 12:05:15 +0200)
> 
> ----------------------------------------------------------------
> Pull request
> 
> Small contrib/vhost-user-blk, contrib/vhost-user-scsi, and tools/virtiofsd
> improvements.

Applied, thanks.  Please update https://wiki.qemu.org/ChangeLog/7.1 as appropriate.


r~



> 
> ----------------------------------------------------------------
> 
> Liu Yiding (1):
>    virtiofsd: Add docs/helper for killpriv_v2/no_killpriv_v2 option
> 
> Sakshi Kaushik (1):
>    Implements Backend Program conventions for vhost-user-scsi
> 
> Stefan Hajnoczi (1):
>    contrib/vhost-user-blk: add missing GOptionEntry NULL terminator
> 
>   docs/tools/virtiofsd.rst                  |  5 ++
>   contrib/vhost-user-blk/vhost-user-blk.c   |  3 +-
>   contrib/vhost-user-scsi/vhost-user-scsi.c | 77 +++++++++++++++--------
>   tools/virtiofsd/helper.c                  |  3 +
>   4 files changed, 62 insertions(+), 26 deletions(-)
> 



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-04-25 20:36 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-04-25  8:48 [PULL 0/3] Block patches Stefan Hajnoczi
2022-04-25  8:48 ` [PULL 1/3] Implements Backend Program conventions for vhost-user-scsi Stefan Hajnoczi
2022-04-25  8:48 ` [PULL 2/3] contrib/vhost-user-blk: add missing GOptionEntry NULL terminator Stefan Hajnoczi
2022-04-25  8:48 ` [PULL 3/3] virtiofsd: Add docs/helper for killpriv_v2/no_killpriv_v2 option Stefan Hajnoczi
2022-04-25 20:35 ` [PULL 0/3] Block patches Richard Henderson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).