nfs-ganesha 1.4
Classes | Defines | Typedefs | Functions

nfs_ip_stats.h File Reference

#include <sys/types.h>
#include <sys/param.h>
#include "ganesha_rpc.h"
#include <dirent.h>
#include <netdb.h>
#include "HashData.h"
#include "HashTable.h"

Go to the source code of this file.

Classes

struct  nfs_ip_name__
struct  nfs_ip_stats__

Defines

#define IP_NAME_SUCCESS   0
#define IP_NAME_INSERT_MALLOC_ERROR   1
#define IP_NAME_NOT_FOUND   2
#define IP_NAME_NETDB_ERROR   3
#define IP_STATS_SUCCESS   0
#define IP_STATS_INSERT_MALLOC_ERROR   1
#define IP_STATS_NOT_FOUND   2
#define IP_STATS_NETDB_ERROR   3
#define IP_NAME_PREALLOC_SIZE   200

Typedefs

typedef struct nfs_ip_name__ nfs_ip_name_t
typedef struct nfs_ip_stats__ nfs_ip_stats_t

Functions

int nfs_ip_name_get (sockaddr_t *ipaddr, char *hostname)
int nfs_ip_name_add (sockaddr_t *ipaddr, char *hostname)
int nfs_ip_name_remove (sockaddr_t *ipaddr)
int nfs_ip_stats_add (hash_table_t *ht_ip_stats, sockaddr_t *ipaddr, pool_t *ip_stats_pool)
int nfs_ip_stats_incr (hash_table_t *ht_ip_stats, sockaddr_t *ipaddr, unsigned int nfs_prog, unsigned int mnt_prog, struct svc_req *ptr_req)
int nfs_ip_stats_get (hash_table_t *ht_ip_stats, sockaddr_t *ipaddr, nfs_ip_stats_t **pnfs_ip_stats)
int nfs_ip_stats_remove (hash_table_t *ht_ip_stats, sockaddr_t *ipaddr, pool_t *ip_stats_pool)
void nfs_ip_stats_dump (hash_table_t **ht_ip_stats, unsigned int nb_worker, char *path_stat)
void nfs_ip_name_get_stats (hash_stat_t *phstat)
int nfs_ip_name_populate (char *path)
int display_ip_name_key (hash_buffer_t *pbuff, char *str)
int display_ip_name_val (hash_buffer_t *pbuff, char *str)
int compare_ip_name (hash_buffer_t *buff1, hash_buffer_t *buff2)
uint64_t ip_name_rbt_hash_func (hash_parameter_t *p_hparam, hash_buffer_t *buffclef)
uint32_t ip_name_value_hash_func (hash_parameter_t *p_hparam, hash_buffer_t *buffclef)
int display_ip_stats_key (hash_buffer_t *pbuff, char *str)
int display_ip_stats_val (hash_buffer_t *pbuff, char *str)
int compare_ip_stats (hash_buffer_t *buff1, hash_buffer_t *buff2)
uint64_t ip_stats_rbt_hash_func (hash_parameter_t *p_hparam, hash_buffer_t *buffclef)
uint32_t ip_stats_value_hash_func (hash_parameter_t *p_hparam, hash_buffer_t *buffclef)

Define Documentation

#define IP_NAME_INSERT_MALLOC_ERROR   1

Definition at line 15 of file nfs_ip_stats.h.

#define IP_NAME_NETDB_ERROR   3

Definition at line 17 of file nfs_ip_stats.h.

#define IP_NAME_NOT_FOUND   2

Definition at line 16 of file nfs_ip_stats.h.

#define IP_NAME_PREALLOC_SIZE   200

Definition at line 25 of file nfs_ip_stats.h.

#define IP_NAME_SUCCESS   0

Definition at line 14 of file nfs_ip_stats.h.

#define IP_STATS_INSERT_MALLOC_ERROR   1

Definition at line 21 of file nfs_ip_stats.h.

