/*
- * Copyright (c) 2000-2007 Apple Inc. All rights reserved.
+ * Copyright (c) 2000-2010 Apple Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
#define NFS_MAXDGRAMDATA 16384
#define NFS_PREFDGRAMDATA 8192
#define NFS_MAXDATA (64*1024) // XXX not ready for >64K
+#define NFSRV_MAXDATA (64*1024) // XXX not ready for >64K
#define NFS_MAXPATHLEN 1024
#define NFS_MAXNAMLEN 255
-#define NFS_MAXPKTHDR 404
-#define NFS_MAXPACKET (NFS_MAXPKTHDR + NFS_MAXDATA)
-#define NFS_MINPACKET 20
+#define NFS_MAXPACKET (16*1024*1024)
#define NFS_UDPSOCKBUF (224*1024)
#define NFS_FABLKSIZE 512 /* Size in bytes of a block wrt fa_blocks */
+#define NFS4_CALLBACK_PROG 0x4E465343 /* "NFSC" */
+#define NFS4_CALLBACK_PROG_VERSION 1
+
/* Stat numbers for NFS RPC returns */
#define NFS_OK 0
#define NFSERR_PERM 1
#define NFSERR_CB_PATH_DOWN 10048
#define NFSERR_STALEWRITEVERF 30001 /* Fake return for nfs_commit() */
+#define NFSERR_DIRBUFDROPPED 30002 /* Fake return for nfs*_readdir_rpc() */
+
+/*
+ * For gss we would like to return EAUTH when we don't have or can't get credentials,
+ * but some callers don't know what to do with it, so we define our own version
+ * of EAUTH to be EACCES
+ */
+#define NFSERR_EAUTH EACCES
#define NFSERR_RETVOID 0x20000000 /* Return void, not error */
#define NFSERR_AUTHERR 0x40000000 /* Mark an authentication error */
#define NFS_TIME_DONT_CHANGE 0
#define NFS_TIME_SET_TO_SERVER 1
#define NFS_TIME_SET_TO_CLIENT 2
+#define NFS4_TIME_SET_TO_SERVER 0
+#define NFS4_TIME_SET_TO_CLIENT 1
/* access() constants */
#define NFS_ACCESS_READ 0x01
* NFS attribute management stuff
*/
#define NFS_ATTR_BITMAP_LEN 2
-#define NFS_BITMAP_SET(A, I) (((uint32_t *)(A))[(I)/32] |= 1<<((I)%32))
-#define NFS_BITMAP_CLR(A, I) (((uint32_t *)(A))[(I)/32] &= ~(1<<((I)%32)))
-#define NFS_BITMAP_ISSET(A, I) (((uint32_t *)(A))[(I)/32] & (1<<((I)%32)))
-
-__private_extern__ uint32_t nfs_fs_attr_bitmap[NFS_ATTR_BITMAP_LEN];
-__private_extern__ uint32_t nfs_object_attr_bitmap[NFS_ATTR_BITMAP_LEN];
-__private_extern__ uint32_t nfs_getattr_bitmap[NFS_ATTR_BITMAP_LEN];
-
-#define NFS_CLEAR_ATTRIBUTES(A) \
+#define NFS_BITMAP_SET(B, I) (((uint32_t *)(B))[(I)/32] |= 1<<((I)%32))
+#define NFS_BITMAP_CLR(B, I) (((uint32_t *)(B))[(I)/32] &= ~(1<<((I)%32)))
+#define NFS_BITMAP_ISSET(B, I) (((uint32_t *)(B))[(I)/32] & (1<<((I)%32)))
+#define NFS_BITMAP_ZERO(B, L) \
do { \
- int __i; \
- for (__i=0; __i < NFS_ATTR_BITMAP_LEN; __i++) \
- ((uint32_t*)(A))[__i] = 0; \
+ int __i; \
+ for (__i=0; __i < (L); __i++) \
+ ((uint32_t*)(B))[__i] = 0; \
} while (0)
+extern uint32_t nfs_fs_attr_bitmap[NFS_ATTR_BITMAP_LEN];
+extern uint32_t nfs_object_attr_bitmap[NFS_ATTR_BITMAP_LEN];
+extern uint32_t nfs_getattr_bitmap[NFS_ATTR_BITMAP_LEN];
+
+#define NFS_CLEAR_ATTRIBUTES(A) NFS_BITMAP_ZERO((A), NFS_ATTR_BITMAP_LEN)
#define NFS_COPY_ATTRIBUTES(SRC, DST) \
do { \
int __i; \
/* NFS_BITMAP_SET((A), NFS_FATTR_FILEHANDLE); */ \
/* optional: */ \
/* NFS_BITMAP_SET((A), NFS_FATTR_ACL); */ \
- /* NFS_BITMAP_SET((A), NFS_FATTR_ACLSUPPORT); */ \
+ NFS_BITMAP_SET((A), NFS_FATTR_ACLSUPPORT); \
NFS_BITMAP_SET((A), NFS_FATTR_ARCHIVE); \
/* NFS_BITMAP_SET((A), NFS_FATTR_CANSETTIME); */ \
NFS_BITMAP_SET((A), NFS_FATTR_CASE_INSENSITIVE); \
NFS_BITMAP_SET((A), NFS_FATTR_TIME_METADATA); \
NFS_BITMAP_SET((A), NFS_FATTR_TIME_MODIFY); \
/* NFS_BITMAP_SET((A), NFS_FATTR_TIME_MODIFY_SET); */ \
- /* NFS_BITMAP_SET((A), NFS_FATTR_MOUNTED_ON_FILEID); */ \
+ NFS_BITMAP_SET((A), NFS_FATTR_MOUNTED_ON_FILEID); \
} while (0)
/* attributes requested when we want to do a "statfs" */
#define NFS_LIMIT_SIZE 1
#define NFS_LIMIT_BLOCKS 2
/* access/deny modes */
+#define NFS_OPEN_SHARE_ACCESS_NONE 0x00000000
#define NFS_OPEN_SHARE_ACCESS_READ 0x00000001
#define NFS_OPEN_SHARE_ACCESS_WRITE 0x00000002
#define NFS_OPEN_SHARE_ACCESS_BOTH 0x00000003
/* NFSv4 RPC procedures */
#define NFSPROC4_NULL 0
#define NFSPROC4_COMPOUND 1
+#define NFSPROC4_CB_NULL 0
+#define NFSPROC4_CB_COMPOUND 1
/* NFSv4 opcodes */
#define NFS_OP_ACCESS 3
#define NFS_ACE_SUCCESSFUL_ACCESS_ACE_FLAG 0x00000010
#define NFS_ACE_FAILED_ACCESS_ACE_FLAG 0x00000020
#define NFS_ACE_IDENTIFIER_GROUP 0x00000040
+#define NFS_ACE_INHERITED_ACE 0x00000080
/* ACE mask flags */
#define NFS_ACE_READ_DATA 0x00000001
#define NFS_ACE_LIST_DIRECTORY 0x00000001
/*
- * Quads are defined as arrays of 2 longs to ensure dense packing for the
- * protocol and to facilitate xdr conversion.
+ * Quads are defined as arrays of 2 32-bit values to ensure dense packing
+ * for the protocol and to facilitate xdr conversion.
*/
struct nfs_uquad {
- u_long nfsuquad[2];
+ u_int32_t nfsuquad[2];
};
typedef struct nfs_uquad nfsuint64;
/*
- * Used to convert between two u_longs and a u_quad_t.
+ * Used to convert between two u_int32_ts and a u_quad_t.
*/
union nfs_quadconvert {
- u_long lval[2];
+ u_int32_t lval[2];
u_quad_t qval;
};
typedef union nfs_quadconvert nfsquad_t;
};
typedef struct nfs_fsid nfs_fsid;
-
/*
- * remove these once we're sure nobody's using them
+ * NFSv4 stateid structure
*/
-struct nfsv2_time {
- u_long nfsv2_sec;
- u_long nfsv2_usec;
-};
-typedef struct nfsv2_time nfstime2;
-struct nfsv2_sattr {
- u_long sa_mode;
- u_long sa_uid;
- u_long sa_gid;
- u_long sa_size;
- nfstime2 sa_atime;
- nfstime2 sa_mtime;
+struct nfs_stateid {
+ uint32_t seqid;
+ uint32_t other[3];
};
+typedef struct nfs_stateid nfs_stateid;
#endif /* __APPLE_API_PRIVATE */
#endif /* _NFS_NFSPROTO_H_ */