diff options
Diffstat (limited to 'libglusterfs/src')
-rw-r--r-- | libglusterfs/src/Makefile.am | 10 | ||||
-rw-r--r-- | libglusterfs/src/client_t.c | 14 | ||||
-rw-r--r-- | libglusterfs/src/common-utils.c | 68 | ||||
-rw-r--r-- | libglusterfs/src/glusterfs/client_t.h | 21 | ||||
-rw-r--r-- | libglusterfs/src/glusterfs/common-utils.h | 5 | ||||
-rw-r--r-- | libglusterfs/src/libglusterfs.sym | 2 |
6 files changed, 24 insertions, 96 deletions
diff --git a/libglusterfs/src/Makefile.am b/libglusterfs/src/Makefile.am index 12fdc8e64b0..df4c4678a6e 100644 --- a/libglusterfs/src/Makefile.am +++ b/libglusterfs/src/Makefile.am @@ -7,8 +7,7 @@ libglusterfs_la_CPPFLAGS = $(GF_CPPFLAGS) -D__USE_FILE_OFFSET64 \ -DXLATORDIR=\"$(libdir)/glusterfs/$(PACKAGE_VERSION)/xlator\" \ -DXLATORPARENTDIR=\"$(libdir)/glusterfs/$(PACKAGE_VERSION)\" \ -DXXH_NAMESPACE=GF_ -D__USE_LARGEFILE64 \ - -I$(top_srcdir)/rpc/xdr/src/ -I$(top_builddir)/rpc/xdr/src/ \ - -I$(top_srcdir)/rpc/rpc-lib/src/ -I$(CONTRIBDIR)/rbtree \ + -I$(CONTRIBDIR)/rbtree \ -I$(CONTRIBDIR)/libexecinfo ${ARGP_STANDALONE_CPPFLAGS} \ -DSBIN_DIR=\"$(sbindir)\" -I$(CONTRIBDIR)/timer-wheel \ -I$(CONTRIBDIR)/xxhash @@ -40,12 +39,9 @@ libglusterfs_la_SOURCES = dict.c xlator.c logging.c \ throttle-tbf.c monitoring.c async.c nodist_libglusterfs_la_SOURCES = y.tab.c graph.lex.c defaults.c -nodist_libglusterfs_la_HEADERS = y.tab.h protocol-common.h +nodist_libglusterfs_la_HEADERS = y.tab.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 . +BUILT_SOURCES = graph.lex.c defaults.c eventtypes.h libglusterfs_la_HEADERS = glusterfs/common-utils.h glusterfs/defaults.h \ glusterfs/default-args.h glusterfs/dict.h glusterfs/glusterfs.h \ diff --git a/libglusterfs/src/client_t.c b/libglusterfs/src/client_t.c index e875c8b6b69..871fea6413c 100644 --- a/libglusterfs/src/client_t.c +++ b/libglusterfs/src/client_t.c @@ -13,7 +13,6 @@ #include "glusterfs/statedump.h" #include "glusterfs/client_t.h" #include "glusterfs/list.h" -#include "rpcsvc.h" #include "glusterfs/libglusterfs-messages.h" static int @@ -153,7 +152,7 @@ gf_client_clienttable_destroy(clienttable_t *clienttable) * as long as ref.bind is > 0 client should be alive. */ client_t * -gf_client_get(xlator_t *this, struct rpcsvc_auth_data *cred, char *client_uid, +gf_client_get(xlator_t *this, client_auth_data_t *cred, char *client_uid, char *subdir_mount) { client_t *client = NULL; @@ -181,11 +180,10 @@ gf_client_get(xlator_t *this, struct rpcsvc_auth_data *cred, char *client_uid, * if auth was used, matching auth flavour and data */ if (strcmp(client_uid, client->client_uid) == 0 && - (cred->flavour != AUTH_NONE && - (cred->flavour == client->auth.flavour && - (size_t)cred->datalen == client->auth.len && - memcmp(cred->authdata, client->auth.data, client->auth.len) == - 0))) { + (cred->flavour && (cred->flavour == client->auth.flavour && + (size_t)cred->datalen == client->auth.len && + memcmp(cred->authdata, client->auth.data, + client->auth.len) == 0))) { GF_ATOMIC_INC(client->bind); goto unlock; } @@ -227,7 +225,7 @@ gf_client_get(xlator_t *this, struct rpcsvc_auth_data *cred, char *client_uid, GF_ATOMIC_INIT(client->fd_cnt, 0); client->auth.flavour = cred->flavour; - if (cred->flavour != AUTH_NONE) { + if (cred->flavour) { client->auth.data = GF_MALLOC(cred->datalen, gf_common_mt_client_t); if (client->auth.data == NULL) { GF_FREE(client->scratch_ctx.ctx); diff --git a/libglusterfs/src/common-utils.c b/libglusterfs/src/common-utils.c index df30507e3ae..360bc222c7e 100644 --- a/libglusterfs/src/common-utils.c +++ b/libglusterfs/src/common-utils.c @@ -45,13 +45,11 @@ #include "glusterfs/stack.h" #include "glusterfs/lkowner.h" #include "glusterfs/syscall.h" -#include "cli1-xdr.h" #include "glusterfs/globals.h" #define XXH_INLINE_ALL #include "xxhash.h" #include <ifaddrs.h> #include "glusterfs/libglusterfs-messages.h" -#include "protocol-common.h" #ifdef __FreeBSD__ #include <pthread_np.h> #undef BIT_SET @@ -2985,16 +2983,6 @@ out: } int -get_vol_type(int type, int dist_count, int brick_count) -{ - if ((type != GF_CLUSTER_TYPE_TIER) && (type > 0) && - (dist_count < brick_count)) - type = type + GF_CLUSTER_TYPE_MAX - 1; - - return type; -} - -int validate_brick_name(char *brick) { char *delimiter = NULL; @@ -5253,62 +5241,6 @@ 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; -} - /* * Safe wrapper function for strncpy. * This wrapper makes sure that when there is no null byte among the first n in * source srting for strncpy function call, the string placed in dest will be diff --git a/libglusterfs/src/glusterfs/client_t.h b/libglusterfs/src/glusterfs/client_t.h index 8ef3665a9c2..6bc03271eed 100644 --- a/libglusterfs/src/glusterfs/client_t.h +++ b/libglusterfs/src/glusterfs/client_t.h @@ -15,6 +15,17 @@ #include "glusterfs/locking.h" /* for gf_lock_t, not included by glusterfs.h */ #include "glusterfs/atomic.h" /* for gf_atomic_t */ +/* auth_data structure is required by RPC layer. But as it is also used in + * client_t structure validation, comparision, it is critical that it is defined + * in the larger scope of libglusterfs, instead of libgfrpc. With this change, + * even RPC will use this structure */ +#define GF_CLIENTT_AUTH_BYTES 400 +typedef struct client_auth_data { + int flavour; + int datalen; + char authdata[GF_CLIENTT_AUTH_BYTES]; +} client_auth_data_t; + struct client_ctx { void *ctx_key; void *ctx_value; @@ -78,12 +89,6 @@ typedef struct clienttable clienttable_t; */ #define GF_CLIENTENTRY_ALLOCATED -2 -struct rpcsvc_auth_data; - -client_t * -gf_client_get(xlator_t *this, struct rpcsvc_auth_data *cred, char *client_uid, - char *subdir_mount); - void gf_client_put(client_t *client, gf_boolean_t *detached); @@ -138,4 +143,8 @@ gf_client_dump_inodes(xlator_t *this); int gf_client_disconnect(client_t *client); +client_t * +gf_client_get(xlator_t *this, client_auth_data_t *cred, char *client_uid, + char *subdir_mount); + #endif /* _CLIENT_T_H */ diff --git a/libglusterfs/src/glusterfs/common-utils.h b/libglusterfs/src/glusterfs/common-utils.h index b184031e565..a11c3a5f458 100644 --- a/libglusterfs/src/glusterfs/common-utils.h +++ b/libglusterfs/src/glusterfs/common-utils.h @@ -42,7 +42,6 @@ trap(void); #include "glusterfs/compat-uuid.h" #include "glusterfs/iatt.h" #include "glusterfs/libglusterfs-messages.h" -#include "protocol-common.h" #define STRINGIFY(val) #val #define TOSTRING(val) STRINGIFY(val) @@ -994,8 +993,6 @@ gf_is_str_int(const char *value); char *gf_uint64_2human_readable(uint64_t); int -get_vol_type(int type, int dist_count, int brick_count); -int validate_brick_name(char *brick); char * get_host_name(char *word, char **host); @@ -1147,8 +1144,6 @@ 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); char * gf_strncpy(char *dest, const char *src, const size_t dest_size); diff --git a/libglusterfs/src/libglusterfs.sym b/libglusterfs/src/libglusterfs.sym index 48548c4ce50..5d96a4c6386 100644 --- a/libglusterfs/src/libglusterfs.sym +++ b/libglusterfs/src/libglusterfs.sym @@ -547,8 +547,6 @@ get_file_mtime get_host_name get_mem_size get_path_name -get_struct_variable -get_vol_type get_xlator_by_name get_xlator_by_type gf_array_insertionsort |