From 507ee7301f2372a20c28897d60e1ec753539d886 Mon Sep 17 00:00:00 2001 From: Csaba Henk Date: Mon, 30 Aug 2010 08:24:50 +0000 Subject: fuse: have the fsname passed to mount(2) include the volfile id Signed-off-by: Csaba Henk Signed-off-by: Vijay Bellur BUG: 1478 (show volfile id in mount(8) output) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1478 --- xlators/mount/fuse/src/fuse-bridge.c | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) (limited to 'xlators/mount') diff --git a/xlators/mount/fuse/src/fuse-bridge.c b/xlators/mount/fuse/src/fuse-bridge.c index ef433d0a0..aea0f88b0 100644 --- a/xlators/mount/fuse/src/fuse-bridge.c +++ b/xlators/mount/fuse/src/fuse-bridge.c @@ -3425,11 +3425,13 @@ init (xlator_t *this_xl) int ret = 0; dict_t *options = NULL; char *value_string = NULL; + cmd_args_t *cmd_args = NULL; char *fsname = NULL; fuse_private_t *priv = NULL; struct stat stbuf = {0,}; int i = 0; int xl_name_allocated = 0; + int fsname_allocated = 0; if (this_xl == NULL) return -1; @@ -3545,9 +3547,28 @@ init (xlator_t *this_xl) priv->fuse_dump_fd = ret; } - fsname = this_xl->ctx->cmd_args.volfile; - fsname = (fsname ? fsname : this_xl->ctx->cmd_args.volfile_server); - fsname = (fsname ? fsname : "glusterfs"); + cmd_args = &this_xl->ctx->cmd_args; + fsname = cmd_args->volfile; + if (!fsname && cmd_args->volfile_server) { + if (cmd_args->volfile_id) { + fsname = GF_MALLOC ( + strlen (cmd_args->volfile_server) + 1 + + strlen (cmd_args->volfile_server) + 1, + gf_fuse_mt_fuse_private_t); + if (!fsname) { + gf_log ("glusterfs-fuse", GF_LOG_ERROR, + "Out of memory"); + goto cleanup_exit; + } + fsname_allocated = 1; + strcpy (fsname, cmd_args->volfile_server); + strcat (fsname, ":"); + strcat (fsname, cmd_args->volfile_id); + } else + fsname = cmd_args->volfile_server; + } + if (!fsname) + fsname = "glusterfs"; priv->fd = gf_fuse_mount (priv->mount_point, fsname, @@ -3578,6 +3599,8 @@ init (xlator_t *this_xl) cleanup_exit: if (xl_name_allocated) GF_FREE (this_xl->name); + if (fsname_allocated) + GF_FREE (fsname); if (priv) { GF_FREE (priv->mount_point); close (priv->fd); -- cgit