nfs-ganesha 1.4
Classes | Defines | Typedefs | Functions

nfs_file_handle.h File Reference

Prototypes for the file handle in v2, v3, v4. More...

#include <sys/types.h>
#include <sys/param.h>
#include <dirent.h>
#include <netdb.h>
#include "log.h"
#include "nfs23.h"

Go to the source code of this file.

Classes

struct  file_handle_v2
struct  alloc_file_handle_v2
struct  file_handle_v3
struct  alloc_file_handle_v3
struct  file_handle_v4
struct  alloc_file_handle_v4

Defines

#define ULTIMATE_ANSWER   0x42
#define GANESHA_FH_VERSION   ULTIMATE_ANSWER - 1
#define LEN_FH_STR   1024
#define LogHandleNFS4(label, fh4p)

Typedefs

typedef struct file_handle_v2 file_handle_v2_t
typedef struct file_handle_v3 file_handle_v3_t
typedef struct file_handle_v4 file_handle_v4_t

Functions

int nfs4_FhandleToFSAL (nfs_fh4 *pfh4, struct fsal_handle_desc *fh_desc, fsal_op_context_t *pcontext)
int nfs3_FhandleToFSAL (nfs_fh3 *pfh3, struct fsal_handle_desc *fh_desc, fsal_op_context_t *pcontext)
int nfs2_FhandleToFSAL (fhandle2 *pfh2, struct fsal_handle_desc *fh_desc, fsal_op_context_t *pcontext)
int nfs4_FSALToFhandle (nfs_fh4 *pfh4, fsal_handle_t *pfsalhandle, compound_data_t *data)
int nfs3_FSALToFhandle (nfs_fh3 *pfh3, fsal_handle_t *pfsalhandle, exportlist_t *pexport)
int nfs2_FSALToFhandle (fhandle2 *pfh2, fsal_handle_t *pfsalhandle, exportlist_t *pexport)
short nfs2_FhandleToExportId (fhandle2 *pfh2)
short nfs4_FhandleToExportId (nfs_fh4 *pfh4)
short nfs3_FhandleToExportId (nfs_fh3 *pfh3)
int nfs3_Is_Fh_Invalid (nfs_fh3 *pfh3)
int nfs4_Is_Fh_Empty (nfs_fh4 *pfh)
int nfs4_Is_Fh_Xattr (nfs_fh4 *pfh)
int nfs4_Is_Fh_Pseudo (nfs_fh4 *pfh)
int nfs4_Is_Fh_Expired (nfs_fh4 *pfh)
int nfs4_Is_Fh_Invalid (nfs_fh4 *pfh)
int nfs4_Is_Fh_Referral (nfs_fh4 *pfh)
int nfs4_Is_Fh_DSHandle (nfs_fh4 *pfh)
int nfs3_Is_Fh_Xattr (nfs_fh3 *pfh)
void print_fhandle2 (log_components_t component, fhandle2 *fh)
void print_fhandle3 (log_components_t component, nfs_fh3 *fh)
void print_fhandle4 (log_components_t component, nfs_fh4 *fh)
void print_fhandle_nlm (log_components_t component, netobj *fh)
void print_buff (log_components_t component, char *buff, int len)
void LogCompoundFH (compound_data_t *data)
void sprint_fhandle2 (char *str, fhandle2 *fh)
void sprint_fhandle3 (char *str, nfs_fh3 *fh)
void sprint_fhandle4 (char *str, nfs_fh4 *fh)
void sprint_fhandle_nlm (char *str, netobj *fh)
void sprint_buff (char *str, char *buff, int len)
void sprint_mem (char *str, char *buff, int len)
void nfs4_sprint_fhandle (nfs_fh4 *fh4p, char *outstr)

Detailed Description

Prototypes for the file handle in v2, v3, v4.

Author:
Author:
deniel
Date:
Date:
2006/01/24 11:43:15
Version:
Revision:
1.8

nfs_file_handle.h : Prototypes for the file handle in v2, v3, v4.

