qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Dr. David Alan Gilbert (git)" <dgilbert@redhat.com>
To: qemu-devel@nongnu.org, mst@redhat.com,
	marcandre.lureau@redhat.com, stefanha@redhat.com
Cc: piaojun@huawei.com, eguan@linux.alibaba.com, vgoyal@Redhat.com
Subject: [PATCH 07/30] virtiofsd: remove mountpoint dummy argument
Date: Mon, 21 Oct 2019 11:58:09 +0100	[thread overview]
Message-ID: <20191021105832.36574-8-dgilbert@redhat.com> (raw)
In-Reply-To: <20191021105832.36574-1-dgilbert@redhat.com>

From: Stefan Hajnoczi <stefanha@redhat.com>

Classic FUSE file system daemons take a mountpoint argument but
virtiofsd exposes a vhost-user UNIX domain socket instead.  The
mountpoint argument is not used by virtiofsd but the user is still
required to pass a dummy argument on the command-line.

Remove the mountpoint argument to clean up the command-line.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
---
 contrib/virtiofsd/fuse_lowlevel.c  |  2 +-
 contrib/virtiofsd/fuse_lowlevel.h  |  4 +---
 contrib/virtiofsd/helper.c         | 21 +++------------------
 contrib/virtiofsd/passthrough_ll.c | 12 ++----------
 4 files changed, 7 insertions(+), 32 deletions(-)

diff --git a/contrib/virtiofsd/fuse_lowlevel.c b/contrib/virtiofsd/fuse_lowlevel.c
index f83cc2855d..2f40510707 100644
--- a/contrib/virtiofsd/fuse_lowlevel.c
+++ b/contrib/virtiofsd/fuse_lowlevel.c
@@ -2315,7 +2315,7 @@ out1:
 	return NULL;
 }
 
