nfs-ganesha 1.4
Defines | Functions | Variables

nfs_proto_tools.c File Reference

A set of functions used to managed NFS. More...

#include <stdio.h>
#include <string.h>
#include <pthread.h>
#include <fcntl.h>
#include <sys/file.h>
#include <pwd.h>
#include <grp.h>
#include <stdint.h>
#include "HashData.h"
#include "HashTable.h"
#include "log.h"
#include "ganesha_rpc.h"
#include "nfs23.h"
#include "nfs4.h"
#include "mount.h"
#include "nfs_core.h"
#include "cache_inode.h"
#include "nfs_exports.h"
#include "nfs_creds.h"
#include "nfs_proto_functions.h"
#include "nfs_tools.h"
#include "nfs_file_handle.h"
#include "nfs_proto_tools.h"
#include "nfs4_acls.h"

Go to the source code of this file.

Defines

#define MAXATTR   FATTR4_MOUNTED_ON_FILEID

Functions

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)
int nfs_SetPostOpAttr (exportlist_t *pexport, const fsal_attrib_list_t *pfsal_attr, post_op_attr *presult)
void nfs_SetPreOpAttr (fsal_attrib_list_t *pfsal_attr, pre_op_attr *pattr)
void nfs_SetWccData (exportlist_t *pexport, fsal_attrib_list_t *pbefore_attr, fsal_attrib_list_t *pafter_attr, wcc_data *pwcc_data)
int nfs_RetryableError (cache_inode_status_t cache_status)
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)
void nfs4_Fattr_Free (fattr4 *fattr)
int nfs4_supported_attrs_to_fattr (char *attrvalsBuffer)
int nfs4_Fattr_Fill (fattr4 *Fattr, int cnt, uint32_t *attrvalslist, int LastOffset, char *attrvalsBuffer)
int nfs4_FSALattr_To_Fattr (exportlist_t *pexport, fsal_attrib_list_t *pattr, fattr4 *Fattr, compound_data_t *data, nfs_fh4 *objFH, bitmap4 *Bitmap)
int nfs3_Sattr_To_FSALattr (fsal_attrib_list_t *pFSAL_attr, sattr3 *psattr)
int nfs2_FSALattr_To_Fattr (exportlist_t *pexport, fsal_attrib_list_t *pFSAL_attr, fattr2 *pFattr)
int nfs4_SetCompoundExport (compound_data_t *data)
int nfs4_FhandleToExId (nfs_fh4 *fh4p, unsigned short *ExIdp)
void nfs4_stringid_split (char *buff, char *uidname, char *domainname)
void free_utf8 (utf8string *utf8str)
int utf8dup (utf8string *newstr, utf8string *oldstr)
int utf82str (char *str, int size, utf8string *utf8str)
int str2utf8 (char *str, utf8string *utf8str)
seqid4 nfs4_NextSeqId (seqid4 seqid)
void nfs4_bitmap4_to_list (bitmap4 *b, uint_t *plen, uint32_t *pval)
void nfs4_list_to_bitmap4 (bitmap4 *b, uint_t plen, uint32_t *pval)
int nfs3_FSALattr_To_PartialFattr (const fsal_attrib_list_t *FSAL_attr, fsal_attrib_mask_t want, fattr3 *Fattr)
int nfs3_FSALattr_To_Fattr (exportlist_t *pexport, const fsal_attrib_list_t *FSAL_attr, fattr3 *Fattr)
int nfs2_Sattr_To_FSALattr (fsal_attrib_list_t *pFSAL_attr, sattr2 *Fattr)
int nfs4_Fattr_Check_Access (fattr4 *Fattr, int access)
int nfs4_Fattr_Check_Access_Bitmap (bitmap4 *pbitmap, int access)
int nfs4_bitmap4_Remove_Unsupported (bitmap4 *pbitmap)
int nfs4_Fattr_Supported (fattr4 *Fattr)
int nfs4_Fattr_Supported_Bitmap (bitmap4 *pbitmap)
int nfs4_Fattr_cmp (fattr4 *Fattr1, fattr4 *Fattr2)
int nfs4_attrmap_to_FSAL_attrmask (bitmap4 attrmap, fsal_attrib_mask_t *attrmask)
int Fattr4_To_FSAL_attr (fsal_attrib_list_t *pFSAL_attr, fattr4 *Fattr, nfs_fh4 *hdl4)
int nfs4_Fattr_To_FSAL_attr (fsal_attrib_list_t *pFSAL_attr, fattr4 *Fattr)
nfsstat4 nfs4_Errno (cache_inode_status_t error)
nfsstat3 nfs3_Errno (cache_inode_status_t error)
nfsstat2 nfs2_Errno (cache_inode_status_t error)
int nfs3_AllocateFH (nfs_fh3 *fh)
int nfs4_AllocateFH (nfs_fh4 *fh)
int nfs4_MakeCred (compound_data_t *data)
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)
nfsstat4 nfs4_sanity_check_FH (compound_data_t *data, cache_inode_file_type_t required_type)