Definition in file nfs_file_handle.h.


Define Documentation

#define GANESHA_FH_VERSION   ULTIMATE_ANSWER - 1

Definition at line 60 of file nfs_file_handle.h.

#define LEN_FH_STR   1024

Definition at line 140 of file nfs_file_handle.h.

#define LogHandleNFS4 (   label,
  fh4p 
)
Value:
do {                                                      \
    if(isFullDebug(COMPONENT_NFS_V4))                       \
      {                                                     \
        char str[LEN_FH_STR];                               \
        sprint_fhandle4(str, fh4p);                         \
        LogFullDebug(COMPONENT_NFS_V4, "%s%s", label, str); \
      }                                                     \
  } while (0)

Definition at line 203 of file nfs_file_handle.h.

#define ULTIMATE_ANSWER   0x42

Definition at line 58 of file nfs_file_handle.h.


Typedef Documentation


Function Documentation

void LogCompoundFH ( compound_data_t data)

print_compound_fh

This routine prints all the file handle within a compoud request's data structure.

Parameters:
data[IN] compound's data to manage.
Returns:
nothing (void function).

Definition at line 909 of file nfs_filehandle_mgmt.c.

short nfs2_FhandleToExportId ( fhandle2 pfh2)

nfs2_FhandleToExportId

This routine extracts the export id from the file handle NFSv2

Parameters:
pfh2[IN] file handle to manage.
Returns:
the export id.

Definition at line 481 of file nfs_filehandle_mgmt.c.

int nfs2_FhandleToFSAL ( fhandle2 pfh2,
struct fsal_handle_desc fh_desc,
fsal_op_context_t pcontext 
)

nfs2_FhandleToFSAL: converts a nfs2 file handle to a FSAL file handle.

Converts a nfs2 file handle to a FSAL file handle.

Parameters:
pfh2[IN] pointer to the file handle to be converted
pfsalhandle[OUT] pointer to the extracted FSAL handle
Returns:
1 if successful, 0 otherwise

Definition at line 212 of file nfs_filehandle_mgmt.c.

int nfs2_FSALToFhandle ( fhandle2 pfh2,
fsal_handle_t pfsalhandle,
exportlist_t pexport 
)

nfs2_FSALToFhandle: converts a FSAL file handle to a nfs2 file handle.

Converts a nfs2 file handle to a FSAL file handle.

Parameters:
pfh2[OUT] pointer to the extracted file handle
pfsalhandle[IN] pointer to the FSAL handle to be converted
pfsalhandle[IN] pointer to the FSAL handle to be converted
Returns:
1 if successful, 0 otherwise

Definition at line 362 of file nfs_filehandle_mgmt.c.

short nfs3_FhandleToExportId ( nfs_fh3 pfh3)

nfs3_FhandleToExportId

This routine extracts the export id from the file handle NFSv3

Parameters:
pfh3[IN] file handle to manage.
Returns:
the export id.

Definition at line 440 of file nfs_filehandle_mgmt.c.

int nfs3_FhandleToFSAL ( nfs_fh3 pfh3,
struct fsal_handle_desc fh_desc,
fsal_op_context_t pcontext 
)

nfs3_FhandleToFSAL: converts a nfs3 file handle to a FSAL file handle.

Converts a nfs3 file handle to a FSAL file handle.

Parameters:
pfh3[IN] pointer to the file handle to be converted
pfsalhandle[OUT] pointer to the extracted FSAL handle
Returns:
1 if successful, 0 otherwise

Definition at line 171 of file nfs_filehandle_mgmt.c.

int nfs3_FSALToFhandle ( nfs_fh3 pfh3,
fsal_handle_t pfsalhandle,
exportlist_t pexport 
)

nfs3_FSALToFhandle: converts a FSAL file handle to a nfs3 file handle.

Converts a nfs3 file handle to a FSAL file handle.

