"Fossies" - the Fresh Open Source Software Archive

Member "glusterfs-8.2/libglusterfs/src/glusterfs/client_t.h" (16 Sep 2020, 3467 Bytes) of package /linux/misc/glusterfs-8.2.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "client_t.h" see the Fossies "Dox" file reference documentation.

    1 /*
    2   Copyright (c) 2008-2012 Red Hat, Inc. <http://www.redhat.com>
    3   This file is part of GlusterFS.
    4 
    5   This file is licensed to you under your choice of the GNU Lesser
    6   General Public License, version 3 or any later version (LGPLv3 or
    7   later), or the GNU General Public License, version 2 (GPLv2), in all
    8   cases as published by the Free Software Foundation.
    9 */
   10 
   11 #ifndef _CLIENT_T_H
   12 #define _CLIENT_T_H
   13 
   14 #include "glusterfs/glusterfs.h"
   15 #include "glusterfs/locking.h" /* for gf_lock_t, not included by glusterfs.h */
   16 #include "glusterfs/atomic.h"  /* for gf_atomic_t */
   17 
   18 /* auth_data structure is required by RPC layer. But as it is also used in
   19  * client_t structure validation, comparision, it is critical that it is defined
   20  * in the larger scope of libglusterfs, instead of libgfrpc. With this change,
   21  * even RPC will use this structure */
   22 #define GF_CLIENTT_AUTH_BYTES 400
   23 typedef struct client_auth_data {
   24     int flavour;
   25     int datalen;
   26     char authdata[GF_CLIENTT_AUTH_BYTES];
   27 } client_auth_data_t;
   28 
   29 struct client_ctx {
   30     void *ctx_key;
   31     void *ctx_value;
   32 };
   33 
   34 typedef struct _client {
   35     struct {
   36         /* e.g. protocol/server stashes its ctx here */
   37         gf_lock_t lock;
   38         unsigned short count;
   39         struct client_ctx *ctx;
   40     } scratch_ctx;
   41     gf_atomic_t bind;
   42     gf_atomic_t count;
   43     xlator_t *bound_xl;
   44     xlator_t *this;
   45     int tbl_index;
   46     char *client_uid;
   47     char *client_name;
   48     struct {
   49         int flavour;
   50         size_t len;
   51         char *data;
   52         char *username;
   53         char *passwd;
   54     } auth;
   55 
   56     /* subdir_mount */
   57     char *subdir_mount;
   58     inode_t *subdir_inode;
   59     uuid_t subdir_gfid;
   60     int32_t opversion;
   61     /* Variable to save fd_count for detach brick */
   62     gf_atomic_t fd_cnt;
   63 } client_t;
   64 
   65 #define GF_CLIENTCTX_INITIAL_SIZE 8
   66 
   67 struct client_table_entry {
   68     client_t *client;
   69     int next_free;
   70 };
   71 typedef struct client_table_entry cliententry_t;
   72 
   73 struct clienttable {
   74     unsigned int max_clients;
   75     gf_lock_t lock;
   76     cliententry_t *cliententries;
   77     int first_free;
   78     client_t *local;
   79 };
   80 typedef struct clienttable clienttable_t;
   81 
   82 #define GF_CLIENTTABLE_INITIAL_SIZE 128
   83 
   84 /* Signifies no more entries in the client table. */
   85 #define GF_CLIENTTABLE_END -1
   86 
   87 /* This is used to invalidate
   88  * the next_free value in an cliententry that has been allocated
   89  */
   90 #define GF_CLIENTENTRY_ALLOCATED -2
   91 
   92 void
   93 gf_client_put(client_t *client, gf_boolean_t *detached);
   94 
   95 clienttable_t *
   96 gf_clienttable_alloc(void);
   97 
   98 client_t *
   99 gf_client_ref(client_t *client);
  100 
  101 void
  102 gf_client_unref(client_t *client);
  103 
  104 int
  105 gf_client_dump_fdtable_to_dict(xlator_t *this, dict_t *dict);
  106 
  107 int
  108 gf_client_dump_fdtable(xlator_t *this);
  109 
  110 int
  111 gf_client_dump_inodes_to_dict(xlator_t *this, dict_t *dict);
  112 
  113 int
  114 gf_client_dump_inodes(xlator_t *this);
  115 
  116 void *
  117 client_ctx_set(client_t *client, void *key, void *value);
  118 
  119 int
  120 client_ctx_get(client_t *client, void *key, void **value);
  121 
  122 int
  123 client_ctx_del(client_t *client, void *key, void **value);
  124 
  125 void
  126 client_ctx_dump(client_t *client, char *prefix);
  127 
  128 int
  129 gf_client_dump_fdtables_to_dict(xlator_t *this, dict_t *dict);
  130 
  131 int
  132 gf_client_dump_fdtables(xlator_t *this);
  133 
  134 int
  135 gf_client_dump_inodes_to_dict(xlator_t *this, dict_t *dict);
  136 
  137 int
  138 gf_client_dump_inodes(xlator_t *this);
  139 
  140 int
  141 gf_client_disconnect(client_t *client);
  142 
  143 client_t *
  144 gf_client_get(xlator_t *this, client_auth_data_t *cred, char *client_uid,
  145               char *subdir_mount);
  146 
  147 #endif /* _CLIENT_T_H */