nfs-ganesha 1.4
Functions | Variables

idmapper_cache.c File Reference

Id mapping functions. More...

#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 <strings.h>
#include <pwd.h>
#include <grp.h>

Go to the source code of this file.

Functions

size_t strnlen (const char *s, size_t maxlen)
uint32_t idmapper_value_hash_func (hash_parameter_t *p_hparam, hash_buffer_t *buffclef)
uint32_t namemapper_value_hash_func (hash_parameter_t *p_hparam, hash_buffer_t *buffclef)
uint64_t idmapper_rbt_hash_func (hash_parameter_t *p_hparam, hash_buffer_t *buffclef)
uint64_t namemapper_rbt_hash_func (hash_parameter_t *p_hparam, hash_buffer_t *buffclef)
int compare_idmapper (hash_buffer_t *buff1, hash_buffer_t *buff2)
int compare_namemapper (hash_buffer_t *buff1, hash_buffer_t *buff2)
int display_idmapper_key (hash_buffer_t *pbuff, char *str)
int display_idmapper_val (hash_buffer_t *pbuff, char *str)
int idmap_uid_init (nfs_idmap_cache_parameter_t param)
int uidgidmap_init (nfs_idmap_cache_parameter_t param)
int idmap_uname_init (nfs_idmap_cache_parameter_t param)
int idmap_gid_init (nfs_idmap_cache_parameter_t param)
int idmap_gname_init (nfs_idmap_cache_parameter_t param)
int idmap_compute_hash_value (char *name, uint32_t *phashval)
int ___idmap_compute_hash_value (char *name, uint32_t *phashval)
int idmap_add (hash_table_t *ht, char *key, unsigned int val)
int namemap_add (hash_table_t *ht, unsigned int key, char *val)
int uidgidmap_add (unsigned int key, unsigned int value)
int uidgidmap_clear ()
int idmap_clear ()
int namemap_clear ()
int uidmap_add (char *key, unsigned int val)
int unamemap_add (unsigned int key, char *val)
int gidmap_add (char *key, unsigned int val)
int gnamemap_add (unsigned int key, char *val)
int idmap_get (hash_table_t *ht, char *key, unsigned long *pval)
int namemap_get (hash_table_t *ht, unsigned int key, char *pval)
int uidgidmap_get (unsigned int key, unsigned int *pval)
int uidmap_get (char *key, unsigned long *pval)
int unamemap_get (unsigned int key, char *val)
int gidmap_get (char *key, unsigned long *pval)
int gnamemap_get (unsigned int key, char *val)
int idmap_remove (hash_table_t *ht, char *key)
int namemap_remove (hash_table_t *ht, unsigned int key)
int uidgidmap_remove (unsigned int key)
int uidmap_remove (char *key)
int unamemap_remove (unsigned int key)
int gidmap_remove (char *key)
int gnamemap_remove (unsigned int key)
int idmap_populate (char *path, idmap_type_t maptype)
void idmap_get_stats (idmap_type_t maptype, hash_stat_t *phstat, hash_stat_t *phstat_reverse)

Variables

hash_table_tht_pwnam
hash_table_tht_grnam
hash_table_tht_pwuid
hash_table_tht_grgid
hash_table_tht_uidgid

Detailed Description

Id mapping functions.

Author:
Author:
deniel
Date:
$Date$
Version:
$Revision$ idmapper_cache.c : Id mapping functions, passwd and groups cache management.

Definition in file idmapper_cache.c.


Function Documentation

int ___idmap_compute_hash_value ( char *  name,
uint32_t phashval 
)

Definition at line 298 of file idmapper_cache.c.

int compare_idmapper ( hash_buffer_t buff1,
hash_buffer_t buff2 
)

compare_idmapper: compares the values stored in the key buffers.

Compares the values 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 150 of file idmapper_cache.c.

int compare_namemapper ( hash_buffer_t buff1,
hash_buffer_t buff2 
)

Definition at line 155 of file idmapper_cache.c.

int display_idmapper_key ( hash_buffer_t pbuff,
char *  str 
)

display_idmapper_key: displays the entry key stored in the buffer.

Displays the entry key stored in the buffer. This function is to be used as 'key_to_str' field in the hashtable storing the id mapper stuff

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

Definition at line 176 of file idmapper_cache.c.

int display_idmapper_val ( hash_buffer_t pbuff,
char *  str 
)

display_idmapper_val: displays the entry key stored in the buffer.

Displays the entry key stored in the buffer. This function is to be used as 'val_to_str' field in the hashtable storing the id mapper stuff

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

Definition at line 194 of file idmapper_cache.c.

int gidmap_add ( char *  key,
unsigned int  val 
)

Definition at line 588 of file idmapper_cache.c.

int gidmap_get ( char *  key,
unsigned long *  pval 
)

Definition at line 730 of file idmapper_cache.c.

int gidmap_remove ( char *  key)

Definition at line 832 of file idmapper_cache.c.

int gnamemap_add ( unsigned int  key,
char *  val 
)

Definition at line 604 of file idmapper_cache.c.

int gnamemap_get ( unsigned int  key,
char *  val 
)

Definition at line 735 of file idmapper_cache.c.

int gnamemap_remove ( unsigned int  key)

Definition at line 837 of file idmapper_cache.c.

int idmap_add ( hash_table_t ht,
char *  key,
unsigned int  val 
)

idmap_add: Adds a value by key

Adss a value by key.

Parameters:
ht[INOUT] the hash table to be used
key[IN] the ip address requested
val[OUT] the value
Returns:
ID_MAPPER_SUCCESS, ID_MAPPER_INSERT_MALLOC_ERROR, ID_MAPPER_INVALID_ARGUMENT

