summaryrefslogtreecommitdiffstats
path: root/libglusterfs/src
diff options
context:
space:
mode:
authorAmar Tumballi <amar@gluster.com>2010-05-04 00:37:01 +0000
committerAnand V. Avati <avati@dev.gluster.com>2010-05-03 23:40:10 -0700
commit7840d9de272ef2f24c4c755a857ad8ae06703b55 (patch)
tree6d212b7d72f00605b80503508c146b205280208c /libglusterfs/src
parentf75b76350747f5f58a4bbe704915c74979cc5ac3 (diff)
frame's 'op', 'type' restructured
Signed-off-by: Amar Tumballi <amar@gluster.com> Signed-off-by: Anand V. Avati <avati@dev.gluster.com> BUG: 875 (Implement a new protocol to provide proper backward/forward compatibility) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=875
Diffstat (limited to 'libglusterfs/src')
-rw-r--r--libglusterfs/src/Makefile.am4
-rw-r--r--libglusterfs/src/common-utils.c71
-rw-r--r--libglusterfs/src/common-utils.h3
-rw-r--r--libglusterfs/src/defaults.c28
-rw-r--r--libglusterfs/src/defaults.h5
-rw-r--r--libglusterfs/src/glusterfs.h66
-rw-r--r--libglusterfs/src/latency.c16
-rw-r--r--libglusterfs/src/logging.c276
-rw-r--r--libglusterfs/src/spec.y2
-rw-r--r--libglusterfs/src/stack.c14
-rw-r--r--libglusterfs/src/stack.h7
-rw-r--r--libglusterfs/src/xlator.c13
-rw-r--r--libglusterfs/src/xlator.h28
13 files changed, 78 insertions, 455 deletions
diff --git a/libglusterfs/src/Makefile.am b/libglusterfs/src/Makefile.am
index 7cd1876e2eb..acca3f04a01 100644
--- a/libglusterfs/src/Makefile.am
+++ b/libglusterfs/src/Makefile.am
@@ -6,9 +6,9 @@ libglusterfs_la_LIBADD = @LEXLIB@
lib_LTLIBRARIES = libglusterfs.la
-libglusterfs_la_SOURCES = dict.c spec.lex.c y.tab.c xlator.c logging.c hashfn.c defaults.c scheduler.c common-utils.c timer.c inode.c call-stub.c compat.c fd.c compat-errno.c event.c mem-pool.c gf-dirent.c syscall.c iobuf.c globals.c statedump.c stack.c checksum.c md5.c $(CONTRIBDIR)/rbtree/rb.c rbthash.c latency.c
+libglusterfs_la_SOURCES = dict.c spec.lex.c y.tab.c xlator.c logging.c hashfn.c defaults.c common-utils.c timer.c inode.c call-stub.c compat.c fd.c compat-errno.c event.c mem-pool.c gf-dirent.c syscall.c iobuf.c globals.c statedump.c stack.c checksum.c md5.c $(CONTRIBDIR)/rbtree/rb.c rbthash.c latency.c
-noinst_HEADERS = common-utils.h defaults.h dict.h glusterfs.h hashfn.h logging.h scheduler.h xlator.h stack.h timer.h list.h inode.h call-stub.h compat.h fd.h revision.h compat-errno.h event.h mem-pool.h byte-order.h gf-dirent.h locking.h syscall.h iobuf.h globals.h statedump.h checksum.h md5.h $(CONTRIBDIR)/rbtree/rb.h rbthash.h iatt.h latency.h
+noinst_HEADERS = common-utils.h defaults.h dict.h glusterfs.h hashfn.h logging.h xlator.h stack.h timer.h list.h inode.h call-stub.h compat.h fd.h revision.h compat-errno.h event.h mem-pool.h byte-order.h gf-dirent.h locking.h syscall.h iobuf.h globals.h statedump.h checksum.h md5.h $(CONTRIBDIR)/rbtree/rb.h rbthash.h iatt.h latency.h
EXTRA_DIST = spec.l spec.y
diff --git a/libglusterfs/src/common-utils.c b/libglusterfs/src/common-utils.c
index 7851ad2f815..c93dcc41d15 100644
--- a/libglusterfs/src/common-utils.c
+++ b/libglusterfs/src/common-utils.c
@@ -180,28 +180,28 @@ err:
}
char *gf_fop_list[GF_FOP_MAXVALUE];
-char *gf_mop_list[GF_MOP_MAXVALUE];
-char *gf_cbk_list[GF_CBK_MAXVALUE];
+char *gf_mgmt_list[GF_MGMT_MAXVALUE];
void
gf_global_variable_init()
{
- gf_fop_list[GF_FOP_STAT] = "STAT"; /* 0 */
- gf_fop_list[GF_FOP_READLINK] = "READLINK"; /* 1 */
- gf_fop_list[GF_FOP_MKNOD] = "MKNOD"; /* 2 */
+ 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"; /* 5 */
+ 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"; /* 10 */
+ 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"; /* 15 */
+ 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";
@@ -210,15 +210,15 @@ gf_global_variable_init()
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"; /* 25 */
+ 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"; /* 30 */
+ 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"; /* 35 */
- gf_fop_list[GF_FOP_CHECKSUM] = "CHECKSUM"; /* 36 */
+ 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";
@@ -227,17 +227,13 @@ gf_global_variable_init()
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_mop_list[GF_MOP_SETVOLUME] = "SETVOLUME"; /* 0 */
- gf_mop_list[GF_MOP_GETVOLUME] = "GETVOLUME"; /* 1 */
- gf_mop_list[GF_MOP_SETSPEC] = "SETSPEC";
- gf_mop_list[GF_MOP_GETSPEC] = "GETSPEC";
- gf_mop_list[GF_MOP_LOG] = "LOG";
- gf_mop_list[GF_MOP_PING] = "PING";
+ gf_fop_list[GF_MGMT_NULL] = "NULL";
- gf_cbk_list[GF_CBK_FORGET] = "FORGET";
- gf_cbk_list[GF_CBK_RELEASE] = "RELEASE";
- gf_cbk_list[GF_CBK_RELEASEDIR] = "RELEASEDIR";
/* Are there any more variables to be included? All global
variables initialization should go here */
@@ -250,7 +246,7 @@ set_global_ctx_ptr (glusterfs_ctx_t *ctx)
gf_global_ctx = ctx;
}
-/*
+/*
* Don't use this function other than in glusterfsd.c. libglusterfsclient does
* not set gf_global_ctx since there can be multiple glusterfs-contexts
* initialized in a single process. Instead access the context from ctx member
@@ -263,7 +259,7 @@ get_global_ctx_ptr (void)
return gf_global_ctx;
}
-void
+void
gf_log_volume_file (FILE *specfp)
{
extern FILE *gf_log_logfile;
@@ -406,40 +402,33 @@ gf_print_trace (int32_t signum)
struct list_head *trav = ((call_pool_t *)ctx->pool)->all_frames.next;
while (trav != (&((call_pool_t *)ctx->pool)->all_frames)) {
call_frame_t *tmp = (call_frame_t *)(&((call_stack_t *)trav)->frames);
- if ((tmp->root->type == GF_OP_TYPE_FOP_REQUEST) ||
- (tmp->root->type == GF_OP_TYPE_FOP_REPLY))
+ if (tmp->root->type == GF_OP_TYPE_FOP)
sprintf (msg,"frame : type(%d) op(%s)\n",
- tmp->root->type,
+ tmp->root->type,
gf_fop_list[tmp->root->op]);
- if ((tmp->root->type == GF_OP_TYPE_MOP_REQUEST) ||
- (tmp->root->type == GF_OP_TYPE_MOP_REPLY))
- sprintf (msg,"frame : type(%d) op(%s)\n",
- tmp->root->type,
- gf_mop_list[tmp->root->op]);
- if ((tmp->root->type == GF_OP_TYPE_CBK_REQUEST) ||
- (tmp->root->type == GF_OP_TYPE_CBK_REPLY))
+ if (tmp->root->type == GF_OP_TYPE_MGMT)
sprintf (msg,"frame : type(%d) op(%s)\n",
- tmp->root->type,
- gf_cbk_list[tmp->root->op]);
-
+ tmp->root->type,
+ gf_mgmt_list[tmp->root->op]);
+
ret = write (fd, msg, strlen (msg));
trav = trav->next;
}
ret = write (fd, "\n", 1);
}
- sprintf (msg, "patchset: %s\n", GLUSTERFS_REPOSITORY_REVISION);
+ sprintf (msg, "patchset: %s\n", GLUSTERFS_REPOSITORY_REVISION);
ret = write (fd, msg, strlen (msg));
- sprintf (msg, "signal received: %d\n", signum);
+ sprintf (msg, "signal received: %d\n", signum);
ret = write (fd, msg, strlen (msg));
{
- /* Dump the timestamp of the crash too, so the previous logs
+ /* Dump the timestamp of the crash too, so the previous logs
can be related */
utime = time (NULL);
tm = localtime (&utime);
- strftime (timestr, 256, "%Y-%m-%d %H:%M:%S\n", tm);
+ strftime (timestr, 256, "%Y-%m-%d %H:%M:%S\n", tm);
ret = write (fd, "time of crash: ", 15);
ret = write (fd, timestr, strlen (timestr));
}
@@ -450,7 +439,7 @@ gf_print_trace (int32_t signum)
{
void *array[200];
size_t size;
-
+
size = backtrace (array, 200);
backtrace_symbols_fd (&array[1], size-1, fd);
sprintf (msg, "---------\n");
diff --git a/libglusterfs/src/common-utils.h b/libglusterfs/src/common-utils.h
index 3bf4ba9b180..06933d7c45a 100644
--- a/libglusterfs/src/common-utils.h
+++ b/libglusterfs/src/common-utils.h
@@ -91,8 +91,7 @@ void gf_log_volume_file (FILE *specfp);
void gf_print_trace (int32_t signal);
extern char *gf_fop_list[GF_FOP_MAXVALUE];
-extern char *gf_mop_list[GF_MOP_MAXVALUE];
-extern char *gf_cbk_list[GF_CBK_MAXVALUE];
+extern char *gf_mgmt_list[GF_MGMT_MAXVALUE];
#define VECTORSIZE(count) (count * (sizeof (struct iovec)))
diff --git a/libglusterfs/src/defaults.c b/libglusterfs/src/defaults.c
index 7ec877551bf..7da589d60fa 100644
--- a/libglusterfs/src/defaults.c
+++ b/libglusterfs/src/defaults.c
@@ -1124,39 +1124,13 @@ default_getspec (call_frame_t *frame,
STACK_WIND (frame,
default_getspec_cbk,
FIRST_CHILD(this),
- FIRST_CHILD(this)->mops->getspec,
+ FIRST_CHILD(this)->fops->getspec,
key, flags);
return 0;
}
static int32_t
-default_log_cbk (call_frame_t *frame,
- void *cookie,
- xlator_t *this,
- int32_t op_ret,
- int32_t op_errno)
-{
- STACK_UNWIND (frame, op_ret, op_errno);
- return 0;
-}
-
-
-int32_t
-default_log (call_frame_t *frame,
- xlator_t *this,
- const char *msg)
-{
- STACK_WIND (frame,
- default_log_cbk,
- FIRST_CHILD(this),
- FIRST_CHILD(this)->mops->log,
- msg);
- return 0;
-}
-
-
-static int32_t
default_checksum_cbk (call_frame_t *frame,
void *cookie,
xlator_t *this,
diff --git a/libglusterfs/src/defaults.h b/libglusterfs/src/defaults.h
index 30e0f9e371a..2955bd8eb78 100644
--- a/libglusterfs/src/defaults.h
+++ b/libglusterfs/src/defaults.h
@@ -38,11 +38,6 @@ int32_t default_getspec (call_frame_t *frame,
const char *key,
int32_t flag);
-int32_t
-default_log (call_frame_t *frame,
- xlator_t *this,
- const char *msg);
-
int32_t default_checksum (call_frame_t *frame,
xlator_t *this,
loc_t *loc,
diff --git a/libglusterfs/src/glusterfs.h b/libglusterfs/src/glusterfs.h
index 5906b71edbe..226c358e50c 100644
--- a/libglusterfs/src/glusterfs.h
+++ b/libglusterfs/src/glusterfs.h
@@ -75,87 +75,71 @@
ZR_FILE_CONTENT_STRLEN))
/* TODO: Should we use PATH-MAX? On some systems it may save space */
-#define ZR_PATH_MAX 4096
-
+#define ZR_PATH_MAX 4096
/* NOTE: add members ONLY at the end (just before _MAXVALUE) */
typedef enum {
- GF_FOP_STAT, /* 0 */
- GF_FOP_READLINK, /* 1 */
- GF_FOP_MKNOD, /* 2 */
+ GF_FOP_NULL = 0,
+ GF_FOP_STAT,
+ GF_FOP_READLINK,
+ GF_FOP_MKNOD,
GF_FOP_MKDIR,
GF_FOP_UNLINK,
- GF_FOP_RMDIR, /* 5 */
+ GF_FOP_RMDIR,
GF_FOP_SYMLINK,
GF_FOP_RENAME,
GF_FOP_LINK,
GF_FOP_TRUNCATE,
- GF_FOP_OPEN, /* 10 */
+ GF_FOP_OPEN,
GF_FOP_READ,
GF_FOP_WRITE,
- GF_FOP_STATFS, /* 15 */
+ GF_FOP_STATFS,
GF_FOP_FLUSH,
GF_FOP_FSYNC,
GF_FOP_SETXATTR,
GF_FOP_GETXATTR,
- GF_FOP_REMOVEXATTR,/* 20 */
+ GF_FOP_REMOVEXATTR,
GF_FOP_OPENDIR,
- GF_FOP_GETDENTS,
GF_FOP_FSYNCDIR,
GF_FOP_ACCESS,
- GF_FOP_CREATE, /* 25 */
+ GF_FOP_CREATE,
GF_FOP_FTRUNCATE,
GF_FOP_FSTAT,
GF_FOP_LK,
GF_FOP_LOOKUP,
- GF_FOP_SETDENTS,
GF_FOP_READDIR,
- GF_FOP_INODELK, /* 35 */
+ GF_FOP_INODELK,
GF_FOP_FINODELK,
GF_FOP_ENTRYLK,
GF_FOP_FENTRYLK,
GF_FOP_CHECKSUM,
- GF_FOP_XATTROP, /* 40 */
+ GF_FOP_XATTROP,
GF_FOP_FXATTROP,
- GF_FOP_LOCK_NOTIFY,
- GF_FOP_LOCK_FNOTIFY,
GF_FOP_FGETXATTR,
- GF_FOP_FSETXATTR, /* 45 */
+ GF_FOP_FSETXATTR,
GF_FOP_RCHECKSUM,
GF_FOP_SETATTR,
GF_FOP_FSETATTR,
GF_FOP_READDIRP,
+ GF_FOP_FORGET,
+ GF_FOP_RELEASE,
+ GF_FOP_RELEASEDIR,
+ GF_FOP_GETSPEC,
GF_FOP_MAXVALUE,
} glusterfs_fop_t;
-/* NOTE: add members ONLY at the end (just before _MAXVALUE) */
-typedef enum {
- GF_MOP_SETVOLUME, /* 0 */
- GF_MOP_GETVOLUME, /* 1 */
- GF_MOP_STATS,
- GF_MOP_SETSPEC,
- GF_MOP_GETSPEC,
- GF_MOP_PING, /* 5 */
- GF_MOP_LOG,
- GF_MOP_NOTIFY,
- GF_MOP_MAXVALUE /* 8 */
-} glusterfs_mop_t;
typedef enum {
- GF_CBK_FORGET, /* 0 */
- GF_CBK_RELEASE, /* 1 */
- GF_CBK_RELEASEDIR, /* 2 */
- GF_CBK_MAXVALUE /* 3 */
-} glusterfs_cbk_t;
+ GF_MGMT_NULL = 0,
+ GF_MGMT_MAXVALUE,
+} glusterfs_mgmt_t;
typedef enum {
- GF_OP_TYPE_FOP_REQUEST = 1,
- GF_OP_TYPE_MOP_REQUEST,
- GF_OP_TYPE_CBK_REQUEST,
- GF_OP_TYPE_FOP_REPLY,
- GF_OP_TYPE_MOP_REPLY,
- GF_OP_TYPE_CBK_REPLY
-} glusterfs_op_type_t;
+ GF_OP_TYPE_NULL = 0,
+ GF_OP_TYPE_FOP,
+ GF_OP_TYPE_MGMT,
+ GF_OP_TYPE_MAX,
+} gf_op_type_t;
/* NOTE: all the miscellaneous flags used by GlusterFS should be listed here */
typedef enum {
diff --git a/libglusterfs/src/latency.c b/libglusterfs/src/latency.c
index bccc780a26f..5156e8e2551 100644
--- a/libglusterfs/src/latency.c
+++ b/libglusterfs/src/latency.c
@@ -31,8 +31,7 @@
void
-gf_set_fop_from_fn_pointer (call_frame_t *frame, struct xlator_fops *fops,
- struct xlator_mops *mops, void *fn)
+gf_set_fop_from_fn_pointer (call_frame_t *frame, struct xlator_fops *fops, void *fn)
{
glusterfs_fop_t fop = -1;
@@ -118,15 +117,10 @@ gf_set_fop_from_fn_pointer (call_frame_t *frame, struct xlator_fops *fops,
fop = GF_FOP_FSETATTR;
else if (fops->readdirp == fn)
fop = GF_FOP_READDIRP;
- else {
- if (mops->getspec == fn)
- fop = GF_MOP_GETSPEC;
- else if (mops->log == fn)
- fop = GF_MOP_LOG;
- else {
- fop = -1;
- }
- }
+ else if (fops->getspec == fn)
+ fop = GF_FOP_GETSPEC;
+ else
+ fop = -1;
frame->op = fop;
}
diff --git a/libglusterfs/src/logging.c b/libglusterfs/src/logging.c
index a8a7d4dc933..7fbcacb4e44 100644
--- a/libglusterfs/src/logging.c
+++ b/libglusterfs/src/logging.c
@@ -105,298 +105,24 @@ gf_log_init (const char *file)
}
-static int
-dummy_init (xlator_t *xl)
-{
- return 0;
-}
-
-
-static int
-gf_log_notify (xlator_t *this_xl, int event, void *data, ...)
-{
- int ret = 0;
-
- switch (event) {
- case GF_EVENT_CHILD_UP:
- break;
-
- case GF_EVENT_CHILD_DOWN:
- break;
-
- default:
- ret = default_notify (this_xl, event, data);
- break;
- }
-
- return ret;
-}
-
-
-/*
- * Get a dummy xlator for the purpose of central logging.
- * An xlator is needed because a transport cannot exist without
- * an xlator.
- */
-
-static xlator_t *
-__get_dummy_xlator (glusterfs_ctx_t *ctx, const char *remote_host,
- const char *transport, uint32_t remote_port)
-{
- volume_opt_list_t *vol_opt = NULL;
- xlator_t * trav = NULL;
-
- int ret = 0;
-
- xlator_t * top = NULL;
- xlator_t * trans = NULL;
- xlator_list_t * parent = NULL;
- xlator_list_t * tmp = NULL;
-
- top = GF_CALLOC (1, sizeof (*top), gf_common_mt_xlator_t);
- if (!top)
- goto out;
-
- trans = GF_CALLOC (1, sizeof (*trans), gf_common_mt_xlator_t);
- if (!trans)
- goto out;
-
- INIT_LIST_HEAD (&top->volume_options);
- INIT_LIST_HEAD (&trans->volume_options);
-
- top->name = "log-dummy";
- top->ctx = ctx;
- top->next = trans;
- top->init = dummy_init;
- top->notify = gf_log_notify;
- top->children = (void *) GF_CALLOC (1, sizeof (*top->children),
- gf_common_mt_xlator_list_t);
-
- if (!top->children)
- goto out;
-
- top->children->xlator = trans;
-
- trans->name = "log-transport";
- trans->ctx = ctx;
- trans->prev = top;
- trans->init = dummy_init;
- trans->notify = default_notify;
- trans->options = get_new_dict ();
-
- parent = GF_CALLOC (1, sizeof(*parent), gf_common_mt_xlator_list_t);
-
- if (!parent)
- goto out;
-
- parent->xlator = top;
-
- if (trans->parents == NULL)
- trans->parents = parent;
- else {
- tmp = trans->parents;
- while (tmp->next)
- tmp = tmp->next;
- tmp->next = parent;
- }
-
- /* TODO: log on failure to set dict */
- if (remote_host) {
- ret = dict_set (trans->options, "remote-host",
- str_to_data ((char *)remote_host));
- }
-
- if (remote_port)
- ret = dict_set_uint32 (trans->options, "remote-port",
- remote_port);
-
- /*
- * 'option remote-subvolume <x>' is needed here even though
- * its not used
- */
- ret = dict_set_static_ptr (trans->options, "remote-subvolume",
- "brick");
- ret = dict_set_static_ptr (trans->options, "disable-handshake", "on");
- ret = dict_set_static_ptr (trans->options, "non-blocking-io", "off");
-
- if (transport) {
- char *transport_type = GF_CALLOC (1, strlen (transport) + 10,
- gf_common_mt_char);
- ERR_ABORT (transport_type);
- strcpy(transport_type, transport);
-
- if (strchr (transport_type, ':'))
- *(strchr (transport_type, ':')) = '\0';
-
- ret = dict_set_dynstr (trans->options, "transport-type",
- transport_type);
- }
-
- xlator_set_type (trans, "protocol/client");
-
- trav = top;
- while (trav) {
- /* Get the first volume_option */
- if (!list_empty (&trav->volume_options)) {
- list_for_each_entry (vol_opt,
- &trav->volume_options, list)
- break;
- if ((ret =
- validate_xlator_volume_options (trav,
- vol_opt->given_opt)) < 0) {
- gf_log (trav->name, GF_LOG_ERROR,
- "validating translator failed");
- return NULL;
- }
- }
- trav = trav->next;
- }
-
- if (xlator_tree_init (top) != 0)
- return NULL;
-
-out:
- return top;
-}
-
-
/*
* Initialize logging to a central server.
* If successful, log messages will be written both to
* the local file and to the remote server.
*/
-static xlator_t * logging_xl = NULL;
static int __central_log_enabled = 0;
-static pthread_t logging_thread;
-
struct _msg_queue {
struct list_head msgs;
};
-static struct _msg_queue msg_queue;
-
-static pthread_cond_t msg_cond;
-static pthread_mutex_t msg_cond_mutex;
-static pthread_mutex_t msg_queue_mutex;
-
struct _log_msg {
const char *msg;
struct list_head queue;
};
-int32_t
-gf_log_central_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
- int32_t op_ret, int32_t op_errno)
-{
- struct _log_msg *msg = NULL;
-
- msg = (struct _log_msg *) cookie;
-
- GF_FREE ((char *)(msg->msg));
-
- STACK_DESTROY (frame->root);
-
- return 0;
-}
-
-
-void *
-logging_thread_loop (void *arg)
-{
- struct _log_msg *msg;
-
- call_frame_t *frame = NULL;
-
- while (1) {
- pthread_mutex_lock (&msg_cond_mutex);
- {
- pthread_cond_wait (&msg_cond, &msg_cond_mutex);
-
- while (!list_empty (&msg_queue.msgs)) {
- pthread_mutex_lock (&msg_queue_mutex);
- {
- msg = list_entry (msg_queue.msgs.next,
- struct _log_msg,
- queue);
-
- list_del_init (&msg->queue);
- }
- pthread_mutex_unlock (&msg_queue_mutex);
-
- frame = create_frame (logging_xl,
- logging_xl->ctx->pool);
-
- frame->local = logging_xl->private;
-
- STACK_WIND_COOKIE (frame, (void *) msg,
- gf_log_central_cbk,
- logging_xl->children->xlator,
- logging_xl->children->xlator->mops->log,
- msg->msg);
- }
-
- }
- pthread_mutex_unlock (&msg_cond_mutex);
- }
-
- return NULL;
-}
-
-
-int
-gf_log_central_init (glusterfs_ctx_t *ctx, const char *remote_host,
- const char *transport, uint32_t remote_port)
-{
- logging_xl = __get_dummy_xlator (ctx, remote_host, transport,
- remote_port);
-
- if (!logging_xl) {
- goto out;
- }
-
- __central_log_enabled = 1;
-
- INIT_LIST_HEAD (&msg_queue.msgs);
-
- pthread_cond_init (&msg_cond, NULL);
- pthread_mutex_init (&msg_cond_mutex, NULL);
- pthread_mutex_init (&msg_queue_mutex, NULL);
-
- pthread_create (&logging_thread, NULL, logging_thread_loop, NULL);
-
-out:
- return 0;
-}
-
-
-int
-gf_log_central (const char *msg)
-{
- struct _log_msg *lm = NULL;
-
- lm = GF_CALLOC (1, sizeof (*lm), gf_common_mt_log_msg);
-
- if (!lm)
- goto out;
-
- INIT_LIST_HEAD (&lm->queue);
-
- lm->msg = gf_strdup (msg);
-
- pthread_mutex_lock (&msg_queue_mutex);
- {
- list_add_tail (&lm->queue, &msg_queue.msgs);
- }
- pthread_mutex_unlock (&msg_queue_mutex);
-
- pthread_cond_signal (&msg_cond);
-
-out:
- return 0;
-}
void
@@ -526,7 +252,7 @@ unlock:
glusterfs_central_log_flag_set ();
{
- gf_log_central (msg);
+ //gf_log_central (msg);
}
glusterfs_central_log_flag_unset ();
}
diff --git a/libglusterfs/src/spec.y b/libglusterfs/src/spec.y
index 84ab4df855a..805e1e1fbae 100644
--- a/libglusterfs/src/spec.y
+++ b/libglusterfs/src/spec.y
@@ -330,7 +330,7 @@ section_sub (char *sub)
static int
section_end (void)
{
- if (!tree->fops || !tree->mops) {
+ if (!tree->fops) {
fprintf (stderr,
"\"type\" not specified for volume %s\n", tree->name);
gf_log ("parser", GF_LOG_ERROR,
diff --git a/libglusterfs/src/stack.c b/libglusterfs/src/stack.c
index 4b0f936d0f3..0723557b36d 100644
--- a/libglusterfs/src/stack.c
+++ b/libglusterfs/src/stack.c
@@ -110,17 +110,11 @@ gf_proc_dump_call_stack (call_stack_t *call_stack, const char *key_buf,...)
gf_proc_dump_write(key, "%Ld", call_stack->unique);
gf_proc_dump_build_key(key, prefix,"op");
- if ((call_stack->type == GF_OP_TYPE_FOP_REQUEST) ||
- (call_stack->type == GF_OP_TYPE_FOP_REPLY)) {
+ if (call_stack->type == GF_OP_TYPE_FOP)
gf_proc_dump_write(key, "%s", gf_fop_list[call_stack->op]);
- } else if ((call_stack->type == GF_OP_TYPE_MOP_REQUEST) ||
- (call_stack->type == GF_OP_TYPE_MOP_REPLY)) {
- gf_proc_dump_write(key, "%s", gf_mop_list[call_stack->op]);
- } else if ((call_stack->type == GF_OP_TYPE_CBK_REQUEST) ||
- (call_stack->type == GF_OP_TYPE_CBK_REPLY)) {
- gf_proc_dump_write(key, "%s", gf_cbk_list[call_stack->op]);
- }
-
+ else if (call_stack->type == GF_OP_TYPE_MGMT)
+ gf_proc_dump_write(key, "%s", gf_mgmt_list[call_stack->op]);
+
gf_proc_dump_build_key(key, prefix,"type");
gf_proc_dump_write(key, "%d", call_stack->type);
gf_proc_dump_build_key(key, prefix,"cnt");
diff --git a/libglusterfs/src/stack.h b/libglusterfs/src/stack.h
index c80ab9e9d32..48b5587ac4f 100644
--- a/libglusterfs/src/stack.h
+++ b/libglusterfs/src/stack.h
@@ -118,11 +118,10 @@ struct _call_stack_t {
} while (0); \
struct xlator_fops;
-struct xlator_mops;
void
gf_set_fop_from_fn_pointer (call_frame_t *frame, struct xlator_fops *fops,
- struct xlator_mops *mops, void *fn);
+ void *fn);
void
gf_update_latency (call_frame_t *frame);
@@ -202,7 +201,7 @@ STACK_DESTROY (call_stack_t *stack)
\
if (((xlator_t *) obj)->ctx->measure_latency) { \
gettimeofday (&_new->begin, NULL); \
- gf_set_fop_from_fn_pointer (_new, ((xlator_t *)obj)->fops, ((xlator_t *)obj)->mops, fn); \
+ gf_set_fop_from_fn_pointer (_new, ((xlator_t *)obj)->fops, fn); \
} \
\
old_THIS = THIS; \
@@ -238,7 +237,7 @@ STACK_DESTROY (call_stack_t *stack)
\
if (((xlator_t *) obj)->ctx->measure_latency) { \
gettimeofday (&_new->begin, NULL); \
- gf_set_fop_from_fn_pointer (_new, ((xlator_t *)obj)->fops, ((xlator_t *)obj)->mops, fn); \
+ gf_set_fop_from_fn_pointer (_new, ((xlator_t *)obj)->fops, fn); \
} \
\
old_THIS = THIS; \
diff --git a/libglusterfs/src/xlator.c b/libglusterfs/src/xlator.c
index 6d27a01405d..2168beb91ae 100644
--- a/libglusterfs/src/xlator.c
+++ b/libglusterfs/src/xlator.c
@@ -34,11 +34,6 @@
xl->fops->fn = default_##fn; \
} while (0)
-#define SET_DEFAULT_MOP(fn) do { \
- if (!xl->mops->fn) \
- xl->mops->fn = default_##fn; \
- } while (0)
-
#define SET_DEFAULT_CBK(fn) do { \
if (!xl->cbks->fn) \
xl->cbks->fn = default_##fn; \
@@ -97,7 +92,7 @@ fill_defaults (xlator_t *xl)
SET_DEFAULT_FOP (setattr);
SET_DEFAULT_FOP (fsetattr);
- SET_DEFAULT_MOP (log);
+ SET_DEFAULT_FOP (getspec);
SET_DEFAULT_CBK (release);
SET_DEFAULT_CBK (releasedir);
@@ -710,12 +705,6 @@ xlator_set_type (xlator_t *xl,
return -1;
}
- if (!(xl->mops = dlsym (handle, "mops"))) {
- gf_log ("xlator", GF_LOG_DEBUG, "dlsym(mops) on %s",
- dlerror ());
- return -1;
- }
-
if (!(xl->cbks = dlsym (handle, "cbks"))) {
gf_log ("xlator", GF_LOG_DEBUG, "dlsym(cbks) on %s",
dlerror ());
diff --git a/libglusterfs/src/xlator.h b/libglusterfs/src/xlator.h
index 3bee959f890..8217101e2ab 100644
--- a/libglusterfs/src/xlator.h
+++ b/libglusterfs/src/xlator.h
@@ -85,17 +85,13 @@ struct _loc {
inode_t *parent;
};
-typedef int32_t (*mop_getspec_cbk_t) (call_frame_t *frame,
+typedef int32_t (*fop_getspec_cbk_t) (call_frame_t *frame,
void *cookie,
xlator_t *this,
int32_t op_ret,
int32_t op_errno,
char *spec_data);
-typedef int32_t (*mop_log_cbk_t) (call_frame_t *frame,
- void *cookie, xlator_t *this,
- int32_t op_ret, int32_t op_errno);
-
typedef int32_t (*fop_checksum_cbk_t) (call_frame_t *frame,
void *cookie,
xlator_t *this,
@@ -112,20 +108,11 @@ typedef int32_t (*fop_rchecksum_cbk_t) (call_frame_t *frame,
uint32_t weak_checksum,
uint8_t *strong_checksum);
-typedef int32_t (*mop_setvolume_t) (call_frame_t *frame,
- xlator_t *this,
- const char *volume);
-
-typedef int32_t (*mop_getspec_t) (call_frame_t *frame,
+typedef int32_t (*fop_getspec_t) (call_frame_t *frame,
xlator_t *this,
const char *key,
int32_t flag);
-
-typedef int32_t (*mop_log_t) (call_frame_t *frame,
- xlator_t *this,
- const char *msg);
-
typedef int32_t (*fop_checksum_t) (call_frame_t *frame,
xlator_t *this,
loc_t *loc,
@@ -136,14 +123,6 @@ typedef int32_t (*fop_rchecksum_t) (call_frame_t *frame,
fd_t *fd, off_t offset,
int32_t len);
-struct xlator_mops {
- mop_getspec_t getspec;
- mop_log_t log;
-
- mop_log_cbk_t log_cbk;
- mop_getspec_cbk_t getspec_cbk;
-};
-
typedef int32_t (*fop_lookup_cbk_t) (call_frame_t *frame,
void *cookie,
@@ -709,6 +688,7 @@ struct xlator_fops {
fop_fxattrop_t fxattrop;
fop_setattr_t setattr;
fop_fsetattr_t fsetattr;
+ fop_getspec_t getspec;
/* these entries are used for a typechecking hack in STACK_WIND _only_ */
fop_lookup_cbk_t lookup_cbk;
@@ -752,6 +732,7 @@ struct xlator_fops {
fop_fxattrop_cbk_t fxattrop_cbk;
fop_setattr_cbk_t setattr_cbk;
fop_fsetattr_cbk_t fsetattr_cbk;
+ fop_getspec_cbk_t getspec_cbk;
};
typedef int32_t (*cbk_forget_t) (xlator_t *this,
@@ -839,7 +820,6 @@ struct _xlator {
/* Set after doing dlopen() */
struct xlator_fops *fops;
- struct xlator_mops *mops;
struct xlator_cbks *cbks;
struct xlator_dumpops *dumpops;
struct list_head volume_options; /* list of volume_option_t */