qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Sakshi Kaushik <sakshikaushik717@gmail.com>
To: qemu-devel@nongnu.org
Cc: stefanha@gmail.com, raphel.norwitz@nutanix.com,
	Sakshi Kaushik <sakshikaushik717@gmail.com>,
	mst@redhat.com
Subject: [PATCH] [PATCH RFC v2] Implements Backend Program conventions for vhost-user-scsi
Date: Thu, 31 Mar 2022 23:48:15 -0500	[thread overview]
Message-ID: <20220401044815.6158-1-sakshikaushik717@gmail.com> (raw)

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



             reply	other threads:[~2022-04-01  4:50 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-01  4:48 Sakshi Kaushik [this message]
  -- strict thread matches above, loose matches on Subject: below --
2022-04-03  7:21 [PATCH] [PATCH RFC v2] Implements Backend Program conventions for vhost-user-scsi 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

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=20220401044815.6158-1-sakshikaushik717@gmail.com \
    --to=sakshikaushik717@gmail.com \
    --cc=mst@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=raphel.norwitz@nutanix.com \
    --cc=stefanha@gmail.com \
    /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 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).