-int fuse_session_mount(struct fuse_session *se, const char *mountpoint)
+int fuse_session_mount(struct fuse_session *se)
 {
 	int fd;
 
diff --git a/contrib/virtiofsd/fuse_lowlevel.h b/contrib/virtiofsd/fuse_lowlevel.h
index 207346081e..b0566ea21d 100644
--- a/contrib/virtiofsd/fuse_lowlevel.h
+++ b/contrib/virtiofsd/fuse_lowlevel.h
@@ -1834,7 +1834,6 @@ struct fuse_cmdline_opts {
 	int foreground;
 	int debug;
 	int nodefault_subtype;
-	char *mountpoint;
 	int show_version;
 	int show_help;
 	int clone_fd;
@@ -1897,12 +1896,11 @@ struct fuse_session *fuse_session_new(struct fuse_args *args,
 /**
  * Mount a FUSE file system.
  *
- * @param mountpoint the mount point path
  * @param se session object
  *
  * @return 0 on success, -1 on failure.
  **/
-int fuse_session_mount(struct fuse_session *se, const char *mountpoint);
+int fuse_session_mount(struct fuse_session *se);
 
 /**
  * Enter a single threaded, blocking event loop.
diff --git a/contrib/virtiofsd/helper.c b/contrib/virtiofsd/helper.c
index 8b993f228b..f7b00db258 100644
--- a/contrib/virtiofsd/helper.c
+++ b/contrib/virtiofsd/helper.c
@@ -142,28 +142,13 @@ void fuse_cmdline_help(void)
 static int fuse_helper_opt_proc(void *data, const char *arg, int key,
 				struct fuse_args *outargs)
 {
+	(void) data;
 	(void) outargs;
-	struct fuse_cmdline_opts *opts = data;
 
 	switch (key) {
 	case FUSE_OPT_KEY_NONOPT:
-		if (!opts->mountpoint) {
-			if (fuse_mnt_parse_fuse_fd(arg) != -1) {
-				return fuse_opt_add_opt(&opts->mountpoint, arg);
-			}
-
-			char mountpoint[PATH_MAX] = "";
-			if (realpath(arg, mountpoint) == NULL) {
-				fuse_log(FUSE_LOG_ERR,
-					"fuse: bad mount point `%s': %s\n",
-					arg, strerror(errno));
-				return -1;
-			}
-			return fuse_opt_add_opt(&opts->mountpoint, mountpoint);
-		} else {
-			fuse_log(FUSE_LOG_ERR, "fuse: invalid argument `%s'\n", arg);
-			return -1;
-		}
+		fuse_log(FUSE_LOG_ERR, "fuse: invalid argument `%s'\n", arg);
+		return -1;
 
 	default:
 		/* Pass through unknown options */
diff --git a/contrib/virtiofsd/passthrough_ll.c b/contrib/virtiofsd/passthrough_ll.c
index 4e3760294a..8f94dcbc92 100644
--- a/contrib/virtiofsd/passthrough_ll.c
+++ b/contrib/virtiofsd/passthrough_ll.c
@@ -1218,7 +1218,7 @@ int main(int argc, char *argv[])
 	if (fuse_parse_cmdline(&args, &opts) != 0)
 		return 1;
 	if (opts.show_help) {
-		printf("usage: %s [options] <mountpoint>\n\n", argv[0]);
+		printf("usage: %s [options]\n\n", argv[0]);
 		fuse_cmdline_help();
 		fuse_lowlevel_help();
 		ret = 0;
@@ -1230,13 +1230,6 @@ int main(int argc, char *argv[])
 		goto err_out1;
 	}
 
-	if(opts.mountpoint == NULL) {
-		printf("usage: %s [options] <mountpoint>\n", argv[0]);
-		printf("       %s --help\n", argv[0]);
-		ret = 1;
-		goto err_out1;
-	}
-
 	if (fuse_opt_parse(&args, &lo, lo_opts, NULL)== -1)
 		return 1;
 
@@ -1295,7 +1288,7 @@ int main(int argc, char *argv[])
 	if (fuse_set_signal_handlers(se) != 0)
 	    goto err_out2;
 
-	if (fuse_session_mount(se, opts.mountpoint) != 0)
+	if (fuse_session_mount(se) != 0)
 	    goto err_out3;
 
 	fuse_daemonize(opts.foreground);
@@ -1312,7 +1305,6 @@ err_out3:
 err_out2:
 	fuse_session_destroy(se);
 err_out1:
-	free(opts.mountpoint);
 	fuse_opt_free_args(&args);
 
 	if (lo.root.fd >= 0)
-- 
2.23.0



  parent reply	other threads:[~2019-10-21 11:05 UTC|newest]

Thread overview: 61+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-21 10:58 [PATCH 00/30] virtiofs daemon (base) Dr. David Alan Gilbert (git)
2019-10-21 10:58 ` [PATCH 01/30] virtiofsd: Pull in upstream headers Dr. David Alan Gilbert (git)
2019-10-21 10:58 ` [PATCH 02/30] virtiofsd: Pull in kernel's fuse.h Dr. David Alan Gilbert (git)
2019-10-24 11:10   ` Michael S. Tsirkin
2019-10-24 14:28     ` Dr. David Alan Gilbert
2019-10-24 11:13   ` Michael S. Tsirkin
2019-10-24 15:49     ` Dr. David Alan Gilbert
2019-10-21 10:58 ` [PATCH 03/30] virtiofsd: Add auxiliary .c's Dr. David Alan Gilbert (git)
2019-10-21 10:58 ` [PATCH 04/30] virtiofsd: Add fuse_lowlevel.c Dr. David Alan Gilbert (git)
2019-10-24 11:11   ` Michael S. Tsirkin
2019-10-24 14:31     ` Dr. David Alan Gilbert
2019-10-21 10:58 ` [PATCH 05/30] virtiofsd: Add passthrough_ll Dr. David Alan Gilbert (git)
2019-10-21 10:58 ` [PATCH 06/30] virtiofsd: Trim down imported files Dr. David Alan Gilbert (git)
2019-10-21 10:58 ` Dr. David Alan Gilbert (git) [this message]
2019-10-21 10:58 ` [PATCH 08/30] virtiofsd: remove unused notify reply support Dr. David Alan Gilbert (git)
2019-10-21 10:58 ` [PATCH 09/30] virtiofsd: Fix fuse_daemonize ignored return values Dr. David Alan Gilbert (git)
2019-10-21 10:58 ` [PATCH 10/30] virtiofsd: Fix common header and define for QEMU builds Dr. David Alan Gilbert (git)
2019-10-21 10:58 ` [PATCH 11/30] virtiofsd: fuse: Make iov_length usable outside fuse_lowlevel.c Dr. David Alan Gilbert (git)
2019-10-21 14:47   ` Marc-André Lureau
2019-10-22 10:01     ` Dr. David Alan Gilbert
2019-10-21 10:58 ` [PATCH 12/30] virtiofsd: Make fsync work even if only inode is passed in Dr. David Alan Gilbert (git)
2019-10-21 10:58 ` [PATCH 13/30] virtiofsd: Add options for virtio Dr. David Alan Gilbert (git)
2019-10-21 10:58 ` [PATCH 14/30] virtiofsd: add -o source=PATH to help output Dr. David Alan Gilbert (git)
2019-10-21 10:58 ` [PATCH 15/30] virtiofsd: Open vhost connection instead of mounting Dr. David Alan Gilbert (git)
2019-10-21 10:58 ` [PATCH 16/30] virtiofsd: Start wiring up vhost-user Dr. David Alan Gilbert (git)
2019-10-21 10:58 ` [PATCH 17/30] virtiofsd: Add main virtio loop Dr. David Alan Gilbert (git)
2019-10-21 14:51   ` Marc-André Lureau
2019-10-22 11:07     ` Dr. David Alan Gilbert
2019-11-14 14:13       ` Stefan Hajnoczi
2019-10-21 10:58 ` [PATCH 18/30] virtiofsd: get/set features callbacks Dr. David Alan Gilbert (git)
2019-10-21 10:58 ` [PATCH 19/30] virtiofsd: Start queue threads Dr. David Alan Gilbert (git)
2019-10-21 10:58 ` [PATCH 20/30] virtiofsd: Poll kick_fd for queue Dr. David Alan Gilbert (git)
2019-10-21 10:58 ` [PATCH 21/30] virtiofsd: Start reading commands from queue Dr. David Alan Gilbert (git)
2019-10-21 14:57   ` Marc-André Lureau
2019-10-22 10:28     ` Dr. David Alan Gilbert
2019-10-21 10:58 ` [PATCH 22/30] virtiofsd: Send replies to messages Dr. David Alan Gilbert (git)
2019-10-21 10:58 ` [PATCH 23/30] virtiofsd: Keep track of replies Dr. David Alan Gilbert (git)
2019-10-21 10:58 ` [PATCH 24/30] virtiofsd: Add Makefile wiring for virtiofsd contrib Dr. David Alan Gilbert (git)
2019-10-21 10:58 ` [PATCH 25/30] virtiofsd: Fast path for virtio read Dr. David Alan Gilbert (git)
2019-10-21 10:58 ` [PATCH 26/30] virtiofsd: add --fd=FDNUM fd passing option Dr. David Alan Gilbert (git)
2019-10-21 10:58 ` [PATCH 27/30] virtiofsd: make -f (foreground) the default Dr. David Alan Gilbert (git)
2019-10-21 10:58 ` [PATCH 28/30] virtiofsd: add vhost-user.json file Dr. David Alan Gilbert (git)
2019-10-21 10:58 ` [PATCH 29/30] virtiofsd: add --print-capabilities option Dr. David Alan Gilbert (git)
2019-10-21 10:58 ` [PATCH 30/30] virtiofs: Add maintainers entry Dr. David Alan Gilbert (git)
     [not found] ` <157166664425.24734.3489596262271351160@37313f22b938>
2019-10-21 14:33   ` [PATCH 00/30] virtiofs daemon (base) Dr. David Alan Gilbert
2019-10-24 10:59     ` Michael S. Tsirkin
2019-10-24 11:02       ` Dr. David Alan Gilbert
2019-10-24 11:07       ` Daniel P. Berrangé
2019-10-24 11:14         ` Dr. David Alan Gilbert
2019-10-24 11:19           ` Michael S. Tsirkin
2019-10-24 12:54             ` Dr. David Alan Gilbert
2019-10-24 11:25           ` Daniel P. Berrangé
2019-10-24 13:36             ` Dr. David Alan Gilbert
2019-10-24 11:14 ` Michael S. Tsirkin
2019-10-24 16:19   ` Dr. David Alan Gilbert
2019-10-27 13:11 ` Michael S. Tsirkin
2019-10-28 13:24   ` Dr. David Alan Gilbert
2019-10-29 22:50 ` Michael S. Tsirkin
2019-10-30 10:47   ` Dr. David Alan Gilbert
2019-10-31  0:34     ` Michael S. Tsirkin
2019-10-31 13:20       ` Dr. David Alan Gilbert

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=20191021105832.36574-8-dgilbert@redhat.com \
    --to=dgilbert@redhat.com \
    --cc=eguan@linux.alibaba.com \
    --cc=marcandre.lureau@redhat.com \
    --cc=mst@redhat.com \
    --cc=piaojun@huawei.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    --cc=vgoyal@Redhat.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).