From c35f6bf8f735eaf35c950d7b7789f6b64ba2c8c0 Mon Sep 17 00:00:00 2001 From: Csaba Henk Date: Thu, 8 Jul 2010 05:46:50 +0000 Subject: minor option handling refactorizations - clean up ZR_* internal option defines - make argument order of glusterfs_graph_activate() aligned with other graph ops Signed-off-by: Csaba Henk Signed-off-by: Anand V. Avati BUG: 971 (dynamic volume management) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=971 --- glusterfsd/src/Makefile.am | 2 +- glusterfsd/src/glusterfsd-common.h | 30 ++++++++++++++++++++++++++++++ glusterfsd/src/glusterfsd.c | 4 ++-- glusterfsd/src/glusterfsd.h | 14 +++----------- libglusterfs/src/glusterfs.h | 2 +- libglusterfs/src/graph.c | 2 +- xlators/mount/fuse/src/Makefile.am | 2 +- xlators/mount/fuse/src/fuse-bridge.c | 15 ++++++--------- 8 files changed, 45 insertions(+), 26 deletions(-) create mode 100644 glusterfsd/src/glusterfsd-common.h diff --git a/glusterfsd/src/Makefile.am b/glusterfsd/src/Makefile.am index cab7976e3ee..1c67e1cf117 100644 --- a/glusterfsd/src/Makefile.am +++ b/glusterfsd/src/Makefile.am @@ -6,7 +6,7 @@ glusterfsd_SOURCES += $(CONTRIBDIR)/apple/daemon.c endif glusterfsd_LDADD = $(top_builddir)/libglusterfs/src/libglusterfs.la $(GF_LDADD) glusterfsd_LDFLAGS = $(GF_LDFLAGS) $(GF_GLUSTERFS_LDFLAGS) -noinst_HEADERS = glusterfsd.h glusterfsd-mem-types.h +noinst_HEADERS = glusterfsd.h glusterfsd-common.h glusterfsd-mem-types.h AM_CFLAGS = -fPIC -Wall -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -D$(GF_HOST_OS)\ -I$(top_srcdir)/libglusterfs/src -DDATADIR=\"$(localstatedir)\" \ diff --git a/glusterfsd/src/glusterfsd-common.h b/glusterfsd/src/glusterfsd-common.h new file mode 100644 index 00000000000..47f94721003 --- /dev/null +++ b/glusterfsd/src/glusterfsd-common.h @@ -0,0 +1,30 @@ +/* + Copyright (c) 2006-2010 Gluster, Inc. + This file is part of GlusterFS. + + GlusterFS is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published + by the Free Software Foundation; either version 3 of the License, + or (at your option) any later version. + + GlusterFS is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see + . +*/ + +#ifndef __GLUSTERFSD_COMMON_H__ +#define __GLUSTERFSD_COMMON_H__ + +#define ZR_MOUNTPOINT_OPT "mountpoint" +#define ZR_ATTR_TIMEOUT_OPT "attribute-timeout" +#define ZR_ENTRY_TIMEOUT_OPT "entry-timeout" +#define ZR_DIRECT_IO_OPT "direct-io-mode" +#define ZR_STRICT_VOLFILE_CHECK "strict-volfile-check" +#define ZR_DUMP_FUSE "dump-fuse" + +#endif diff --git a/glusterfsd/src/glusterfsd.c b/glusterfsd/src/glusterfsd.c index 32a9bc8fc13..d1f9ae1513f 100644 --- a/glusterfsd/src/glusterfsd.c +++ b/glusterfsd/src/glusterfsd.c @@ -204,7 +204,7 @@ create_fuse_mount (glusterfs_ctx_t *ctx) if (!master->name) goto err; - if (xlator_set_type (master, ZR_XLATOR_FUSE) == -1) { + if (xlator_set_type (master, "mount/fuse") == -1) { gf_log ("glusterfsd", GF_LOG_ERROR, "MOUNT-POINT %s initialization failed", cmd_args->mount_point); @@ -1189,7 +1189,7 @@ glusterfs_volumes_init (glusterfs_ctx_t *ctx) if (!ret) ret = create_fuse_mount (ctx); if (!ret) - ret = glusterfs_graph_activate (ctx, graph); + ret = glusterfs_graph_activate (graph, ctx); if (ret) { glusterfs_graph_destroy (graph); diff --git a/glusterfsd/src/glusterfsd.h b/glusterfsd/src/glusterfsd.h index e4f4babaad0..d67d181e174 100644 --- a/glusterfsd/src/glusterfsd.h +++ b/glusterfsd/src/glusterfsd.h @@ -1,5 +1,5 @@ /* - Copyright (c) 2006-2009 Gluster, Inc. + Copyright (c) 2006-2010 Gluster, Inc. This file is part of GlusterFS. GlusterFS is free software; you can redistribute it and/or modify @@ -25,6 +25,8 @@ #include "config.h" #endif +#include "glusterfsd-common.h" + #define DEFAULT_CLIENT_VOLFILE CONFDIR "/glusterfs.vol" #define DEFAULT_SERVER_VOLFILE CONFDIR "/glusterfsd.vol" #define DEFAULT_LOG_FILE_DIRECTORY DATADIR "/log/glusterfs" @@ -43,16 +45,6 @@ #define ENABLE_NO_DAEMON_MODE 1 #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" -#define ZR_ENTRY_TIMEOUT_OPT "entry-timeout" -#define ZR_DIRECT_IO_OPT "direct-io-mode" -#define ZR_STRICT_VOLFILE_CHECK "strict-volfile-check" -#define ZR_DUMP_FUSE "dump-fuse" - enum argp_option_keys { ARGP_VOLFILE_SERVER_KEY = 's', ARGP_VOLUME_FILE_KEY = 'f', diff --git a/libglusterfs/src/glusterfs.h b/libglusterfs/src/glusterfs.h index 5b9f375e6d3..8ddb4e74c8c 100644 --- a/libglusterfs/src/glusterfs.h +++ b/libglusterfs/src/glusterfs.h @@ -295,7 +295,7 @@ typedef enum { int glusterfs_graph_prepare (glusterfs_graph_t *graph, glusterfs_ctx_t *ctx); int glusterfs_graph_destroy (glusterfs_graph_t *graph); -int glusterfs_graph_activate (glusterfs_ctx_t *ctx, glusterfs_graph_t *graph); +int glusterfs_graph_activate (glusterfs_graph_t *graph, glusterfs_ctx_t *ctx); glusterfs_graph_t *glusterfs_graph_construct (FILE *fp); glusterfs_graph_t *glusterfs_graph_new (); #endif /* _GLUSTERFS_H */ diff --git a/libglusterfs/src/graph.c b/libglusterfs/src/graph.c index af962107d44..d5fcafd6810 100644 --- a/libglusterfs/src/graph.c +++ b/libglusterfs/src/graph.c @@ -522,7 +522,7 @@ glusterfs_graph_prepare (glusterfs_graph_t *graph, glusterfs_ctx_t *ctx) int -glusterfs_graph_activate (glusterfs_ctx_t *ctx, glusterfs_graph_t *graph) +glusterfs_graph_activate (glusterfs_graph_t *graph, glusterfs_ctx_t *ctx) { int ret = 0; diff --git a/xlators/mount/fuse/src/Makefile.am b/xlators/mount/fuse/src/Makefile.am index 93ee00b81c8..58e33a4e116 100644 --- a/xlators/mount/fuse/src/Makefile.am +++ b/xlators/mount/fuse/src/Makefile.am @@ -17,7 +17,7 @@ fuse_la_LDFLAGS = -module -avoidversion -shared -nostartfiles AM_CFLAGS = -fPIC -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -D$(GF_HOST_OS) -Wall \ -I$(top_srcdir)/libglusterfs/src -I$(CONTRIBDIR)/fuse-include \ - $(GF_CFLAGS) $(GF_FUSE_CFLAGS) + -I$(top_srcdir)/glusterfsd/src $(GF_CFLAGS) $(GF_FUSE_CFLAGS) CLEANFILES = diff --git a/xlators/mount/fuse/src/fuse-bridge.c b/xlators/mount/fuse/src/fuse-bridge.c index 4618a37854c..142ff064e55 100644 --- a/xlators/mount/fuse/src/fuse-bridge.c +++ b/xlators/mount/fuse/src/fuse-bridge.c @@ -44,6 +44,7 @@ #include "xlator.h" #include "defaults.h" #include "common-utils.h" +#include "glusterfsd-common.h" #include "statedump.h" #ifdef GF_DARWIN_HOST_OS @@ -63,10 +64,6 @@ /* TODO: when supporting posix acl, remove this definition */ #define DISABLE_POSIX_ACL -#define ZR_MOUNTPOINT_OPT "mountpoint" -#define ZR_DIRECT_IO_OPT "direct-io-mode" -#define ZR_STRICT_VOLFILE_CHECK "strict-volfile-check" - #ifdef GF_LINUX_HOST_OS #define FUSE_OP_HIGH (FUSE_POLL + 1) #endif @@ -3766,19 +3763,19 @@ struct volume_options options[] = { { .key = {"direct-io-mode"}, .type = GF_OPTION_TYPE_BOOL }, - { .key = {"mountpoint", "mount-point"}, + { .key = {ZR_MOUNTPOINT_OPT, "mount-point"}, .type = GF_OPTION_TYPE_PATH }, - { .key = {"dump-fuse", "fuse-dumpfile"}, + { .key = {ZR_DUMP_FUSE, "fuse-dumpfile"}, .type = GF_OPTION_TYPE_PATH }, - { .key = {"attribute-timeout"}, + { .key = {ZR_ATTR_TIMEOUT_OPT}, .type = GF_OPTION_TYPE_DOUBLE }, - { .key = {"entry-timeout"}, + { .key = {ZR_ENTRY_TIMEOUT_OPT}, .type = GF_OPTION_TYPE_DOUBLE }, - { .key = {"strict-volfile-check"}, + { .key = {ZR_STRICT_VOLFILE_CHECK}, .type = GF_OPTION_TYPE_BOOL }, { .key = {NULL} }, -- cgit