nfs-ganesha 1.4
Functions | Variables

nfs4_clientid.c File Reference

#include <assert.h>
#include "HashData.h"
#include "HashTable.h"
#include "log.h"
#include "nfs_core.h"
#include "nfs_exports.h"
#include "config_parsing.h"
#include <stdlib.h>
#include <string.h>
#include <pthread.h>
#include "nfs4.h"
#include "sal_data.h"
#include "sal_functions.h"
#include "cache_inode_lru.h"
#include "abstract_atomic.h"

Go to the source code of this file.

Functions

const char * clientid_confirm_state_to_str (nfs_clientid_confirm_state_t confirmed)
int display_client_id_rec (nfs_client_id_t *pclientid, char *str)
int display_clientid_name (nfs_client_id_t *pclientid, char *str)
void inc_client_id_ref (nfs_client_id_t *pclientid)
void free_client_id (nfs_client_id_t *pclientid)
void dec_client_id_ref (nfs_client_id_t *pclientid)
uint32_t client_id_value_hash_func (hash_parameter_t *p_hparam, hash_buffer_t *buffclef)
uint64_t client_id_rbt_hash_func (hash_parameter_t *p_hparam, hash_buffer_t *buffclef)
int compare_client_id (hash_buffer_t *buff1, hash_buffer_t *buff2)
int display_client_id_key (hash_buffer_t *pbuff, char *str)
int display_client_id_val (hash_buffer_t *pbuff, char *str)
nfs_client_id_tcreate_client_id (clientid4 clientid, nfs_client_record_t *pclient_record, sockaddr_t *pclient_addr, nfs_client_cred_t *pcredential)
int nfs_client_id_insert (nfs_client_id_t *pclientid)
int remove_unconfirmed_client_id (nfs_client_id_t *pclientid)
int nfs_client_id_confirm (nfs_client_id_t *pclientid, log_components_t component)
int nfs_client_id_expire (nfs_client_id_t *pclientid)
int nfs_client_id_get (hash_table_t *ht, clientid4 clientid, nfs_client_id_t **p_pclientid)
int nfs_client_id_get_unconfirmed (clientid4 clientid, nfs_client_id_t **p_pclientid)
int nfs_client_id_get_confirmed (clientid4 clientid, nfs_client_id_t **p_pclientid)
int nfs_Init_client_id (nfs_client_id_parameter_t *param)
clientid4 new_clientid (void)
void new_clientifd_verifier (char *pverf)
int display_client_record (nfs_client_record_t *precord, char *str)
void inc_client_record_ref (nfs_client_record_t *precord)
void free_client_record (nfs_client_record_t *precord)
void dec_client_record_ref (nfs_client_record_t *precord)
uint64_t client_record_value_hash (nfs_client_record_t *pkey)
uint32_t client_record_value_hash_func (hash_parameter_t *p_hparam, hash_buffer_t *buffclef)
unsigned long client_record_rbt_hash_func (hash_parameter_t *p_hparam, hash_buffer_t *buffclef)
int compare_client_record (hash_buffer_t *buff1, hash_buffer_t *buff2)
int display_client_record_key (hash_buffer_t *pbuff, char *str)
int display_client_record_val (hash_buffer_t *pbuff, char *str)
nfs_client_record_tget_client_record (char *value, int len)

Variables

hash_table_tht_client_record
hash_table_tht_confirmed_client_id
hash_table_tht_unconfirmed_client_id
pthread_mutex_t clientid_mutex = PTHREAD_MUTEX_INITIALIZER
uint32_t clientid_counter
uint64_t clientid_verifier
pool_tclient_id_pool
pool_tclient_record_pool

Function Documentation

uint64_t client_id_rbt_hash_func ( hash_parameter_t p_hparam,
hash_buffer_t buffclef 
)

client_id_rbt_hash_func: computes the rbt value for the entry in Client Id cache.

Computes the rbt value for the entry in Client Id cache. In fact, it just use the address value itself (which is an unsigned integer) as the rbt value. This function is called internal in the HasTable_* function

Parameters:
hparam[IN] hash table parameter.
buffcleff[in]pointer to the hash key buffer
Returns:
the computed rbt value.
See also:
HashTable_Init

Definition at line 238 of file nfs4_clientid.c.

uint32_t client_id_value_hash_func ( hash_parameter_t p_hparam,
hash_buffer_t buffclef 
)

client_id_value_hash_func: computes the hash value for the entry in Client Id cache.

Computes the hash value for the entry in Client Id cache. In fact, it just use addresse as value (identity function) modulo the size of the hash. This function is called internal in the HasTable_* function

Parameters:
hparam[IN] hash table parameter.
buffcleff[IN] pointer to the hash key buffer
Returns:
the computed hash value.
See also:
HashTable_Init

Definition at line 212 of file nfs4_clientid.c.

