nfs-ganesha 1.4
Defines | Functions

nfs_proto_tools.h File Reference

#include <stdio.h>
#include <string.h>
#include <pthread.h>
#include <fcntl.h>
#include <sys/file.h>
#include "HashData.h"
#include "HashTable.h"
#include "log.h"
#include "ganesha_rpc.h"
#include "nfs23.h"
#include "nfs4.h"
#include "mount.h"
#include "cache_inode.h"
#include "nfs_tools.h"
#include "nfs_creds.h"
#include "nfs_file_handle.h"

Go to the source code of this file.

Defines

#define NFS2_MODE_NFDIR   0040000
#define NFS2_MODE_NFCHR   0020000
#define NFS2_MODE_NFBLK   0060000
#define NFS2_MODE_NFREG   0100000
#define NFS2_MODE_NFLNK   0120000
#define NFS2_MODE_NFNON   0140000

Functions

uint64_t nfs_htonl64 (uint64_t arg64)
uint64_t nfs_ntohl64 (uint64_t arg64)
void nfs_FhandleToStr (u_long rq_vers, fhandle2 *pfh2, nfs_fh3 *pfh3, nfs_fh4 *pfh4, char *str)
cache_entry_tnfs_FhandleToCache (u_long rq_vers, fhandle2 *pfh2, nfs_fh3 *pfh3, nfs_fh4 *pfh4, nfsstat2 *pstatus2, nfsstat3 *pstatus3, nfsstat4 *pstatus4, fsal_attrib_list_t *pattr, fsal_op_context_t *pcontext, int *prc)
void nfs_SetWccData (exportlist_t *pexport, fsal_attrib_list_t *pbefore_attr, fsal_attrib_list_t *pafter_attr, wcc_data *pwcc_data)
int nfs_SetPostOpAttr (exportlist_t *pexport, const fsal_attrib_list_t *pfsal_attr, post_op_attr *presult)
int nfs_SetPostOpXAttrDir (fsal_op_context_t *pcontext, exportlist_t *pexport, fsal_attrib_list_t *pfsal_attr, post_op_attr *presult)
int nfs_SetPostOpXAttrFile (fsal_op_context_t *pcontext, exportlist_t *pexport, fsal_attrib_list_t *pfsal_attr, post_op_attr *presult)
void nfs_SetPreOpAttr (fsal_attrib_list_t *pfsal_attr, pre_op_attr *pattr)
int nfs_RetryableError (cache_inode_status_t cache_status)
int nfs3_Sattr_To_FSAL_attr (fsal_attrib_list_t *pFSALattr, sattr3 *psattr)
void nfs_SetFailedStatus (fsal_op_context_t *pcontext, exportlist_t *pexport, int version, cache_inode_status_t status, nfsstat2 *pstatus2, nfsstat3 *pstatus3, cache_entry_t *pentry0, post_op_attr *ppost_op_attr, cache_entry_t *pentry1, fsal_attrib_list_t *ppre_vattr1, wcc_data *pwcc_data1, cache_entry_t *pentry2, fsal_attrib_list_t *ppre_vattr2, wcc_data *pwcc_data2)
fsal_accessflags_t nfs_get_access_mask (uint32_t op, fsal_attrib_list_t *pattr)
void nfs3_access_debug (char *label, uint32_t access)
void nfs4_access_debug (char *label, uint32_t access, fsal_aceperm_t v4mask)
void nfs4_Fattr_Free (fattr4 *fattr)
nfsstat4 nfs4_sanity_check_FH (compound_data_t *data, cache_inode_file_type_t required_type)

Define Documentation

#define NFS2_MODE_NFBLK   0060000

Definition at line 62 of file nfs_proto_tools.h.

#define NFS2_MODE_NFCHR   0020000

Definition at line 61 of file nfs_proto_tools.h.

#define NFS2_MODE_NFDIR   0040000

Definition at line 60 of file nfs_proto_tools.h.

