Skip to content

Commit

Permalink
virtiofsd: remove mountpoint dummy argument
Browse files Browse the repository at this point in the history
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>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
  • Loading branch information
stefanhaRH authored and dagrh committed Jan 23, 2020
1 parent 7387863 commit 67aab02
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 31 deletions.
2 changes: 1 addition & 1 deletion tools/virtiofsd/fuse_lowlevel.c
Expand Up @@ -2455,7 +2455,7 @@ struct fuse_session *fuse_session_new(struct fuse_args *args,
return NULL;
}

int fuse_session_mount(struct fuse_session *se, const char *mountpoint)
int fuse_session_mount(struct fuse_session *se)
{
int fd;

Expand Down
4 changes: 1 addition & 3 deletions tools/virtiofsd/fuse_lowlevel.h
Expand Up @@ -1863,7 +1863,6 @@ struct fuse_cmdline_opts {
int foreground;
int debug;
int nodefault_subtype;
char *mountpoint;
int show_version;
int show_help;
unsigned int max_idle_threads;
Expand Down Expand Up @@ -1924,12 +1923,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.
Expand Down
20 changes: 3 additions & 17 deletions tools/virtiofsd/helper.c
Expand Up @@ -140,27 +140,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 */
Expand Down
12 changes: 2 additions & 10 deletions tools/virtiofsd/passthrough_ll.c
Expand Up @@ -1297,7 +1297,7 @@ int main(int argc, char *argv[])
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;
Expand All @@ -1308,13 +1308,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;
}
Expand Down Expand Up @@ -1374,7 +1367,7 @@ int main(int argc, char *argv[])
goto err_out2;
}

if (fuse_session_mount(se, opts.mountpoint) != 0) {
if (fuse_session_mount(se) != 0) {
goto err_out3;
}

Expand All @@ -1393,7 +1386,6 @@ int main(int argc, char *argv[])
err_out2:
fuse_session_destroy(se);
err_out1:
free(opts.mountpoint);
fuse_opt_free_args(&args);

if (lo.root.fd >= 0) {
Expand Down

0 comments on commit 67aab02

Please sign in to comment.