Parameters:
pfh3[OUT] pointer to the extracted file handle
pfsalhandle[IN] pointer to the FSAL handle to be converted
pexport[IN] pointer to the export list entry the FH belongs to
Returns:
1 if successful, 0 otherwise

FIXME: do we have to worry about buffer alignment and memcpy to compensate??

Definition at line 312 of file nfs_filehandle_mgmt.c.

int nfs3_Is_Fh_Invalid ( nfs_fh3 pfh3)

nfs3_Is_Fh_Invalid

This routine is used to test if a fh is invalid.

Parameters:
pfh[IN] file handle to test.
Returns:
NFS4_OK if successfull.

Definition at line 686 of file nfs_filehandle_mgmt.c.

int nfs3_Is_Fh_Xattr ( nfs_fh3 pfh)

nfs4_Is_Fh_Xattr

This routine is used to test is a fh refers to a Xattr related stuff

Parameters:
pfh[IN] file handle to test.
Returns:
TRUE if in pseudo fh, FALSE otherwise

Definition at line 504 of file nfs_filehandle_mgmt.c.

short nfs4_FhandleToExportId ( nfs_fh4 pfh4)

nfs4_FhandleToExportId

This routine extracts the export id from the file handle NFSv4

Parameters:
pfh4[IN] file handle to manage.
Returns:
the export id.

Definition at line 417 of file nfs_filehandle_mgmt.c.

int nfs4_FhandleToFSAL ( nfs_fh4 pfh4,
struct fsal_handle_desc fh_desc,
fsal_op_context_t pcontext 
)

nfs4_FhandleToFSAL: converts a nfs4 file handle to a FSAL file handle.

Validates and Converts a nfs4 file handle to a FSAL file handle.

Parameters:
pfh4[IN] pointer to the file handle to be converted
fh_desc[OUT] extracted handle descriptor
Returns:
1 if successful, 0 otherwise

Definition at line 128 of file nfs_filehandle_mgmt.c.

int nfs4_FSALToFhandle ( nfs_fh4 pfh4,
fsal_handle_t pfsalhandle,
compound_data_t data 
)

nfs4_FSALToFhandle: converts a FSAL file handle to a nfs4 file handle.

Converts a nfs4 file handle to a FSAL file handle.

Parameters:
pfh4[OUT] pointer to the extracted file handle
pfsalhandle[IN] pointer to the FSAL handle to be converted
data[IN] pointer to NFSv4 compound data structure.
Returns:
1 if successful, 0 otherwise

Definition at line 255 of file nfs_filehandle_mgmt.c.

int nfs4_Is_Fh_DSHandle ( nfs_fh4 pfh)

nfs4_Is_Fh_DSHandle

This routine is used to test if a fh is a DS fh

Parameters:
pfh[IN] file handle to test.
Returns:
TRUE if DS fh, FALSE otherwise

Definition at line 595 of file nfs_filehandle_mgmt.c.

int nfs4_Is_Fh_Empty ( nfs_fh4 pfh)

nfs4_Is_Fh_Empty

This routine is used to test if a fh is empty (contains no data).

Parameters:
pfh[IN] file handle to test.
Returns:
NFS4_OK if successfull, NFS4ERR_NOFILEHANDLE is fh is empty.

Definition at line 527 of file nfs_filehandle_mgmt.c.

int nfs4_Is_Fh_Expired ( nfs_fh4 pfh)

nfs4_Is_Fh_Expired

This routine is used to test if a fh is expired

Parameters:
pfh[IN] file handle to test.
Returns:
NFS4_OK if successfull. All the FH are persistent for now.

Definition at line 618 of file nfs_filehandle_mgmt.c.

int nfs4_Is_Fh_Invalid ( nfs_fh4 pfh)

nfs4_Is_Fh_Invalid

This routine is used to test if a fh is invalid.

Parameters:
pfh[IN] file handle to test.
Returns:
NFS4_OK if successfull.

Definition at line 648 of file nfs_filehandle_mgmt.c.

int nfs4_Is_Fh_Pseudo ( nfs_fh4 pfh)

