diff options
Diffstat (limited to 'libglusterfs')
-rw-r--r-- | libglusterfs/src/Makefile.am | 7 | ||||
-rw-r--r-- | libglusterfs/src/common-utils.c | 36 | ||||
-rw-r--r-- | libglusterfs/src/common-utils.h | 3 |
3 files changed, 44 insertions, 2 deletions
diff --git a/libglusterfs/src/Makefile.am b/libglusterfs/src/Makefile.am index 768fe042a10..6c81142b826 100644 --- a/libglusterfs/src/Makefile.am +++ b/libglusterfs/src/Makefile.am @@ -38,9 +38,12 @@ libglusterfs_la_SOURCES = dict.c xlator.c logging.c \ compound-fop-utils.c throttle-tbf.c nodist_libglusterfs_la_SOURCES = y.tab.c graph.lex.c defaults.c -nodist_libglusterfs_la_HEADERS = y.tab.h +nodist_libglusterfs_la_HEADERS = y.tab.h protocol-common.h -BUILT_SOURCES = graph.lex.c defaults.c eventtypes.h +BUILT_SOURCES = graph.lex.c defaults.c eventtypes.h protocol-common.h + +protocol-common.h: $(top_srcdir)/rpc/rpc-lib/src/protocol-common.h + cp $(top_srcdir)/rpc/rpc-lib/src/protocol-common.h . libglusterfs_la_HEADERS = common-utils.h defaults.h default-args.h \ dict.h glusterfs.h hashfn.h timespec.h logging.h xlator.h \ diff --git a/libglusterfs/src/common-utils.c b/libglusterfs/src/common-utils.c index e855f04a443..5897aca0b38 100644 --- a/libglusterfs/src/common-utils.c +++ b/libglusterfs/src/common-utils.c @@ -53,6 +53,7 @@ #include "xxhash.h" #include <ifaddrs.h> #include "libglusterfs-messages.h" +#include "protocol-common.h" #ifndef AI_ADDRCONFIG #define AI_ADDRCONFIG 0 @@ -4930,3 +4931,38 @@ glusterfs_compute_sha256 (const unsigned char *content, size_t size, return 0; } + +char* +get_struct_variable (int mem_num, gf_gsync_status_t *sts_val) +{ + switch (mem_num) { + case 0: return (sts_val->node); + case 1: return (sts_val->master); + case 2: return (sts_val->brick); + case 3: return (sts_val->slave_user); + case 4: return (sts_val->slave); + case 5: return (sts_val->slave_node); + case 6: return (sts_val->worker_status); + case 7: return (sts_val->crawl_status); + case 8: return (sts_val->last_synced); + case 9: return (sts_val->entry); + case 10: return (sts_val->data); + case 11: return (sts_val->meta); + case 12: return (sts_val->failures); + case 13: return (sts_val->checkpoint_time); + case 14: return (sts_val->checkpoint_completed); + case 15: return (sts_val->checkpoint_completion_time); + case 16: return (sts_val->brick_host_uuid); + case 17: return (sts_val->last_synced_utc); + case 18: return (sts_val->checkpoint_time_utc); + case 19: return (sts_val->checkpoint_completion_time_utc); + case 20: return (sts_val->slavekey); + case 21: return (sts_val->session_slave); + default: + goto out; + } + +out: + return NULL; +} + diff --git a/libglusterfs/src/common-utils.h b/libglusterfs/src/common-utils.h index 4470bb25f25..eb3a8f3ac77 100644 --- a/libglusterfs/src/common-utils.h +++ b/libglusterfs/src/common-utils.h @@ -44,6 +44,7 @@ void trap (void); #include "iatt.h" #include "uuid.h" #include "libglusterfs-messages.h" +#include "protocol-common.h" #define STRINGIFY(val) #val #define TOSTRING(val) STRINGIFY(val) @@ -939,5 +940,7 @@ gf_getgrouplist (const char *user, gid_t group, gid_t **groups); int glusterfs_compute_sha256 (const unsigned char *content, size_t size, char *sha256_hash); +char* +get_struct_variable (int mem_num, gf_gsync_status_t *sts_val); #endif /* _COMMON_UTILS_H */ |