nfsLib.h
上传用户:luoyougen
上传日期:2008-05-12
资源大小:23136k
文件大小:6k
源码类别:

VxWorks

开发平台:

C/C++

  1. /* nfsLib.h - Network File System library header */
  2. /* Copyright 1984-1992 Wind River Systems, Inc. */
  3. /*
  4. modification history
  5. --------------------
  6. 01q,20nov97,gnn  fix for spr#5436, need to support FIOFSTATFSGET
  7. 01p,28jul93,jmm  moved AUTH_UNIX_FIELD_LEN and MAX_GRPS definitions to here
  8. 01o,22sep92,rrr  added support for c++
  9. 01n,18sep92,jcf  removed ansi warnings.
  10. 01m,07sep92,smb  added includes xdr_nfs.h and sys/stat.h to remove ANSI warnings
  11. 01l,04jul92,jcf  cleaned up.
  12. 01k,26may92,rrr  the tree shuffle
  13. 01j,16dec91,gae  added missing prototypes for ANSI.
  14. 01i,04oct91,rrr  passed through the ansification filter
  15.   -changed VOID to void
  16.   -changed copyright notice
  17. 01h,08mar91,elh  added NFS_REXMIT_{SEC,USEC}.
  18. 01g,25oct90,dnw  deleted private function.
  19. 01f,05oct90,shl  added ANSI function prototypes.
  20.                  made #endif ANSI style.
  21.                  added copyright notice.
  22. 01e,10aug90,dnw  added declarations of nfsAuthUnix[GS]et().
  23. 01d,09sep88,llk  added NFS_TIMEOUT_SEC, NFS_TIMEOUT_USEC, NFS_SOCKOPTVAL.
  24. 01c,26aug88,gae  removed unused imports.
  25. 01b,04jun88,llk  moved FOLLOW_LINK, DEFAULT_FILE_PERM and DEFAULT_DIR_PERM
  26.    to ioLib.h.
  27. 01a,19apr88,llk  written.
  28. */
  29. #ifndef __INCnfsLibh
  30. #define __INCnfsLibh
  31. #ifdef __cplusplus
  32. extern "C" {
  33. #endif
  34. #include "vwModNum.h"
  35. #include "dirent.h"
  36. #include "sys/stat.h"
  37. #include "xdr_nfsserv.h"
  38. #include "xdr_nfs.h"
  39.     
  40. /* file status types -- from the nfs protocol spec, if these change,
  41.    then the FSTAT values in ioLib.h should also be changed */
  42. #define NFS_FSTAT_DIR 0040000 /* directory */
  43. #define NFS_FSTAT_CHR 0020000 /* character special file */
  44. #define NFS_FSTAT_BLK 0060000 /* block special file */
  45. #define NFS_FSTAT_REG 0100000 /* regular file */
  46. #define NFS_FSTAT_LNK 0120000 /* symbolic link file */
  47. #define NFS_FSTAT_NON 0140000 /* named socket */
  48. /* nfsLib status codes */
  49. #define S_nfsLib_NFS_AUTH_UNIX_FAILED (M_nfsLib | 1)
  50. #define S_nfsLib_NFS_INAPPLICABLE_FILE_TYPE (M_nfsLib | 2)
  51. /* nfsLib status codes derived from Sun's NFS specification (see xdr_nfs.h)  */
  52. #define S_nfsLib_NFS_OK (M_nfsStat | (int) NFS_OK)
  53. #define S_nfsLib_NFSERR_PERM (M_nfsStat | (int) NFSERR_PERM)
  54. #define S_nfsLib_NFSERR_NOENT (M_nfsStat | (int) NFSERR_NOENT)
  55. #define S_nfsLib_NFSERR_IO (M_nfsStat | (int) NFSERR_IO)
  56. #define S_nfsLib_NFSERR_NXIO (M_nfsStat | (int) NFSERR_NXIO)
  57. #define S_nfsLib_NFSERR_ACCES (M_nfsStat | (int) NFSERR_ACCES)
  58. #define S_nfsLib_NFSERR_EXIST (M_nfsStat | (int) NFSERR_EXIST)
  59. #define S_nfsLib_NFSERR_NODEV (M_nfsStat | (int) NFSERR_NODEV)
  60. #define S_nfsLib_NFSERR_NOTDIR (M_nfsStat | (int) NFSERR_NOTDIR)
  61. #define S_nfsLib_NFSERR_ISDIR (M_nfsStat | (int) NFSERR_ISDIR)
  62. #define S_nfsLib_NFSERR_FBIG (M_nfsStat | (int) NFSERR_FBIG)
  63. #define S_nfsLib_NFSERR_NOSPC (M_nfsStat | (int) NFSERR_NOSPC)
  64. #define S_nfsLib_NFSERR_ROFS (M_nfsStat | (int) NFSERR_ROFS)
  65. #define S_nfsLib_NFSERR_NAMETOOLONG (M_nfsStat | (int) NFSERR_NAMETOOLONG)
  66. #define S_nfsLib_NFSERR_NOTEMPTY (M_nfsStat | (int) NFSERR_NOTEMPTY)
  67. #define S_nfsLib_NFSERR_DQUOT (M_nfsStat | (int) NFSERR_DQUOT)
  68. #define S_nfsLib_NFSERR_STALE (M_nfsStat | (int) NFSERR_STALE)
  69. #define S_nfsLib_NFSERR_WFLUSH (M_nfsStat | (int) NFSERR_WFLUSH)
  70. /* default NFS parameters */
  71. #define NFS_TIMEOUT_SEC         25
  72. #define NFS_TIMEOUT_USEC        0
  73. #define NFS_SOCKOPTVAL          10000
  74. #define NFS_REXMIT_SEC 5
  75. #define NFS_REXMIT_USEC 0
  76. #define AUTH_UNIX_FIELD_LEN 50 /* UNIX authentication info */
  77. #define MAX_GRPS 20 /* max. # of groups that user is in */
  78. /* function declarations */
  79. #if defined(__STDC__) || defined(__cplusplus)
  80. extern STATUS  nfsExportShow (char *hostName);
  81. extern void  nfsAuthUnixGet (char *machname, int *pUid, int *pGid,
  82.         int *pNgids, int *gids);
  83. extern void  nfsAuthUnixSet (char *machname, int uid, int gid,
  84.         int ngids, int *aup_gids);
  85. extern void  nfsAuthUnixPrompt (void);
  86. extern void  nfsAuthUnixShow (void);
  87. extern void  nfsHelp (void);
  88. extern void  nfsIdSet (int uid);
  89. extern void  nfsClientClose (void);
  90. extern STATUS  nfsDirMount (char *hostName, dirpath dirname,
  91.      nfs_fh *pFileHandle);
  92. extern STATUS  nfsDirUnmount (char *hostName, dirpath dirname);
  93. extern STATUS  nfsDirReadOne (char *hostName, nfs_fh *pDirHandle, DIR *pDir);
  94. extern STATUS  nfsExportFree (exports *pExports);
  95. extern STATUS  nfsExportRead (char *hostName, exports *pExports);
  96. extern void  nfsFileAttrGet (fattr *pFattr, struct stat *pStat);
  97. extern STATUS   nfsFsAttrGet (char* pHostName,nfs_fh* pDirHandle,
  98.                               struct statfs* pArg );
  99. extern int  nfsFileRead (char *hostName, nfs_fh *pHandle,
  100.      unsigned int offset, unsigned int count,
  101.      char *buf, fattr *pNewAttr);
  102. extern STATUS  nfsFileRemove (char *hostName, nfs_fh *pMountHandle,
  103.        char *fullFileName);
  104. extern int  nfsFileWrite (char *hostName, nfs_fh *pHandle,
  105.       unsigned int offset, unsigned int count,
  106.       char *data, fattr *pNewAttr);
  107. extern int  nfsLookUpByName (char *hostName, char *fileName,
  108.          nfs_fh *pMountHandle, diropres *pDirOpRes,
  109.          nfs_fh *pDirHandle);
  110. extern int  nfsThingCreate (char *hostName, char *fullFileName,
  111.         nfs_fh *pMountHandle, diropres *pDirOpRes,
  112.         nfs_fh *pDirHandle, u_int mode);
  113. #else
  114. extern STATUS  nfsExportShow ();
  115. extern void  nfsAuthUnixGet ();
  116. extern void  nfsAuthUnixSet ();
  117. extern void  nfsAuthUnixPrompt ();
  118. extern void  nfsAuthUnixShow ();
  119. extern void  nfsHelp ();
  120. extern void  nfsIdSet ();
  121. extern void  nfsClientClose ();
  122. extern STATUS  nfsDirMount ();
  123. extern STATUS  nfsDirUnmount ();
  124. extern STATUS  nfsDirReadOne ();
  125. extern STATUS  nfsExportFree ();
  126. extern STATUS  nfsExportRead ();
  127. extern void  nfsFileAttrGet ();
  128. extern STATUS   nfsFsAttrGet ();
  129. extern int  nfsFileRead ();
  130. extern STATUS  nfsFileRemove ();
  131. extern int  nfsFileWrite ();
  132. extern int  nfsLookUpByName ();
  133. extern int  nfsThingCreate ();
  134. #endif /* __STDC__ */
  135. #ifdef __cplusplus
  136. }
  137. #endif
  138. #endif /* __INCnfsLibh */