nfs-ganesha 1.4
Defines | Functions

fsal_tools.c File Reference

#include "fsal.h"
#include "fsal_internal.h"
#include "fsal_convert.h"
#include "config_parsing.h"
#include <string.h>

Go to the source code of this file.

Defines

#define STRCMP   strcasecmp
#define low32m(a)   ( (unsigned int)a )

Functions

char * CEPHFSAL_GetFSName ()
int CEPHFSAL_handlecmp (fsal_handle_t *exthandle1, fsal_handle_t *exthandle2, fsal_status_t *status)
 Compare 2 handles.
unsigned int CEPHFSAL_Handle_to_HashIndex (fsal_handle_t *exthandle, unsigned int cookie, unsigned int alphabet_len, unsigned int index_size)
 Generate an index in the handle table.
unsigned int CEPHFSAL_Handle_to_RBTIndex (fsal_handle_t *exthandle, unsigned int cookie)
 Generate a hash to locate the handle within a tree.
fsal_status_t CEPHFSAL_DigestHandle (fsal_export_context_t *extexport, fsal_digesttype_t output_type, fsal_handle_t *exthandle, struct fsal_handle_desc *fh_desc)
 Create a wire level representation of an FSAL handle.
fsal_status_t CEPHFSAL_ExpandHandle (fsal_export_context_t *extexport, fsal_digesttype_t in_type, struct fsal_handle_desc *fh_desc)
 Bring in a wire handle.
fsal_status_t CEPHFSAL_SetDefault_FSAL_parameter (fsal_parameter_t *out_parameter)
fsal_status_t CEPHFSAL_SetDefault_FS_common_parameter (fsal_parameter_t *out_parameter)
fsal_status_t CEPHFSAL_SetDefault_FS_specific_parameter (fsal_parameter_t *out_parameter)
fsal_status_t CEPHFSAL_load_FSAL_parameter_from_conf (config_file_t in_config, fsal_parameter_t *out_parameter)
fsal_status_t CEPHFSAL_load_FS_common_parameter_from_conf (config_file_t in_config, fsal_parameter_t *out_parameter)
fsal_status_t CEPHFSAL_load_FS_specific_parameter_from_conf (config_file_t in_config, fsal_parameter_t *out_parameter)

Define Documentation

#define low32m (   a)    ( (unsigned int)a )

Definition at line 46 of file FSAL_CEPH/fsal_tools.c.

#define STRCMP   strcasecmp

Definition at line 45 of file FSAL_CEPH/fsal_tools.c.


Function Documentation

fsal_status_t CEPHFSAL_DigestHandle ( fsal_export_context_t extexport,
fsal_digesttype_t  output_type,
fsal_handle_t exthandle,
struct fsal_handle_desc fh_desc 
)

Create a wire level representation of an FSAL handle.

Convert an fsal_handle_t to a buffer to be included into NFS handles, or another digest.

Parameters:
extexport[in] The export context
output_type[in] The type of digest requested
exthandle[in] The handle to be digested
fh_desc[out] Counted buffer to hold the handle
Returns:
Errors as appropriate

Definition at line 154 of file FSAL_CEPH/fsal_tools.c.

fsal_status_t CEPHFSAL_ExpandHandle ( fsal_export_context_t extexport,
fsal_digesttype_t  in_type,
struct fsal_handle_desc fh_desc 
)

Bring in a wire handle.

All we do here is adjust the descriptor length based on knowing the internals of struct file_handle and let the upper level handle memcpy, hash lookup and/or compare. No copies anymore.

Parameters:
extexport[in] The export handle
in_type[in] The type of digest to be expanded
fh_desc[in,out] Descriptor for buffer
Returns:
The major code is ERR_FSAL_NO_ERROR is no error occured. Else, it is a non null value.

Definition at line 223 of file FSAL_CEPH/fsal_tools.c.

char* CEPHFSAL_GetFSName ( )