#define NFS2_MODE_NFLNK   0120000

Definition at line 64 of file nfs_proto_tools.h.

#define NFS2_MODE_NFNON   0140000

Definition at line 65 of file nfs_proto_tools.h.

#define NFS2_MODE_NFREG   0100000

Definition at line 63 of file nfs_proto_tools.h.


Function Documentation

void nfs3_access_debug ( char *  label,
uint32_t  access 
)

Definition at line 4322 of file nfs_proto_tools.c.

int nfs3_Sattr_To_FSAL_attr ( fsal_attrib_list_t pFSALattr,
sattr3 psattr 
)
void nfs4_access_debug ( char *  label,
uint32_t  access,
fsal_aceperm_t  v4mask 
)

Definition at line 4334 of file nfs_proto_tools.c.

void nfs4_Fattr_Free ( fattr4 fattr)

Definition at line 786 of file nfs_proto_tools.c.

nfsstat4 nfs4_sanity_check_FH ( compound_data_t data,
cache_inode_file_type_t  required_type 
)

nfs4_sanity_check_FH: Do basic checks on a filehandle

This function performs basic checks to make sure the supplied filehandle is sane for a given operation.

Parameters:
data[IN] Compound_data_t for the operation to check
required_type[IN] The file type this operation requires. Set to 0 to allow any type.
Returns:
NFSv4.1 status codes

Definition at line 4377 of file nfs_proto_tools.c.

cache_entry_t* nfs_FhandleToCache ( u_long  rq_vers,
fhandle2 pfh2,
nfs_fh3 pfh3,
nfs_fh4 pfh4,
nfsstat2 pstatus2,
nfsstat3 pstatus3,
nfsstat4 pstatus4,
fsal_attrib_list_t pattr,
fsal_op_context_t pcontext,
int *  prc 
)

nfs_FhandleToCache: Gets a cache entry using a file handle (v2/3/4) as input.

Gets a cache entry using a file handle (v2/3/4) as input.

If a cache entry is returned, its refcount is +1.

Parameters:
rq_vers[IN] version of the NFS protocol to be used
pfh2[IN] NFSv2 file handle or NULL
pfh3[IN] NFSv3 file handle or NULL
pfh4[IN] NFSv4 file handle or NULL
pstatus2[OUT] pointer to NFSv2 status or NULL
pstatus3[OUT] pointer to NFSv3 status or NULL
pstatus4[OUT] pointer to NFSv4 status or NULL
pattr[OUT] FSAL attributes related to this cache entry
pcontext[IN] client's FSAL credentials
pclient[IN] client's ressources to be used for accessing the Cache Inode
prc[OUT] internal status for the request (NFS_REQ_DROP or NFS_REQ_OK)
Returns:
a pointer to the related pentry if successful, NULL is returned in case of a failure.

Definition at line 194 of file nfs_proto_tools.c.

void nfs_FhandleToStr ( u_long  rq_vers,
fhandle2 pfh2,
nfs_fh3 pfh3,
nfs_fh4 pfh4,
char *  str 
)

nfs_FhandleToStr: Converts a file handle to a string representation.

Converts a file handle to a string representation.

Parameters:
rq_vers[IN] version of the NFS protocol to be used
pfh2[IN] NFSv2 file handle or NULL
pfh3[IN] NFSv3 file handle or NULL
pfh4[IN] NFSv4 file handle or NULL
str[OUT] string version of handle

Definition at line 148 of file nfs_proto_tools.c.

fsal_accessflags_t nfs_get_access_mask ( uint32_t  op,
fsal_attrib_list_t pattr 
)

Definition at line 4266 of file nfs_proto_tools.c.

int nfs_RetryableError ( cache_inode_status_t  cache_status)

nfs_RetryableError: Indicates if an error is retryable or not.

Indicates if an error is retryable or not.

