summaryrefslogtreecommitdiffstats
path: root/libglusterfs/src/globals.c
diff options
context:
space:
mode:
authorAnand Avati <avati@gluster.com>2010-06-07 12:37:34 +0000
committerAnand V. Avati <avati@dev.gluster.com>2010-06-07 11:58:50 -0700
commit79241696fbdebe2583298f12cbaee068ce60c655 (patch)
tree42e60d351e328fa34f17242c6c3359a8c01e8fa3 /libglusterfs/src/globals.c
parentc4ebd25a176d6d51d702b1009e261c3c27237a48 (diff)
dynamic volume changes for graph replacement
Signed-off-by: Anand V. Avati <avati@blackhole.gluster.com> Signed-off-by: Anand V. Avati <avati@dev.gluster.com> BUG: 971 (dynamic volume management) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=971
Diffstat (limited to 'libglusterfs/src/globals.c')
-rw-r--r--libglusterfs/src/globals.c70
1 files changed, 67 insertions, 3 deletions
diff --git a/libglusterfs/src/globals.c b/libglusterfs/src/globals.c
index 9677a169ecb..d480f089fcb 100644
--- a/libglusterfs/src/globals.c
+++ b/libglusterfs/src/globals.c
@@ -24,12 +24,73 @@
#include <pthread.h>
-#include "globals.h"
#include "glusterfs.h"
+#include "globals.h"
#include "xlator.h"
#include "mem-pool.h"
+/* gf_*_list[] */
+
+char *gf_fop_list[GF_FOP_MAXVALUE];
+char *gf_mgmt_list[GF_MGMT_MAXVALUE];
+
+
+void
+gf_op_list_init()
+{
+ gf_fop_list[GF_FOP_NULL] = "NULL";
+ gf_fop_list[GF_FOP_STAT] = "STAT";
+ gf_fop_list[GF_FOP_READLINK] = "READLINK";
+ gf_fop_list[GF_FOP_MKNOD] = "MKNOD";
+ gf_fop_list[GF_FOP_MKDIR] = "MKDIR";
+ gf_fop_list[GF_FOP_UNLINK] = "UNLINK";
+ gf_fop_list[GF_FOP_RMDIR] = "RMDIR";
+ gf_fop_list[GF_FOP_SYMLINK] = "SYMLINK";
+ gf_fop_list[GF_FOP_RENAME] = "RENAME";
+ gf_fop_list[GF_FOP_LINK] = "LINK";
+ gf_fop_list[GF_FOP_TRUNCATE] = "TRUNCATE";
+ gf_fop_list[GF_FOP_OPEN] = "OPEN";
+ gf_fop_list[GF_FOP_READ] = "READ";
+ gf_fop_list[GF_FOP_WRITE] = "WRITE";
+ gf_fop_list[GF_FOP_STATFS] = "STATFS";
+ gf_fop_list[GF_FOP_FLUSH] = "FLUSH";
+ gf_fop_list[GF_FOP_FSYNC] = "FSYNC";
+ gf_fop_list[GF_FOP_SETXATTR] = "SETXATTR";
+ gf_fop_list[GF_FOP_GETXATTR] = "GETXATTR";
+ gf_fop_list[GF_FOP_REMOVEXATTR] = "REMOVEXATTR";
+ gf_fop_list[GF_FOP_OPENDIR] = "OPENDIR";
+ gf_fop_list[GF_FOP_FSYNCDIR] = "FSYNCDIR";
+ gf_fop_list[GF_FOP_ACCESS] = "ACCESS";
+ gf_fop_list[GF_FOP_CREATE] = "CREATE";
+ gf_fop_list[GF_FOP_FTRUNCATE] = "FTRUNCATE";
+ gf_fop_list[GF_FOP_FSTAT] = "FSTAT";
+ gf_fop_list[GF_FOP_LK] = "LK";
+ gf_fop_list[GF_FOP_LOOKUP] = "LOOKUP";
+ gf_fop_list[GF_FOP_READDIR] = "READDIR";
+ gf_fop_list[GF_FOP_INODELK] = "INODELK";
+ gf_fop_list[GF_FOP_FINODELK] = "FINODELK";
+ gf_fop_list[GF_FOP_ENTRYLK] = "ENTRYLK";
+ gf_fop_list[GF_FOP_FENTRYLK] = "FENTRYLK";
+ gf_fop_list[GF_FOP_CHECKSUM] = "CHECKSUM";
+ gf_fop_list[GF_FOP_XATTROP] = "XATTROP";
+ gf_fop_list[GF_FOP_FXATTROP] = "FXATTROP";
+ gf_fop_list[GF_FOP_FSETXATTR] = "FSETXATTR";
+ gf_fop_list[GF_FOP_FGETXATTR] = "FGETXATTR";
+ gf_fop_list[GF_FOP_RCHECKSUM] = "RCHECKSUM";
+ gf_fop_list[GF_FOP_SETATTR] = "SETATTR";
+ gf_fop_list[GF_FOP_FSETATTR] = "FSETATTR";
+ gf_fop_list[GF_FOP_READDIRP] = "READDIRP";
+ gf_fop_list[GF_FOP_GETSPEC] = "GETSPEC";
+ gf_fop_list[GF_FOP_FORGET] = "FORGET";
+ gf_fop_list[GF_FOP_RELEASE] = "RELEASE";
+ gf_fop_list[GF_FOP_RELEASEDIR] = "RELEASEDIR";
+
+ gf_fop_list[GF_MGMT_NULL] = "NULL";
+ return;
+}
+
+
/* CTX */
static glusterfs_ctx_t *glusterfs_ctx;
@@ -48,6 +109,7 @@ glusterfs_ctx_init ()
goto out;
}
+ INIT_LIST_HEAD (&glusterfs_ctx->graphs);
ret = pthread_mutex_init (&glusterfs_ctx->lock, NULL);
out:
@@ -168,7 +230,7 @@ glusterfs_central_log_flag_init ()
{
int ret = 0;
- ret = pthread_key_create (&central_log_flag_key,
+ ret = pthread_key_create (&central_log_flag_key,
glusterfs_central_log_flag_destroy);
if (ret != 0) {
@@ -194,7 +256,7 @@ glusterfs_central_log_flag_get ()
long flag = 0;
flag = (long) pthread_getspecific (central_log_flag_key);
-
+
return flag;
}
@@ -211,6 +273,8 @@ glusterfs_globals_init ()
{
int ret = 0;
+ gf_op_list_init ();
+
ret = glusterfs_ctx_init ();
if (ret)
goto out;