nfs4_Is_Fh_Pseudo

This routine is used to test if a fh refers to pseudo fs

Parameters:
pfh[IN] file handle to test.
Returns:
TRUE if in pseudo fh, FALSE otherwise

Definition at line 572 of file nfs_filehandle_mgmt.c.

int nfs4_Is_Fh_Referral ( nfs_fh4 pfh)

nfs4_Is_Fh_Referral

This routine is used to identify fh related to a pure referral

Parameters:
pfh[IN] file handle to test.
Returns:
TRUE is fh is a referral, FALSE otherwise

Definition at line 724 of file nfs_filehandle_mgmt.c.

int nfs4_Is_Fh_Xattr ( nfs_fh4 pfh)

nfs4_Is_Fh_Xattr

This routine is used to test is a fh refers to a Xattr related stuff

Parameters:
pfh[IN] file handle to test.
Returns:
TRUE if in pseudo fh, FALSE otherwise

Definition at line 549 of file nfs_filehandle_mgmt.c.

void nfs4_sprint_fhandle ( nfs_fh4 fh4p,
char *  outstr 
)

nfs4_sprint_fhandle : converts a file handle v4 to a string.

Converts a file handle v4 to a string. This will be used mostly for debugging purpose.

Parameters:
fh4p[OUT] pointer to the file handle to be converted to a string.
data[INOUT] pointer to the char * resulting from the operation.
Returns:
nothing (void function).

Definition at line 941 of file nfs_filehandle_mgmt.c.

void print_buff ( log_components_t  component,
char *  buff,
int  len 
)

print_buff

This routine prints the content of a buffer.

Parameters:
buff[IN] buffer to print.
len[IN] length of the buffer.
Returns:
nothing (void function).

Definition at line 870 of file nfs_filehandle_mgmt.c.

void print_fhandle2 ( log_components_t  component,
fhandle2 fh 
)

print_fhandle2

This routine prints a NFSv2 file handle (for debugging purpose)

Parameters:
fh[IN] file handle to print.
Returns:
nothing (void function).

Definition at line 753 of file nfs_filehandle_mgmt.c.

void print_fhandle3 ( log_components_t  component,
nfs_fh3 fh 
)

print_fhandle3

This routine prints a NFSv3 file handle (for debugging purpose)

Parameters:
fh[IN] file handle to print.
Returns:
nothing (void function).

Definition at line 782 of file nfs_filehandle_mgmt.c.

void print_fhandle4 ( log_components_t  component,
nfs_fh4 fh 
)

print_fhandle4

This routine prints a NFSv4 file handle (for debugging purpose)

Parameters:
fh[IN] file handle to print.
Returns:
nothing (void function).

Definition at line 811 of file nfs_filehandle_mgmt.c.

void print_fhandle_nlm ( log_components_t  component,
netobj *  fh 
)

print_fhandle_nlm

This routine prints a NFSv3 file handle (for debugging purpose)

Parameters:
fh[IN] file handle to print.
Returns:
nothing (void function).

Definition at line 840 of file nfs_filehandle_mgmt.c.

void sprint_buff ( char *  str,
char *  buff,
int  len 
)

Definition at line 881 of file nfs_filehandle_mgmt.c.

void sprint_fhandle2 ( char *  str,
fhandle2 fh 
)

Definition at line 764 of file nfs_filehandle_mgmt.c.

void sprint_fhandle3 ( char *  str,
nfs_fh3 fh 
)

Definition at line 793 of file nfs_filehandle_mgmt.c.

void sprint_fhandle4 ( char *  str,
nfs_fh4 fh 
)

Definition at line 822 of file nfs_filehandle_mgmt.c.

void sprint_fhandle_nlm ( char *  str,
netobj *  fh 
)

Definition at line 851 of file nfs_filehandle_mgmt.c.

void sprint_mem ( char *  str,
char *  buff,
int  len 
)

Definition at line 888 of file nfs_filehandle_mgmt.c.