nfs-ganesha 1.4
Defines | Functions | Variables

nfs4_state_id.c File Reference

#include <stdio.h>
#include <sys/types.h>
#include <ctype.h>
#include <stdlib.h>
#include <dirent.h>
#include <netdb.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <string.h>
#include <pthread.h>
#include <fcntl.h>
#include <sys/file.h>
#include <pwd.h>
#include <grp.h>
#include "log.h"
#include "ganesha_rpc.h"
#include "HashData.h"
#include "HashTable.h"
#include "nfs_core.h"
#include "nfs4.h"
#include "fsal.h"
#include "nfs_tools.h"
#include "nfs_exports.h"
#include "nfs_file_handle.h"
#include "sal_functions.h"

Go to the source code of this file.

Defines

#define seqid_all_one   0xFFFFFFFF

Functions

size_t strnlen (const char *s, size_t maxlen)
int display_stateid_other (char *other, char *str)
int display_state_id_key (hash_buffer_t *pbuff, char *str)
int display_state_id_val (hash_buffer_t *pbuff, char *str)
int compare_state_id (hash_buffer_t *buff1, hash_buffer_t *buff2)
uint32_t compute_stateid_hash_value (uint32_t *pstate)
uint32_t state_id_value_hash_func (hash_parameter_t *p_hparam, hash_buffer_t *buffclef)
uint64_t state_id_rbt_hash_func (hash_parameter_t *p_hparam, hash_buffer_t *buffclef)
int nfs4_Init_state_id (nfs_state_id_parameter_t param)
void nfs4_BuildStateId_Other (char *other)
int nfs4_State_Set (char other[OTHERSIZE], state_t *pstate_data)
int nfs4_State_Get_Pointer (char other[OTHERSIZE], state_t **pstate_data)
int nfs4_State_Del (char other[OTHERSIZE])
int nfs4_Check_Stateid (stateid4 *pstate, cache_entry_t *pentry, state_t **ppstate, compound_data_t *data, char flags, const char *tag)
void nfs_State_PrintAll (void)
void update_stateid (state_t *pstate, stateid4 *presp, compound_data_t *data, const char *tag)
int nfs4_check_special_stateid (cache_entry_t *pentry, const char *tag, int access)

Variables

hash_table_tht_state_id
char all_zero [OTHERSIZE]
char all_one [OTHERSIZE]
pthread_mutex_t StateIdMutex = PTHREAD_MUTEX_INITIALIZER
uint64_t state_id_counter

Define Documentation

#define seqid_all_one   0xFFFFFFFF

Definition at line 73 of file nfs4_state_id.c.


Function Documentation

int compare_state_id ( hash_buffer_t buff1,
hash_buffer_t buff2 
)

Definition at line 103 of file nfs4_state_id.c.

uint32_t compute_stateid_hash_value ( uint32_t pstate) [inline]

Definition at line 121 of file nfs4_state_id.c.

int display_state_id_key ( hash_buffer_t pbuff,
char *  str 
)

Definition at line 86 of file nfs4_state_id.c.

int display_state_id_val ( hash_buffer_t pbuff,
char *  str 
)

Definition at line 91 of file nfs4_state_id.c.

int display_stateid_other ( char *  other,
char *  str 
)

Definition at line 78 of file nfs4_state_id.c.

void nfs4_BuildStateId_Other ( char *  other)

nfs4_BuildStateId_Other

This routine builds the 12 byte "other" portion of a stateid from the ServerEpoch and a 64 bit global counter.

Parameters:
other[OUT] the stateid.other object (a char[OTHERSIZE] string)

Definition at line 184 of file nfs4_state_id.c.

int nfs4_check_special_stateid ( cache_entry_t pentry,
const char *  tag,
int  access 
)

nfs4_check_special_stateid

Special stateid, no open state, check to see if any share conflicts The stateid is all-0 or all-1

Returns:
NFS4_OK if ok, anything else if otherwise

Definition at line 559 of file nfs4_state_id.c.

int nfs4_Check_Stateid ( stateid4 pstate,
cache_entry_t pentry,
state_t **  ppstate,
compound_data_t data,
char  flags,
const char *  tag 
)

nfs4_Check_Stateid

This routine checks the availability of the stateid and returns a pointer to it

Parameters:
pstate[IN] pointer to the stateid to be checked.
Returns:
1 if ok, 0 otherwise.

Todo:
fsf: maybe change to simple comparison pstate->seqid < pstate2->state_seqid as good enough and maybe makes pynfs happy.

Definition at line 317 of file nfs4_state_id.c.

int nfs4_Init_state_id ( nfs_state_id_parameter_t  param)

nfs4_Init_state_id: Init the hashtable for Client Id cache.

Perform all the required initialization for hashtable State Id cache

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

Definition at line 160 of file nfs4_state_id.c.

int nfs4_State_Del ( char  other[OTHERSIZE])

nfs4_State_Del

This routine removes a state from the states's hashtable.

Parameters:
other[IN] stateid'other field, used as a hash key
Returns:
1 if ok, 0 otherwise.

Definition at line 284 of file nfs4_state_id.c.

int nfs4_State_Get_Pointer ( char  other[OTHERSIZE],
state_t **  pstate_data 
)

nfs4_State_Get_Pointer

This routine gets a pointer to a state from the states's hashtable.

Parameters:
pstate[IN] pointer to the stateid to be checked.
ppstate_data[OUT] pointer's state found
Returns:
1 if ok, 0 otherwise.

Definition at line 251 of file nfs4_state_id.c.

int nfs4_State_Set ( char  other[OTHERSIZE],
state_t pstate_data 
)

nfs4_State_Set

This routine sets a state into the states's hashtable.

Parameters:
pstate[IN] pointer to the stateid to be checked.
Returns:
1 if ok, 0 otherwise.

Definition at line 207 of file nfs4_state_id.c.

void nfs_State_PrintAll ( void  )

nfs4_State_PrintAll

This routine displays the content of the hashtable used to store the states.

Returns:
nothing (void function)

Definition at line 513 of file nfs4_state_id.c.

uint64_t state_id_rbt_hash_func ( hash_parameter_t p_hparam,
hash_buffer_t buffclef 
)

Definition at line 138 of file nfs4_state_id.c.

uint32_t state_id_value_hash_func ( hash_parameter_t p_hparam,
hash_buffer_t buffclef 
)

Definition at line 126 of file nfs4_state_id.c.

size_t strnlen ( const char *  s,
size_t  maxlen 
)

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 Foundation; 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

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

nfs_state_id.c : The management of the state id cache.

$Header$

$Log$

void update_stateid ( state_t pstate,
stateid4 presp,
compound_data_t data,
const char *  tag 
)

Definition at line 519 of file nfs4_state_id.c.


Variable Documentation

char all_one[OTHERSIZE]

Definition at line 72 of file nfs4_state_id.c.

char all_zero[OTHERSIZE]

Definition at line 71 of file nfs4_state_id.c.

Definition at line 69 of file nfs4_state_id.c.

Definition at line 76 of file nfs4_state_id.c.

pthread_mutex_t StateIdMutex = PTHREAD_MUTEX_INITIALIZER

Definition at line 75 of file nfs4_state_id.c.