Definition at line 48 of file FSAL_CEPH/fsal_tools.c.

unsigned int CEPHFSAL_Handle_to_HashIndex ( fsal_handle_t exthandle,
unsigned int  cookie,
unsigned int  alphabet_len,
unsigned int  index_size 
)

Generate an index in the handle table.

This function is used for hashing a FSAL handle in order to distribute entries into the hash table array.

Parameters:
exthandle[in] The handle to be hashed
cookie[in] Makes it possible to have different hash value for the same handle, when cookie changes.
alphabet_len[in] Parameter for polynomial hashing algorithm
index_size[in] The range of hash value will be [0..index_size-1]
Returns:
The hash value

Definition at line 105 of file FSAL_CEPH/fsal_tools.c.

unsigned int CEPHFSAL_Handle_to_RBTIndex ( fsal_handle_t exthandle,
unsigned int  cookie 
)

Generate a hash to locate the handle within a tree.

This function is used for generating a RBT node ID in order to identify entries into the RBT.

Parameters:
exthandle[in] The handle to be hashed
cookie[in] Makes it possible to have different hash value for the same handle, when cookie changes.
Returns:
The hash value

Definition at line 131 of file FSAL_CEPH/fsal_tools.c.

int CEPHFSAL_handlecmp ( fsal_handle_t exthandle1,
fsal_handle_t exthandle2,
fsal_status_t status 
)

Compare 2 handles.

This function compares two FSAL handles, returning 0 if they are to be considered identical.

Parameters:
handle1[in] The first handle to be compared
handle2[in] The second handle to be compared
status[out] Status of the compare operation
Return values:
0if handles are the same
Somethingelse if they're not

Definition at line 68 of file FSAL_CEPH/fsal_tools.c.

fsal_status_t CEPHFSAL_load_FS_common_parameter_from_conf ( config_file_t  in_config,
fsal_parameter_t out_parameter 
)

Definition at line 428 of file FSAL_CEPH/fsal_tools.c.

fsal_status_t CEPHFSAL_load_FS_specific_parameter_from_conf ( config_file_t  in_config,
fsal_parameter_t out_parameter 
)

Definition at line 653 of file FSAL_CEPH/fsal_tools.c.

fsal_status_t CEPHFSAL_load_FSAL_parameter_from_conf ( config_file_t  in_config,
fsal_parameter_t out_parameter 
)

FSAL_load_FSAL_parameter_from_conf, FSAL_load_FS_common_parameter_from_conf, FSAL_load_FS_specific_parameter_from_conf:

Those functions initialize the FSAL init parameter structure from a configuration structure.

Parameters:
in_config(input): Structure that represents the parsed configuration file.
out_parameter(ouput) FSAL initialization structure filled according to the configuration file given as parameter.
Returns:
ERR_FSAL_NO_ERROR (no error) , ERR_FSAL_NOENT (missing a mandatory stanza in config file), ERR_FSAL_INVAL (invalid parameter), ERR_FSAL_SERVERFAULT (unexpected error) ERR_FSAL_FAULT (null pointer given as parameter),

Definition at line 355 of file FSAL_CEPH/fsal_tools.c.

fsal_status_t CEPHFSAL_SetDefault_FS_common_parameter ( fsal_parameter_t out_parameter)

Definition at line 284 of file FSAL_CEPH/fsal_tools.c.

fsal_status_t CEPHFSAL_SetDefault_FS_specific_parameter ( fsal_parameter_t out_parameter)

Definition at line 320 of file FSAL_CEPH/fsal_tools.c.

fsal_status_t CEPHFSAL_SetDefault_FSAL_parameter ( fsal_parameter_t out_parameter)

Those routines set the default parameters for FSAL init structure.

Returns:
ERR_FSAL_NO_ERROR (no error), ERR_FSAL_FAULT (null pointer given as parameter), ERR_FSAL_SERVERFAULT (unexpected error)

Definition at line 272 of file FSAL_CEPH/fsal_tools.c.