unsigned long client_record_rbt_hash_func ( hash_parameter_t p_hparam,
hash_buffer_t buffclef 
)

client_record_rbt_hash_func: computes the rbt value for the entry in Client Id cache.

Computes the rbt value for the entry in Client Record cache. This function is called internal in the HasTable_* function

Parameters:
hparam[IN] hash table parameter.
buffcleff[in]pointer to the hash key buffer
Returns:
the computed rbt value.
See also:
HashTable_Init

Definition at line 1129 of file nfs4_clientid.c.

uint64_t client_record_value_hash ( nfs_client_record_t pkey)

Definition at line 1071 of file nfs4_clientid.c.

uint32_t client_record_value_hash_func ( hash_parameter_t p_hparam,
hash_buffer_t buffclef 
)

client_record_rbt_hash_func: computes the hash value for the entry in Client Record cache.

Computes the hash value for the entry in Client Record cache This function is called internal in the HasTable_* function

Parameters:
hparam[IN] hash table parameter.
buffcleff[IN] pointer to the hash key buffer
Returns:
the computed hash value.
See also:
HashTable_Init

Definition at line 1099 of file nfs4_clientid.c.

const char* clientid_confirm_state_to_str ( nfs_clientid_confirm_state_t  confirmed)

Definition at line 66 of file nfs4_clientid.c.

int compare_client_id ( hash_buffer_t buff1,
hash_buffer_t buff2 
)

compare_client_id: compares the ip address stored in the key buffers.

compare the ip address stored in the key buffers. This function is to be used as 'compare_key' field in the hashtable storing the client ids.

Parameters:
buff1[IN] first key
buff2[IN] second key
Returns:
0 if keys are identifical, 1 if they are different.

Definition at line 261 of file nfs4_clientid.c.

int compare_client_record ( hash_buffer_t buff1,
hash_buffer_t buff2 
)

compare_client_record: compares the cr_client_val the key buffers.

compare the cr_client_val stored in the key buffers. This function is to be used as 'compare_key' field in the hashtable storing the client records.

Parameters:
buff1[IN] first key
buff2[IN] second key
Returns:
0 if keys are identifical, 1 if they are different.

Definition at line 1156 of file nfs4_clientid.c.

nfs_client_id_t* create_client_id ( clientid4  clientid,
nfs_client_record_t pclient_record,
sockaddr_t pclient_addr,
nfs_client_cred_t pcredential 
)

Definition at line 295 of file nfs4_clientid.c.

void dec_client_id_ref ( nfs_client_id_t pclientid)

Definition at line 155 of file nfs4_clientid.c.

void dec_client_record_ref ( nfs_client_record_t precord)

Definition at line 986 of file nfs4_clientid.c.

int display_client_id_key ( hash_buffer_t pbuff,
char *  str 
)

display_client_id_key: displays the client_id stored in the buffer.

displays the client_id stored in the buffer. This function is to be used as 'key_to_str' field in the hashtable storing the client ids.

Parameters:
buff1[IN] buffer to display
buff2[OUT] output string
Returns:
number of character written.

Definition at line 281 of file nfs4_clientid.c.

int display_client_id_rec ( nfs_client_id_t pclientid,
char *  str 
)

Definition at line 77 of file nfs4_clientid.c.

int display_client_id_val ( hash_buffer_t pbuff,
char *  str 
)

Definition at line 290 of file nfs4_clientid.c.

int display_client_record ( nfs_client_record_t precord,
char *  str 
)

Definition at line 945 of file nfs4_clientid.c.

int display_client_record_key ( hash_buffer_t pbuff,
char *  str 
)

display_client_record: displays the client_record stored in the buffer.

displays the client_record stored in the buffer. This function is to be used as 'key_to_str' field in the hashtable storing the client ids.

Parameters:
buff1[IN] buffer to display
buff2[OUT] output string
Returns:
number of character written.

Definition at line 1182 of file nfs4_clientid.c.

int display_client_record_val ( hash_buffer_t pbuff,
char *  str 
)

Definition at line 1187 of file nfs4_clientid.c.

int display_clientid_name ( nfs_client_id_t pclientid,
char *  str 
)

Definition at line 108 of file nfs4_clientid.c.

void free_client_id ( nfs_client_id_t pclientid)

Definition at line 140 of file nfs4_clientid.c.

void free_client_record ( nfs_client_record_t precord)

Definition at line 976 of file nfs4_clientid.c.

nfs_client_record_t* get_client_record ( char *  value,
int  len 
)

Definition at line 1192 of file nfs4_clientid.c.

void inc_client_id_ref ( nfs_client_id_t pclientid)

Definition at line 125 of file nfs4_clientid.c.

void inc_client_record_ref ( nfs_client_record_t precord)

Definition at line 961 of file nfs4_clientid.c.

