All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] [PATCH RFC v2] Implements Backend Program conventions for vhost-user-scsi
@ 2022-04-01  4:48 Sakshi Kaushik
  0 siblings, 0 replies; 5+ messages in thread
From: Sakshi Kaushik @ 2022-04-01  4:48 UTC (permalink / raw)
  To: qemu-devel; +Cc: stefanha, raphel.norwitz, Sakshi Kaushik, mst

Signed-off-by: Sakshi Kaushik <sakshikaushik717@gmail.com>
---
 contrib/vhost-user-scsi/vhost-user-scsi.c | 35 +++++++++++++++++++----
 1 file changed, 29 insertions(+), 6 deletions(-)

diff --git a/contrib/vhost-user-scsi/vhost-user-scsi.c b/contrib/vhost-user-scsi/vhost-user-scsi.c
index 4f6e3e2a24..9bdc088ce8 100644
--- a/contrib/vhost-user-scsi/vhost-user-scsi.c
+++ b/contrib/vhost-user-scsi/vhost-user-scsi.c
@@ -353,6 +353,8 @@ fail:
 
 int main(int argc, char **argv)
 {
+    static int opt_fdnum = -1;
+    static gboolean opt_print_caps;
     VusDev *vdev_scsi = NULL;
     char *unix_fn = NULL;
     char *iscsi_uri = NULL;
@@ -362,12 +364,18 @@ int main(int argc, char **argv)
         switch (opt) {
         case 'h':
             goto help;
-        case 'u':
+        case 's':
             unix_fn = g_strdup(optarg);
             break;
         case 'i':
             iscsi_uri = g_strdup(optarg);
             break;
+        case 'f':
+            opt_fdnum = g_strdup(optarg);
+            break;
+        case 'p':
+            opt_print_caps = g_strdup(optarg);
+            break;
         default:
             goto help;
         }
@@ -376,9 +384,22 @@ int main(int argc, char **argv)
         goto help;
     }
 
-    lsock = unix_sock_new(unix_fn);
-    if (lsock < 0) {
-        goto err;
+    if (unix_fn) {
+        lsock = unix_sock_new(unix_fn);
+        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;
+    }
+
+    if (opt_print_caps) {
+        if (opt_print_caps["type"] != "scsi") {
+            goto err;
+        }
     }
 
     csock = accept(lsock, NULL, NULL);
@@ -426,10 +447,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, "          -s path to unix socket\n");
     fprintf(stderr, "          -i iscsi uri for lun 0\n");
+    fprintf(stderr, "          -f fd, file-descriptor\n");
+    fprintf(stderr, "          -p denotes print-capabilities\n");
     fprintf(stderr, "          -h print help and quit\n");
 
     goto err;
-- 
2.17.1



^ permalink raw reply related	[flat|nested] 5+ messages in thread
* [PATCH] [PATCH RFC v2] Implements Backend Program conventions for vhost-user-scsi
@ 2022-04-03  7:21 Sakshi Kaushik
  2022-04-03 19:46 ` Stefan Hajnoczi
  0 siblings, 1 reply; 5+ messages in thread
From: Sakshi Kaushik @ 2022-04-03  7:21 UTC (permalink / raw)
  To: qemu-devel; +Cc: raphel.norwitz, Sakshi Kaushik, stefanha, mst

Signed-off-by: Sakshi Kaushik <sakshikaushik717@gmail.com>
---
 contrib/vhost-user-scsi/vhost-user-scsi.c | 35 +++++++++++++++++++----
 1 file changed, 29 insertions(+), 6 deletions(-)

diff --git a/contrib/vhost-user-scsi/vhost-user-scsi.c b/contrib/vhost-user-scsi/vhost-user-scsi.c
index 4f6e3e2a24..9bdc088ce8 100644
--- a/contrib/vhost-user-scsi/vhost-user-scsi.c
+++ b/contrib/vhost-user-scsi/vhost-user-scsi.c
@@ -353,6 +353,8 @@ fail:
 
 int main(int argc, char **argv)
 {
+    static int opt_fdnum = -1;
+    static gboolean opt_print_caps;
     VusDev *vdev_scsi = NULL;
     char *unix_fn = NULL;
     char *iscsi_uri = NULL;
@@ -362,12 +364,18 @@ int main(int argc, char **argv)
         switch (opt) {
         case 'h':
             goto help;
-        case 'u':
+        case 's':
             unix_fn = g_strdup(optarg);
             break;
         case 'i':
             iscsi_uri = g_strdup(optarg);
             break;
+        case 'f':
+            opt_fdnum = g_strdup(optarg);
+            break;
+        case 'p':
+            opt_print_caps = g_strdup(optarg);
+            break;
         default:
             goto help;
         }
@@ -376,9 +384,22 @@ int main(int argc, char **argv)
         goto help;
     }
 
-    lsock = unix_sock_new(unix_fn);
-    if (lsock < 0) {
-        goto err;
+    if (unix_fn) {
+        lsock = unix_sock_new(unix_fn);
+        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;
+    }
+
+    if (opt_print_caps) {
+        if (opt_print_caps["type"] != "scsi") {
+            goto err;
+        }
     }
 
     csock = accept(lsock, NULL, NULL);
@@ -426,10 +447,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, "          -s path to unix socket\n");
     fprintf(stderr, "          -i iscsi uri for lun 0\n");
+    fprintf(stderr, "          -f fd, file-descriptor\n");
+    fprintf(stderr, "          -p denotes print-capabilities\n");
     fprintf(stderr, "          -h print help and quit\n");
 
     goto err;
-- 
2.17.1



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

end of thread, other threads:[~2022-04-04 15:52 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-01  4:48 [PATCH] [PATCH RFC v2] Implements Backend Program conventions for vhost-user-scsi Sakshi Kaushik
2022-04-03  7:21 Sakshi Kaushik
2022-04-03 19:46 ` Stefan Hajnoczi
     [not found]   ` <CAFt73e_Rku3pgQ+YAj-zAcrq36JJd1A1pBA-AX8JMrqRY0f5TA@mail.gmail.com>
2022-04-04  8:29     ` Stefan Hajnoczi
     [not found]       ` <CAFt73e-2pf1XDp66PVCPq4kUiegChJGhaiEyHAvyWUf77jbNEw@mail.gmail.com>
2022-04-04 15:44         ` Stefan Hajnoczi

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.