summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCsaba Henk <csaba@gluster.com>2010-08-30 08:24:50 +0000
committerVijay Bellur <vijay@dev.gluster.com>2010-08-30 22:47:33 -0700
commit507ee7301f2372a20c28897d60e1ec753539d886 (patch)
tree6d98a08a31729f66677cb88735e793580f475603
parent1a1052461546576092f2f3b90c1f0f66817b18c2 (diff)
fuse: have the fsname passed to mount(2) include the volfile id
Signed-off-by: Csaba Henk <csaba@gluster.com> Signed-off-by: Vijay Bellur <vijay@dev.gluster.com> BUG: 1478 (show volfile id in mount(8) output) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1478
-rw-r--r--xlators/mount/fuse/src/fuse-bridge.c29
1 files changed, 26 insertions, 3 deletions
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);