diff options
Diffstat (limited to 'libglusterfs/src/client_t.h')
-rw-r--r-- | libglusterfs/src/client_t.h | 77 |
1 files changed, 22 insertions, 55 deletions
diff --git a/libglusterfs/src/client_t.h b/libglusterfs/src/client_t.h index 7b3fcf0dd3a..f7812f8f07d 100644 --- a/libglusterfs/src/client_t.h +++ b/libglusterfs/src/client_t.h @@ -20,37 +20,13 @@ #include "locking.h" /* for gf_lock_t, not included by glusterfs.h */ struct client_ctx { - union { - uint64_t key; - void *xl_key; - }; - union { - uint64_t value; - void *ptr1; - }; + void *ctx_key; + void *ctx_value; }; -struct _client_t { +typedef struct _client_t { struct { - /* ctx for .../xlators/protocol/server */ - gf_lock_t fdtable_lock; - fdtable_t *fdtable; - char *client_uid; - struct _gf_timer *grace_timer; - uint32_t lk_version; - struct { - int flavour; - size_t len; - char *data; - } auth; - } server_ctx; - struct { - /* ctx for .../xlators/features/locks */ - gf_lock_t ltable_lock; - struct _lock_table *ltable; - } locks_ctx; - struct { - /* e.g. hekafs uidmap can stash stuff here */ + /* e.g. protocol/server stashes its ctx here */ gf_lock_t lock; unsigned short count; struct client_ctx *ctx; @@ -63,9 +39,15 @@ struct _client_t { xlator_t *bound_xl; xlator_t *this; int tbl_index; -}; -typedef struct _client_t client_t; + char *client_uid; + struct { + int flavour; + size_t len; + char *data; + } auth; +} client_t; +#define GF_CLIENTCTX_INITIAL_SIZE 8 struct client_table_entry { client_t *client; @@ -73,14 +55,13 @@ struct client_table_entry { }; typedef struct client_table_entry cliententry_t; - -struct _clienttable { +struct clienttable { unsigned int max_clients; gf_lock_t lock; cliententry_t *cliententries; int first_free; }; -typedef struct _clienttable clienttable_t; +typedef struct clienttable clienttable_t; #define GF_CLIENTTABLE_INITIAL_SIZE 32 @@ -92,10 +73,10 @@ typedef struct _clienttable clienttable_t; */ #define GF_CLIENTENTRY_ALLOCATED -2 - +struct rpcsvc_auth_data; client_t * -gf_client_get (xlator_t *this, rpcsvc_auth_data_t *cred, char *client_uid); +gf_client_get (xlator_t *this, struct rpcsvc_auth_data *cred, char *client_uid); void gf_client_put (client_t *client, gf_boolean_t *detached); @@ -103,15 +84,12 @@ gf_client_put (client_t *client, gf_boolean_t *detached); clienttable_t * gf_clienttable_alloc (void); - void gf_client_clienttable_destroy (clienttable_t *clienttable); - client_t * gf_client_ref (client_t *client); - void gf_client_unref (client_t *client); @@ -128,27 +106,13 @@ int gf_client_dump_inodes (xlator_t *this); int -client_ctx_set (client_t *client, xlator_t *xlator, uint64_t value); - - -int -client_ctx_get (client_t *client, xlator_t *xlator, uint64_t *value); - - -int -client_ctx_del (client_t *client, xlator_t *xlator, uint64_t *value); - +client_ctx_set (client_t *client, void *key, void *value); int -_client_ctx_set (client_t *client, xlator_t *xlator, uint64_t value); - +client_ctx_get (client_t *client, void *key, void **value); int -_client_ctx_get (client_t *client, xlator_t *xlator, uint64_t *value); - - -int -_client_ctx_del (client_t *client, xlator_t *xlator, uint64_t *value); +client_ctx_del (client_t *client, void *key, void **value); void client_ctx_dump (client_t *client, char *prefix); @@ -165,4 +129,7 @@ gf_client_dump_inodes_to_dict (xlator_t *this, dict_t *dict); int gf_client_dump_inodes (xlator_t *this); +int +gf_client_disconnect (client_t *client); + #endif /* _CLIENT_T_H */ |