summaryrefslogtreecommitdiffstats
path: root/glusterfsd/src
diff options
context:
space:
mode:
authorCsaba Henk <csaba@gluster.com>2010-05-12 19:10:47 +0000
committerAnand V. Avati <avati@dev.gluster.com>2010-05-13 12:12:08 -0700
commit2a0398dee8521704b90d3f1776a5e380bf8ac5b3 (patch)
tree394a62736967be4cfec9314e8fdc9cce54ebcd25 /glusterfsd/src
parent9bdda4ce0aaebb3f8109152f056d9b35229fb708 (diff)
added features/mac-compat
Signed-off-by: Csaba Henk <csaba@gluster.com> Signed-off-by: Anand V. Avati <avati@dev.gluster.com> BUG: 800 (Problem on OSX with NFS and CIFS exports) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=800
Diffstat (limited to 'glusterfsd/src')
-rw-r--r--glusterfsd/src/glusterfsd.c55
-rw-r--r--glusterfsd/src/glusterfsd.h2
2 files changed, 32 insertions, 25 deletions
diff --git a/glusterfsd/src/glusterfsd.c b/glusterfsd/src/glusterfsd.c
index 12d6be445..b01285a08 100644
--- a/glusterfsd/src/glusterfsd.c
+++ b/glusterfsd/src/glusterfsd.c
@@ -142,6 +142,8 @@ static struct argp_option gf_options[] = {
"Add/override a translator option for a volume with specified value"},
{"read-only", ARGP_READ_ONLY_KEY, 0, 0,
"Mount the filesystem in 'read-only' mode"},
+ {"mac-compat", ARGP_MAC_COMPAT_KEY, 0, 0,
+ "Provide stubs for attributes needed for seamless operation on Macs"},
{0, 0, 0, 0, "Fuse options:"},
{"disable-direct-io-mode", ARGP_DISABLE_DIRECT_IO_MODE_KEY, 0, 0,
@@ -373,15 +375,21 @@ _add_fuse_mount (xlator_t *graph)
}
static xlator_t *
-_add_ro_volume (xlator_t *graph)
+_add_volume (xlator_t *graph, const char *voltype)
{
cmd_args_t *cmd_args = NULL;
xlator_t *top = NULL;
glusterfs_ctx_t *ctx = NULL;
xlator_list_t *xlchild = NULL;
+ char *shortvoltype = (char *)voltype;
ctx = graph->ctx;
cmd_args = &ctx->cmd_args;
+ for (;;) {
+ if (*(shortvoltype++) == '/')
+ break;
+ assert (*shortvoltype);
+ }
xlchild = CALLOC (sizeof (*xlchild), 1);
if (!xlchild) {
@@ -390,12 +398,13 @@ _add_ro_volume (xlator_t *graph)
xlchild->xlator = graph;
top = CALLOC (1, sizeof (*top));
- top->name = strdup ("read-only");
- if (xlator_set_type (top, ZR_XLATOR_READ_ONLY) == -1) {
+ top->name = strdup (shortvoltype);
+ if (xlator_set_type (top, voltype) == -1) {
fprintf (stderr,
- "read-only volume initialization failed");
+ "%s volume initialization failed",
+ shortvoltype);
gf_log ("glusterfs", GF_LOG_ERROR,
- "read-only initialization failed");
+ "%s initialization failed", shortvoltype);
return NULL;
}
top->children = xlchild;
@@ -843,6 +852,10 @@ parse_opts (int key, char *arg, struct argp_state *state)
cmd_args->read_only = 1;
break;
+ case ARGP_MAC_COMPAT_KEY:
+ cmd_args->mac_compat = 1;
+ break;
+
case ARGP_VOLUME_FILE_KEY:
cmd_args->volume_file = gf_strdup (arg);
break;
@@ -1362,27 +1375,19 @@ main (int argc, char *argv[])
"on client side, exiting\n");
return -1;
}
- if (!fuse_volume_found && (cmd_args->mount_point != NULL)) {
+ if (cmd_args->mac_compat)
+ graph = _add_volume (graph, ZR_XLATOR_MAC_COMPAT);
+ if (graph && !fuse_volume_found && (cmd_args->mount_point != NULL)) {
/* Check for read-only option and add a read-only translator */
- if (cmd_args->read_only) {
- if ((graph = _add_ro_volume (graph)) == NULL) {
- /* _add_fuse_mount() prints necessary
- * error message
- */
- fprintf (stderr,
- "failed to load 'ro' option. exiting\n");
- gf_log ("glusterfs", GF_LOG_ERROR, "exiting");
- return -1;
- }
- }
- if ((graph = _add_fuse_mount (graph)) == NULL) {
- /* _add_fuse_mount() prints necessary
- * error message
- */
- fprintf (stderr, "exiting\n");
- gf_log ("glusterfs", GF_LOG_ERROR, "exiting");
- return -1;
- }
+ if (cmd_args->read_only)
+ graph = _add_volume (graph, ZR_XLATOR_READ_ONLY);
+ if (graph)
+ graph = _add_fuse_mount (graph);
+ }
+ if (!graph) {
+ fprintf (stderr, "failed to complete xlator graph, exiting\n");
+ gf_log ("glusterfs", GF_LOG_ERROR, "exiting");
+ return -1;
}
/* daemonize now */
diff --git a/glusterfsd/src/glusterfsd.h b/glusterfsd/src/glusterfsd.h
index f3ee2ed3f..ec068ec00 100644
--- a/glusterfsd/src/glusterfsd.h
+++ b/glusterfsd/src/glusterfsd.h
@@ -44,6 +44,7 @@
#define ENABLE_DEBUG_MODE 1
#define ZR_XLATOR_READ_ONLY "features/read-only"
+#define ZR_XLATOR_MAC_COMPAT "features/mac-compat"
#define ZR_XLATOR_FUSE "mount/fuse"
#define ZR_MOUNTPOINT_OPT "mountpoint"
#define ZR_ATTR_TIMEOUT_OPT "attribute-timeout"
@@ -77,6 +78,7 @@ enum argp_option_keys {
ARGP_LOG_SERVER_KEY = 146,
ARGP_LOG_SERVER_PORT_KEY = 147,
ARGP_READ_ONLY_KEY = 148,
+ ARGP_MAC_COMPAT_KEY = 149,
};
/* Moved here from fetch-spec.h */