#define IP_STATS_NETDB_ERROR   3

Definition at line 23 of file nfs_ip_stats.h.

#define IP_STATS_NOT_FOUND   2

Definition at line 22 of file nfs_ip_stats.h.

#define IP_STATS_SUCCESS   0

Definition at line 20 of file nfs_ip_stats.h.


Typedef Documentation

typedef struct nfs_ip_name__ nfs_ip_name_t

Function Documentation

int compare_ip_name ( hash_buffer_t buff1,
hash_buffer_t buff2 
)

compare_ip_name: 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 nfs duplicated requests.

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

Definition at line 115 of file nfs_ip_name.c.

int compare_ip_stats ( hash_buffer_t buff1,
hash_buffer_t buff2 
)

compare_ip_stats: 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 nfs duplicated requests.

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

Definition at line 123 of file nfs_ip_stats.c.

int display_ip_name_key ( hash_buffer_t pbuff,
char *  str 
)

display_ip_name_key: displays the ip_name stored in the buffer.

displays the ip_name key stored in the buffer. This function is to be used as 'key_to_str' field.

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

Definition at line 132 of file nfs_ip_name.c.

int display_ip_name_val ( hash_buffer_t pbuff,
char *  str 
)

display_ip_name_vale: displays the ip_name stored in the buffer.

displays the ip_name value stored in the buffer. This function is to be used as 'val_to_str' field.

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

Definition at line 152 of file nfs_ip_name.c.

int display_ip_stats_key ( hash_buffer_t pbuff,
char *  str 
)

display_ip_stats_key: displays the ip_stats stored in the buffer.

displays the ip_stats key stored in the buffer. This function is to be used as 'key_to_str' field.

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

Definition at line 140 of file nfs_ip_stats.c.

int display_ip_stats_val ( hash_buffer_t pbuff,
char *  str 
)

display_ip_stats_val: displays the ip_stats stored in the buffer.

displays the ip_stats stored in the buffer. This function is to be used as 'val_to_str' field.

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

Definition at line 160 of file nfs_ip_stats.c.

uint64_t ip_name_rbt_hash_func ( hash_parameter_t p_hparam,
hash_buffer_t buffclef 
)

ip_name_rbt_hash_func: computes the rbt value for the entry in IP/name cache.

Computes the rbt value for the entry in IP/name 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 96 of file nfs_ip_name.c.

uint32_t ip_name_value_hash_func ( hash_parameter_t p_hparam,
hash_buffer_t buffclef 
)

ip_name_rbt_hash_func: computes the hash value for the entry in IP/name cache.

Computes the hash value for the entry in IP/name 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 75 of file nfs_ip_name.c.

uint64_t ip_stats_rbt_hash_func ( hash_parameter_t p_hparam,
hash_buffer_t buffclef 
)

ip_stats_rbt_hash_func: computes the rbt value for the entry in IP stats cache.

Computes the rbt value for the entry in IP stats 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 104 of file nfs_ip_stats.c.

uint32_t ip_stats_value_hash_func ( hash_parameter_t p_hparam,
hash_buffer_t buffclef 
)

ip_stats_rbt_hash_func: computes the hash value for the entry in IP stats cache.

Computes the hash value for the entry in IP stats 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 83 of file nfs_ip_stats.c.

int nfs_ip_name_add ( sockaddr_t ipaddr,
char *  hostname 
)

nfs_ip_name_add: adds an entry in the duplicate requests cache.

Adds an entry in the duplicate requests cache.

Parameters:
ipaddr[IN] the ipaddr to be used as key
hostname[IN] the hostname added (found by using gethostbyaddr)
Returns:
IP_NAME_SUCCESS if successfull
.
IP_NAME_INSERT_MALLOC_ERROR if an error occured during the insertion process
IP_NAME_NETDB_ERROR if an error occured during the netdb query (via gethostbyaddr).

Definition at line 174 of file nfs_ip_name.c.