Variables

char * nfsv2_function_names []
char * nfsv3_function_names []
char * nfsv4_function_names []
char * mnt_function_names []
char * rquota_functions_names []

Detailed Description

A set of functions used to managed NFS.

Author:
Author:
leibovic
Date:
Date:
2006/01/31 10:06:00
Version:
Revision:
1.48

nfs_proto_tools.c - A set of functions used to managed NFS.

Definition in file nfs_proto_tools.c.


Define Documentation

#define MAXATTR   FATTR4_MOUNTED_ON_FILEID

Function Documentation

void nfs3_access_debug ( char *  label,
uint32_t  access 
)

Definition at line 4322 of file nfs_proto_tools.c.

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.

int nfs4_FhandleToExId ( nfs_fh4 fh4p,
unsigned short *  ExIdp 
)

nfs4_FhandleToExId

This routine extracts the export id from the filehandle

Parameters:
fh4p[IN] pointer to file handle to be used.
ExIdp[OUT] pointer to buffer in which found export id will be stored.
Returns:
TRUE is successful, FALSE otherwise.

Definition at line 2033 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.

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.


Variable Documentation

Initial value:
 {
  "MNT_null", "MNT_mount", "MNT_dump", "MNT_umount", "MNT_umountall", "MNT_export"
}

Definition at line 126 of file nfs_proto_tools.c.

Initial value:
 {
  "NFSv2_null", "NFSv2_getattr", "NFSv2_setattr", "NFSv2_root",
  "NFSv2_lookup", "NFSv2_readlink", "NFSv2_read", "NFSv2_writecache",
  "NFSv2_write", "NFSv2_create", "NFSv2_remove", "NFSv2_rename",
  "NFSv2_link", "NFSv2_symlink", "NFSv2_mkdir", "NFSv2_rmdir",
  "NFSv2_readdir", "NFSv2_statfs"
}

Definition at line 105 of file nfs_proto_tools.c.

Initial value:
 {
  "NFSv3_null", "NFSv3_getattr", "NFSv3_setattr", "NFSv3_lookup",
  "NFSv3_access", "NFSv3_readlink", "NFSv3_read", "NFSv3_write",
  "NFSv3_create", "NFSv3_mkdir", "NFSv3_symlink", "NFSv3_mknod",
  "NFSv3_remove", "NFSv3_rmdir", "NFSv3_rename", "NFSv3_link",
  "NFSv3_readdir", "NFSv3_readdirplus", "NFSv3_fsstat",
  "NFSv3_fsinfo", "NFSv3_pathconf", "NFSv3_commit"
}

Definition at line 113 of file nfs_proto_tools.c.

Initial value:
 {
  "NFSv4_null", "NFSv4_compound"
}

Definition at line 122 of file nfs_proto_tools.c.

Initial value:
 {
  "rquota_Null", "rquota_getquota", "rquota_getquotaspecific", "rquota_setquota",
  "rquota_setquotaspecific"
}

Definition at line 130 of file nfs_proto_tools.c.