Parameters:
cache_status[IN] input Cache Inode Status value, to be tested.
Returns:
TRUE if retryable, FALSE otherwise.
Todo:
: Not implemented for NOW BUGAZEOMEU

Definition at line 408 of file nfs_proto_tools.c.

void nfs_SetFailedStatus ( fsal_op_context_t pcontext,
exportlist_t pexport,
int  version,
cache_inode_status_t  status,
nfsstat2 pstatus2,
nfsstat3 pstatus3,
cache_entry_t pentry0,
post_op_attr ppost_op_attr,
cache_entry_t pentry1,
fsal_attrib_list_t ppre_vattr1,
wcc_data pwcc_data1,
cache_entry_t pentry2,
fsal_attrib_list_t ppre_vattr2,
wcc_data pwcc_data2 
)

Definition at line 510 of file nfs_proto_tools.c.

int nfs_SetPostOpAttr ( exportlist_t pexport,
const fsal_attrib_list_t pfsal_attr,
post_op_attr presult 
)

nfs_SetPostOpAttr: Converts FSAL Attributes to NFSv3 PostOp Attributes structure.

Converts FSAL Attributes to NFSv3 PostOp Attributes structure.

Parameters:
pexport[IN] the related export entry
pfsal_attr[IN] FSAL attributes
pattr[OUT] NFSv3 PostOp structure attributes.

Definition at line 315 of file nfs_proto_tools.c.

int nfs_SetPostOpXAttrDir ( fsal_op_context_t pcontext,
exportlist_t pexport,
fsal_attrib_list_t pfsal_attr,
post_op_attr presult 
)

nfs_SetPostOpAttrDir: Converts FSAL Attributes to NFSv3 PostOp Attributes structure.

Converts FSAL Attributes to NFSv3 PostOp Attributes structure.

Parameters:
pexport[IN] the related export entry
pfsal_attr[IN] FSAL attributes
pattr[OUT] NFSv3 PostOp structure attributes.
Returns:
0 in all cases (making it a void function maybe a good idea)

Definition at line 212 of file nfs_xattr.c.

int nfs_SetPostOpXAttrFile ( fsal_op_context_t pcontext,
exportlist_t pexport,
fsal_attrib_list_t pfsal_attr,
post_op_attr presult 
)

nfs_SetPostOpAttrDir: Converts FSAL Attributes to NFSv3 PostOp Attributes structure.

Converts FSAL Attributes to NFSv3 PostOp Attributes structure.

Parameters:
pexport[IN] the related export entry
pfsal_attr[IN] FSAL attributes for xattr
pattr[OUT] NFSv3 PostOp structure attributes.
Returns:
0 in all cases (making it a void function maybe a good idea)

Definition at line 244 of file nfs_xattr.c.

void nfs_SetPreOpAttr ( fsal_attrib_list_t pfsal_attr,
pre_op_attr pattr 
)

nfs_SetPreOpAttr: Converts FSAL Attributes to NFSv3 PreOp Attributes structure.

Converts FSAL Attributes to NFSv3 PreOp Attributes structure.

Parameters:
pfsal_attr[IN] FSAL attributes.
pattr[OUT] NFSv3 PreOp structure attributes.
Returns:
nothing (void function)

Definition at line 350 of file nfs_proto_tools.c.

void nfs_SetWccData ( exportlist_t pexport,
fsal_attrib_list_t pbefore_attr,
fsal_attrib_list_t pafter_attr,
wcc_data pwcc_data 
)

nfs_SetWccData: Sets NFSv3 Weak Cache Coherency structure.

Sets NFSv3 Weak Cache Coherency structure.

Parameters:
pexport[IN] export entry
pentry[IN] related pentry
pbefore_attr[IN] the attributes before the operation.
pafter_attr[IN] the attributes after the operation
pwcc_data[OUT] the Weak Cache Coherency structure
Returns:
nothing (void function).

Definition at line 384 of file nfs_proto_tools.c.