clientid4 new_clientid ( void  )

new_clientid: Builds a new clientid4 value using counter and ServerEpoch.

Builds a new clientid4 value using counter and ServerEpoch.

Definition at line 906 of file nfs4_clientid.c.

void new_clientifd_verifier ( char *  pverf)

new_clientifd_verifier: Builds a new verifier4 value.

Builds a new verifier4 value.

Definition at line 927 of file nfs4_clientid.c.

int nfs_client_id_confirm ( nfs_client_id_t pclientid,
log_components_t  component 
)

nfs_client_id_confirm: Confirms a client id record.

Confirms a client id record.

Parameters:
pclientid[IN] the client id record
Returns:
CLIENT_ID_SUCCESS if successfull.
CLIENT_ID_INVALID_ARGUMENT if unable to find record in unconfirmed table
CLIENT_ID_INSERT_MALLOC_ERROR if unable to insert record into confirmed table
CLIENT_ID_NETDB_ERROR if an error occured during the netdb query (via gethostbyaddr).

Definition at line 496 of file nfs4_clientid.c.

int nfs_client_id_expire ( nfs_client_id_t pclientid)

nfs_client_id_expire: client expires, need to take care of owners

assumes caller holds precord->cr_mutex and holds a reference to precord also.

Parameters:
pclientid[IN] the client id used to expire

Definition at line 575 of file nfs4_clientid.c.

int nfs_client_id_get ( hash_table_t ht,
clientid4  clientid,
nfs_client_id_t **  p_pclientid 
)

Definition at line 751 of file nfs4_clientid.c.

int nfs_client_id_get_confirmed ( clientid4  clientid,
nfs_client_id_t **  p_pclientid 
)

nfs_client_id_get_confirmed: Tries to get a pointer to an confirmed entry for client_id cache.

Tries to get a pointer to an confirmed entry for client_id cache.

Parameters:
clientid[IN] the client id
p_pclientid[OUT] the found client id
Returns:
the result previously set if *pstatus == CLIENT_ID_SUCCESS

Definition at line 833 of file nfs4_clientid.c.

int nfs_client_id_get_unconfirmed ( clientid4  clientid,
nfs_client_id_t **  p_pclientid 
)

nfs_client_id_get_unconfirmed: Tries to get a pointer to an unconfirmed entry for client_id cache.

Tries to get a pointer to an unconfirmed entry for client_id cache.

Parameters:
clientid[IN] the client id
p_pclientid[OUT] the found client id
Returns:
the result previously set if *pstatus == CLIENT_ID_SUCCESS

Definition at line 815 of file nfs4_clientid.c.

int nfs_client_id_insert ( nfs_client_id_t pclientid)

nfs_client_id_insert: Inserts an entry describing a clientid4 into the cache.

Inserts an entry describing a clientid4 into the cache.

Parameters:
pclientid[IN] the client id record
Returns:
CLIENT_ID_SUCCESS if successfull
.
CLIENT_ID_INSERT_MALLOC_ERROR if an error occured during the insertion process
CLIENT_ID_NETDB_ERROR if an error occured during the netdb query (via gethostbyaddr).

Definition at line 389 of file nfs4_clientid.c.

int nfs_Init_client_id ( nfs_client_id_parameter_t param)

nfs_Init_client_id: Init the hashtable for Client Id cache.

Perform all the required initialization for hashtable Client Id cache

Parameters:
param[IN] parameter used to init the duplicate request cache
Returns:
0 if successful, -1 otherwise

Definition at line 850 of file nfs4_clientid.c.

int remove_unconfirmed_client_id ( nfs_client_id_t pclientid)

remove_unconfirmed_client_id: Removes an unconfirmed client id record.

Removes an unconfirmed client id record.

Parameters:
pclientid[IN] the client id record
Returns:
hash table error code

Definition at line 447 of file nfs4_clientid.c.


Variable Documentation

Definition at line 63 of file nfs4_clientid.c.

Definition at line 64 of file nfs4_clientid.c.

Definition at line 61 of file nfs4_clientid.c.

pthread_mutex_t clientid_mutex = PTHREAD_MUTEX_INITIALIZER

Definition at line 60 of file nfs4_clientid.c.

Definition at line 62 of file nfs4_clientid.c.

vim:expandtab:shiftwidth=8:tabstop=8:

Copyright CEA/DAM/DIF (2008) contributeur : Philippe DENIEL philippe.deniel@cea.fr Thomas LEIBOVICI thomas.leibovici@cea.fr

This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software F oundation; either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA

---------------------------------------

nfs4_client_id.c : The management of the client id cache.

$Header$

$Log$

Definition at line 57 of file nfs4_clientid.c.

Definition at line 58 of file nfs4_clientid.c.

Definition at line 59 of file nfs4_clientid.c.