Definition at line 406 of file idmapper_cache.c.

int idmap_clear ( )

Definition at line 523 of file idmapper_cache.c.

int idmap_get ( hash_table_t ht,
char *  key,
unsigned long *  pval 
)

idmap_get: gets a value by key

Gets a value by key.

Parameters:
ht[INOUT] the hash table to be used
key[IN] the ip address requested
hostname[OUT] the hostname
Returns:
ID_MAPPER_SUCCESS or ID_MAPPER_NOT_FOUND

Definition at line 633 of file idmapper_cache.c.

void idmap_get_stats ( idmap_type_t  maptype,
hash_stat_t phstat,
hash_stat_t phstat_reverse 
)

idmap_get_stats: gets the hash table statistics for the idmap et the reverse id map

Gets the hash table statistics for the idmap et the reverse idmap.

Parameters:
maptype[IN] type of the mapping to be queried (should be UIDMAP_TYPE or GIDMAP_TYPE)
phstat[OUT] pointer to the resulting stats for direct map.
phstat[OUT] pointer to the resulting stats for reverse map.
Returns:
nothing (void function)
See also:
HashTable_GetStats

Definition at line 958 of file idmapper_cache.c.

int idmap_gid_init ( nfs_idmap_cache_parameter_t  param)

idmap_gid_init: Inits the hashtable for GID mapping.

Inits the hashtable for GID mapping.

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

Definition at line 257 of file idmapper_cache.c.

int idmap_gname_init ( nfs_idmap_cache_parameter_t  param)

Definition at line 269 of file idmapper_cache.c.

int idmap_populate ( char *  path,
idmap_type_t  maptype 
)

idmap_populate_by_conf: Use the configuration file to populate the ID_MAPPER.

Use the configuration file to populate the ID_MAPPER.

Definition at line 850 of file idmapper_cache.c.

int idmap_remove ( hash_table_t ht,
char *  key 
)

idmap_remove: Tries to remove an entry for ID_MAPPER

Tries to remove an entry for ID_MAPPER

Parameters:
ht[INOUT] the hash table to be used
key[IN] the key uncached.
Returns:
the delete status

Definition at line 752 of file idmapper_cache.c.

int idmap_uid_init ( nfs_idmap_cache_parameter_t  param)

idmap_uid_init: Inits the hashtable for UID mapping.

Inits the hashtable for UID mapping.

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

Definition at line 210 of file idmapper_cache.c.

int idmap_uname_init ( nfs_idmap_cache_parameter_t  param)

Definition at line 234 of file idmapper_cache.c.

uint64_t idmapper_rbt_hash_func ( hash_parameter_t p_hparam,
hash_buffer_t buffclef 
)

idmapper_rbt_hash_func: computes the rbt value for the entry in the id mapper stuff.

Computes the rbt value for the entry in the id mapper stuff.

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 119 of file idmapper_cache.c.

uint32_t idmapper_value_hash_func ( hash_parameter_t p_hparam,
hash_buffer_t buffclef 
)

idmapper_rbt_hash_func: computes the hash value for the entry in id mapper stuff

Computes the hash value for the entry in id mapper stuff. 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 84 of file idmapper_cache.c.

int namemap_add ( hash_table_t ht,
unsigned int  key,
char *  val 
)

Definition at line 437 of file idmapper_cache.c.

int namemap_clear ( )

Definition at line 545 of file idmapper_cache.c.

int namemap_get ( hash_table_t ht,
unsigned int  key,
char *  pval 
)

Definition at line 659 of file idmapper_cache.c.

int namemap_remove ( hash_table_t ht,
unsigned int  key 
)

Definition at line 776 of file idmapper_cache.c.

uint64_t namemapper_rbt_hash_func ( hash_parameter_t p_hparam,
hash_buffer_t buffclef 
)

Definition at line 131 of file idmapper_cache.c.

uint32_t namemapper_value_hash_func ( hash_parameter_t p_hparam,
hash_buffer_t buffclef 
)

Definition at line 99 of file idmapper_cache.c.

size_t strnlen ( const char *  s,
size_t  maxlen 
)
int uidgidmap_add ( unsigned int  key,
unsigned int  value 
)

Definition at line 469 of file idmapper_cache.c.

int uidgidmap_clear ( )

Definition at line 501 of file idmapper_cache.c.

int uidgidmap_get ( unsigned int  key,
unsigned int *  pval 
)

Definition at line 686 of file idmapper_cache.c.

int uidgidmap_init ( nfs_idmap_cache_parameter_t  param)

Definition at line 222 of file idmapper_cache.c.

int uidgidmap_remove ( unsigned int  key)

Definition at line 801 of file idmapper_cache.c.

int uidmap_add ( char *  key,
unsigned int  val 
)

Definition at line 556 of file idmapper_cache.c.

int uidmap_get ( char *  key,
unsigned long *  pval 
)

Definition at line 720 of file idmapper_cache.c.

int uidmap_remove ( char *  key)

Definition at line 822 of file idmapper_cache.c.

int unamemap_add ( unsigned int  key,
char *  val 
)

Definition at line 572 of file idmapper_cache.c.

int unamemap_get ( unsigned int  key,
char *  val 
)

Definition at line 725 of file idmapper_cache.c.

int unamemap_remove ( unsigned int  key)

Definition at line 827 of file idmapper_cache.c.


Variable Documentation

Definition at line 66 of file idmapper_cache.c.

Definition at line 64 of file idmapper_cache.c.

Definition at line 63 of file idmapper_cache.c.

Definition at line 65 of file idmapper_cache.c.

Definition at line 67 of file idmapper_cache.c.