int nfs_ip_name_get ( sockaddr_t ipaddr,
char *  hostname 
)

nfs_ip_name_get: Tries to get an entry for ip_name cache.

Tries to get an entry for ip_name cache.

Parameters:
ipaddr[IN] the ip address requested
hostname[OUT] the hostname
Returns:
the result previously set if *pstatus == IP_NAME_SUCCESS

Definition at line 265 of file nfs_ip_name.c.

void nfs_ip_name_get_stats ( hash_stat_t phstat)

nfs_ip_name_get_stats: gets the hash table statistics for the IP_NAME Table.

Gets the hash table statistics for the IP_NAME Table.

Parameters:
phstat[OUT] pointer to the resulting stats.
Returns:
nothing (void function)
See also:
HashTable_GetStats

Definition at line 476 of file nfs_ip_name.c.

int nfs_ip_name_populate ( char *  path)

Definition at line 362 of file nfs_ip_name.c.

int nfs_ip_name_remove ( sockaddr_t ipaddr)

nfs_ip_name_remove: Tries to remove an entry for ip_name cache

Tries to remove an entry for ip_name cache.

Parameters:
ipaddr[IN] the ip address to be uncached.
Returns:
the result previously set if *pstatus == IP_NAME_SUCCESS

Definition at line 307 of file nfs_ip_name.c.

int nfs_ip_stats_add ( hash_table_t ht_ip_stats,
sockaddr_t ipaddr,
pool_t ip_stats_pool 
)

nfs_ip_stats_add: adds an entry in the duplicate requests cache.

Adds an entry in the duplicate requests cache.

Parameters:
ipaddr[IN] the ipaddr to be used as key
ip_stats_pool[INOUT] values pool for hash table
Returns:
IP_STATS_SUCCESS if successfull
.
IP_STATS_INSERT_MALLOC_ERROR if an error occured during the insertion process
IP_STATS_NETDB_ERROR if an error occured during the netdb query (via gethostbyaddr).

Definition at line 189 of file nfs_ip_stats.c.

void nfs_ip_stats_dump ( hash_table_t **  ht_ip_stats,
unsigned int  nb_worker,
char *  path_stat 
)

nfs_ip_stats_dump: Dumps the IP Stats for each client to a file per client

Parameters:
ht_ip_stats[IN] hash table to be dumped
path_stat[IN] pattern used to build path used for dumping stats
Returns:
nothing (void function).

Definition at line 433 of file nfs_ip_stats.c.

int nfs_ip_stats_get ( hash_table_t ht_ip_stats,
sockaddr_t ipaddr,
nfs_ip_stats_t **  g 
)

nfs_ip_stats_get: gets the stats value.

gets the stats value.

Parameters:
ipaddr[IN] the ip address requested
Returns:
the computed number of call for this ipaddr. Negative value is a failure

Definition at line 332 of file nfs_ip_stats.c.

int nfs_ip_stats_incr ( hash_table_t ht_ip_stats,
sockaddr_t ipaddr,
unsigned int  nfs_prog,
unsigned int  mnt_prog,
struct svc_req *  ptr_req 
)

nfs_ip_stats_incr: increments the stats value.

increments the stats value.

Parameters:
ipaddr[IN] the ip address requested
Returns:
the computed number of call for this ipaddr. Negative value is a failure

Definition at line 254 of file nfs_ip_stats.c.

int nfs_ip_stats_remove ( hash_table_t ht_ip_stats,
sockaddr_t ipaddr,
pool_t ip_stats_pool 
)

nfs_ip_stats_remove: Tries to remove an entry for ip_stats cache

Tries to remove an entry for ip_stats cache.

Parameters:
ipaddr[IN] the ip address to be uncached.
ip_stats_pool[INOUT] values pool for hash table
Returns:
the result previously set if *pstatus == IP_STATS_SUCCESS

Definition at line 371 of file nfs_ip_stats.c.