nfs-ganesha 1.4
|
Some tools for managing the file handles. More...
#include <stdio.h>
#include <sys/types.h>
#include <ctype.h>
#include <stdlib.h>
#include <dirent.h>
#include <netdb.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <string.h>
#include <pthread.h>
#include <fcntl.h>
#include <sys/file.h>
#include <pwd.h>
#include <grp.h>
#include "log.h"
#include "ganesha_rpc.h"
#include "nfs_core.h"
#include "nfs23.h"
#include "nfs4.h"
#include "fsal.h"
#include "nfs_tools.h"
#include "nfs_exports.h"
#include "nfs_file_handle.h"
Go to the source code of this file.
Some tools for managing the file handles.
nfs_filehandle_mgmt.c : Some tools for managing the file handles.
Revision 1.12 2006/01/24 11:43:05 deniel Code cleaning in progress
Revision 1.11 2006/01/11 08:12:18 deniel Added bug track and warning for badly formed handles
Revision 1.9 2005/09/07 08:58:30 deniel NFSv2 FH was only 31 byte long instead of 32
Revision 1.8 2005/09/07 08:16:07 deniel The checksum is filled with zeros before being computed to avoid 'dead beef' values
Revision 1.7 2005/08/11 12:37:28 deniel Added statistics management
Revision 1.6 2005/08/09 12:35:37 leibovic setting file_handle to 0 in nfs3_FSALToFhandle, before writting into it.
Revision 1.5 2005/08/08 14:09:25 leibovic setting checksum to 0 before writting in it.
Revision 1.4 2005/08/04 08:34:32 deniel memset management was badly made
Revision 1.3 2005/08/03 13:23:43 deniel Possible incoherency in CVS or in Emacs
Revision 1.2 2005/08/03 13:13:59 deniel memset to zero before building the filehandles
Revision 1.1 2005/08/03 06:57:54 deniel Added a libsupport for miscellaneous service functions
Revision 1.4 2005/07/28 12:26:57 deniel NFSv3 PROTOCOL Ok
Revision 1.3 2005/07/26 07:39:15 deniel Integration of NFSv2/NFSv3 In progress
Revision 1.2 2005/07/21 09:18:42 deniel Structure of the file handles was redefined
Revision 1.1 2005/07/20 12:56:54 deniel Reorganisation of the source files
Definition in file nfs_filehandle_mgmt.c.
void LogCompoundFH | ( | compound_data_t * | data | ) |
print_compound_fh
This routine prints all the file handle within a compoud request's data structure.
data | [IN] compound's data to manage. |
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
pfh2 | [IN] file handle to manage. |
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.
pfh2 | [IN] pointer to the file handle to be converted |
pfsalhandle | [OUT] pointer to the extracted FSAL handle |
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.
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 |
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
pfh3 | [IN] file handle to manage. |
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.
pfh3 | [IN] pointer to the file handle to be converted |
pfsalhandle | [OUT] pointer to the extracted FSAL handle |
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.
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 |
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.
pfh | [IN] file handle to test. |
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
pfh | [IN] file handle to test. |
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
pfh4 | [IN] file handle to manage. |
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.
pfh4 | [IN] pointer to the file handle to be converted |
fh_desc | [OUT] extracted handle descriptor |
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.
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. |
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
pfh | [IN] file handle to test. |
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).
pfh | [IN] file handle to test. |
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
pfh | [IN] file handle to test. |
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.
pfh | [IN] file handle to test. |
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
pfh | [IN] file handle to test. |
Definition at line 572 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
pfh | [IN] file handle to test. |
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.
fh4p | [OUT] pointer to the file handle to be converted to a string. |
data | [INOUT] pointer to the char * resulting from the operation. |
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.
buff | [IN] buffer to print. |
len | [IN] length of the buffer. |
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)
fh | [IN] file handle to print. |
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)
fh | [IN] file handle to print. |
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)
fh | [IN] file handle to print. |
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)
fh | [IN] file handle to print. |
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.