summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVikas Gorur <vikas@gluster.com>2009-06-09 05:08:58 +0000
committerAnand V. Avati <avati@dev.gluster.com>2009-06-11 07:51:26 -0700
commit1a6989613914cc86a64c3eb21cfddba15ce372d9 (patch)
tree187a17f84131c7909c9fda37822fec6b3c3ee0d7
parent77d8cfeab52cd19f3b70abd9c3a2c4bbc9219bff (diff)
Added MOP log to libglusterfs/*
Signed-off-by: Anand V. Avati <avati@dev.gluster.com>
-rw-r--r--libglusterfs/src/common-utils.c1
-rw-r--r--libglusterfs/src/defaults.c26
-rw-r--r--libglusterfs/src/defaults.h5
-rw-r--r--libglusterfs/src/glusterfs.h1
-rw-r--r--libglusterfs/src/protocol.h8
-rw-r--r--libglusterfs/src/xlator.c1
-rw-r--r--libglusterfs/src/xlator.h10
7 files changed, 52 insertions, 0 deletions
diff --git a/libglusterfs/src/common-utils.c b/libglusterfs/src/common-utils.c
index fb6948d2d..2650e8fb5 100644
--- a/libglusterfs/src/common-utils.c
+++ b/libglusterfs/src/common-utils.c
@@ -218,6 +218,7 @@ gf_global_variable_init()
gf_mop_list[GF_MOP_STATS] = "STATS";
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_cbk_list[GF_CBK_FORGET] = "FORGET";
diff --git a/libglusterfs/src/defaults.c b/libglusterfs/src/defaults.c
index 77451d11c..ba47ecc88 100644
--- a/libglusterfs/src/defaults.c
+++ b/libglusterfs/src/defaults.c
@@ -1344,6 +1344,32 @@ default_getspec (call_frame_t *frame,
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 a61bdff75..33d974520 100644
--- a/libglusterfs/src/defaults.h
+++ b/libglusterfs/src/defaults.h
@@ -42,6 +42,11 @@ 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 a4b8a516f..bf269df4b 100644
--- a/libglusterfs/src/glusterfs.h
+++ b/libglusterfs/src/glusterfs.h
@@ -139,6 +139,7 @@ typedef enum {
GF_MOP_SETSPEC,
GF_MOP_GETSPEC,
GF_MOP_PING,
+ GF_MOP_LOG,
GF_MOP_MAXVALUE /* 5 */
} glusterfs_mop_t;
diff --git a/libglusterfs/src/protocol.h b/libglusterfs/src/protocol.h
index 4bb379b2f..b17f83bcd 100644
--- a/libglusterfs/src/protocol.h
+++ b/libglusterfs/src/protocol.h
@@ -724,6 +724,14 @@ typedef struct {
typedef struct {
+ uint32_t msglen;
+ char msg[0];
+} __attribute__((packed)) gf_mop_log_req_t;
+typedef struct {
+} __attribute__((packed)) gf_mop_log_rsp_t;
+
+
+typedef struct {
uint32_t dict_len;
char buf[0];
} __attribute__((packed)) gf_mop_setvolume_req_t;
diff --git a/libglusterfs/src/xlator.c b/libglusterfs/src/xlator.c
index c20499de2..1bcf2e738 100644
--- a/libglusterfs/src/xlator.c
+++ b/libglusterfs/src/xlator.c
@@ -102,6 +102,7 @@ fill_defaults (xlator_t *xl)
SET_DEFAULT_FOP (lock_notify);
SET_DEFAULT_FOP (lock_fnotify);
+ SET_DEFAULT_MOP (log);
SET_DEFAULT_MOP (stats);
SET_DEFAULT_CBK (release);
diff --git a/libglusterfs/src/xlator.h b/libglusterfs/src/xlator.h
index 2bacc0457..8e0676175 100644
--- a/libglusterfs/src/xlator.h
+++ b/libglusterfs/src/xlator.h
@@ -98,6 +98,10 @@ typedef int32_t (*mop_getspec_cbk_t) (call_frame_t *frame,
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,
@@ -119,6 +123,10 @@ typedef int32_t (*mop_getspec_t) (call_frame_t *frame,
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,
@@ -127,7 +135,9 @@ typedef int32_t (*fop_checksum_t) (call_frame_t *frame,
struct xlator_mops {
mop_stats_t stats;
mop_getspec_t getspec;
+ mop_log_t log;
+ mop_log_cbk_t log_cbk;
mop_stats_cbk_t stats_cbk;
mop_getspec_cbk_t getspec_cbk;
};