diff options
author | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2012-06-10 23:17:10 +0000 |
---|---|---|
committer | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2012-06-10 23:17:10 +0000 |
commit | 2e3f4fdf96579fbcc0f2c9d017ceb4cc6dd5ef2c (patch) | |
tree | 3c82b2818e6362433b43db3bf37e4799ab287b86 /nuttx/fs/nfs/nfs_proto.h | |
parent | bd4defc1489e67d10a8ebbadc0ef91d48ff584fa (diff) | |
download | px4-nuttx-2e3f4fdf96579fbcc0f2c9d017ceb4cc6dd5ef2c.tar.gz px4-nuttx-2e3f4fdf96579fbcc0f2c9d017ceb4cc6dd5ef2c.tar.bz2 px4-nuttx-2e3f4fdf96579fbcc0f2c9d017ceb4cc6dd5ef2c.zip |
NFS update
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@4825 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/fs/nfs/nfs_proto.h')
-rw-r--r-- | nuttx/fs/nfs/nfs_proto.h | 154 |
1 files changed, 84 insertions, 70 deletions
diff --git a/nuttx/fs/nfs/nfs_proto.h b/nuttx/fs/nfs/nfs_proto.h index b9d4655c3..c5800b216 100644 --- a/nuttx/fs/nfs/nfs_proto.h +++ b/nuttx/fs/nfs/nfs_proto.h @@ -4,6 +4,7 @@ * Copyright (C) 2012 Gregory Nutt. All rights reserved. * Copyright (C) 2012 Jose Pablo Rojas Vargas. All rights reserved. * Author: Jose Pablo Rojas Vargas <jrojas@nx-engineering.com> + * Gregory Nutt <gnutt@nuttx.org> * * Leveraged from OpenBSD: * @@ -214,95 +215,95 @@ #define NFSV3SATTRTIME_TOSERVER 1 #define NFSV3SATTRTIME_TOCLIENT 2 -#define NFSV3ACCESS_READ 0x01 -#define NFSV3ACCESS_LOOKUP 0x02 -#define NFSV3ACCESS_MODIFY 0x04 -#define NFSV3ACCESS_EXTEND 0x08 -#define NFSV3ACCESS_DELETE 0x10 -#define NFSV3ACCESS_EXECUTE 0x20 +#define NFSV3ACCESS_READ 0x01 +#define NFSV3ACCESS_LOOKUP 0x02 +#define NFSV3ACCESS_MODIFY 0x04 +#define NFSV3ACCESS_EXTEND 0x08 +#define NFSV3ACCESS_DELETE 0x10 +#define NFSV3ACCESS_EXECUTE 0x20 -#define NFSV3WRITE_UNSTABLE 0 -#define NFSV3WRITE_DATASYNC 1 -#define NFSV3WRITE_FILESYNC 2 +#define NFSV3WRITE_UNSTABLE 0 +#define NFSV3WRITE_DATASYNC 1 +#define NFSV3WRITE_FILESYNC 2 -#define NFSV3CREATE_UNCHECKED 0 -#define NFSV3CREATE_GUARDED 1 -#define NFSV3CREATE_EXCLUSIVE 2 +#define NFSV3CREATE_UNCHECKED 0 +#define NFSV3CREATE_GUARDED 1 +#define NFSV3CREATE_EXCLUSIVE 2 -#define NFSV3FSINFO_LINK 0x01 -#define NFSV3FSINFO_SYMLINK 0x02 -#define NFSV3FSINFO_HOMOGENEOUS 0x08 -#define NFSV3FSINFO_CANSETTIME 0x10 +#define NFSV3FSINFO_LINK 0x01 +#define NFSV3FSINFO_SYMLINK 0x02 +#define NFSV3FSINFO_HOMOGENEOUS 0x08 +#define NFSV3FSINFO_CANSETTIME 0x10 /* NFS mount option flags */ -#define NFSMNT_SOFT 0x00000001 /* soft mount (hard is default) */ -#define NFSMNT_WSIZE 0x00000002 /* set write size */ -#define NFSMNT_RSIZE 0x00000004 /* set read size */ -#define NFSMNT_TIMEO 0x00000008 /* set initial timeout */ -#define NFSMNT_RETRANS 0x00000010 /* set number of request retries */ -#define NFSMNT_MAXGRPS 0x00000020 /* set maximum grouplist size */ -#define NFSMNT_INT 0x00000040 /* allow interrupts on hard mount */ -#define NFSMNT_NOCONN 0x00000080 /* Don't Connect the socket */ +#define NFSMNT_SOFT 0x00000001 /* soft mount (hard is default) */ +#define NFSMNT_WSIZE 0x00000002 /* set write size */ +#define NFSMNT_RSIZE 0x00000004 /* set read size */ +#define NFSMNT_TIMEO 0x00000008 /* set initial timeout */ +#define NFSMNT_RETRANS 0x00000010 /* set number of request retries */ +#define NFSMNT_MAXGRPS 0x00000020 /* set maximum grouplist size */ +#define NFSMNT_INT 0x00000040 /* allow interrupts on hard mount */ +#define NFSMNT_NOCONN 0x00000080 /* Don't Connect the socket */ /* 0x100 free, was NFSMNT_NQNFS */ -#define NFSMNT_NFSV3 0x00000200 /* Use NFS Version 3 protocol */ +#define NFSMNT_NFSV3 0x00000200 /* Use NFS Version 3 protocol */ /* 0x400 free, was NFSMNT_KERB */ -#define NFSMNT_DUMBTIMR 0x00000800 /* Don't estimate rtt dynamically */ +#define NFSMNT_DUMBTIMR 0x00000800 /* Don't estimate rtt dynamically */ /* 0x1000 free, was NFSMNT_LEASETERM */ -#define NFSMNT_READAHEAD 0x00002000 /* set read ahead */ -#define NFSMNT_DEADTHRESH 0x00004000 /* set dead server retry thresh */ -#define NFSMNT_RESVPORT 0x00008000 /* Allocate a reserved port */ -#define NFSMNT_RDIRPLUS 0x00010000 /* Use Readdirplus for V3 */ -#define NFSMNT_READDIRSIZE 0x00020000 /* Set readdir size */ -#define NFSMNT_ACREGMIN 0x00040000 -#define NFSMNT_ACREGMAX 0x00080000 -#define NFSMNT_ACDIRMIN 0x00100000 -#define NFSMNT_ACDIRMAX 0x00200000 -#define NFSMNT_NOLOCKD 0x00400000 /* Locks are local */ -#define NFSMNT_NFSV4 0x00800000 /* Use NFS Version 4 protocol */ -#define NFSMNT_HASWRITEVERF 0x01000000 /* NFSv4 Write verifier */ -#define NFSMNT_GOTFSINFO 0x00000004 /* Got the V3 fsinfo */ -#define NFSMNT_INTERNAL 0xfffc0000 /* Bits set internally */ -#define NFSMNT_NOAC 0x00080000 /* Turn off attribute cache */ +#define NFSMNT_READAHEAD 0x00002000 /* set read ahead */ +#define NFSMNT_DEADTHRESH 0x00004000 /* set dead server retry thresh */ +#define NFSMNT_RESVPORT 0x00008000 /* Allocate a reserved port */ +#define NFSMNT_RDIRPLUS 0x00010000 /* Use Readdirplus for V3 */ +#define NFSMNT_READDIRSIZE 0x00020000 /* Set readdir size */ +#define NFSMNT_ACREGMIN 0x00040000 +#define NFSMNT_ACREGMAX 0x00080000 +#define NFSMNT_ACDIRMIN 0x00100000 +#define NFSMNT_ACDIRMAX 0x00200000 +#define NFSMNT_NOLOCKD 0x00400000 /* Locks are local */ +#define NFSMNT_NFSV4 0x00800000 /* Use NFS Version 4 protocol */ +#define NFSMNT_HASWRITEVERF 0x01000000 /* NFSv4 Write verifier */ +#define NFSMNT_GOTFSINFO 0x00000004 /* Got the V3 fsinfo */ +#define NFSMNT_INTERNAL 0xfffc0000 /* Bits set internally */ +#define NFSMNT_NOAC 0x00080000 /* Turn off attribute cache */ /* Conversion macros */ #define vtonfsv2_mode(t,m) \ txdr_unsigned(((t) == VFIFO) ? MAKEIMODE(VCHR, (m)) : \ MAKEIMODE((t), (m))) -#define vtonfsv3_mode(m) txdr_unsigned((m) & 07777) -#define nfstov_mode(a) (fxdr_unsigned(u_int16_t, (a))&07777) -#define vtonfsv2_type(a) txdr_unsigned(nfsv2_type[((int32_t)(a))]) -#define vtonfsv3_type(a) txdr_unsigned(nfsv3_type[((int32_t)(a))]) -#define nfsv2tov_type(a) nv2tov_type[fxdr_unsigned(uint32_t,(a))&0x7] -#define nfsv3tov_type(a) nv3tov_type[fxdr_unsigned(uint32_t,(a))&0x7] +#define vtonfsv3_mode(m) txdr_unsigned((m) & 07777) +#define nfstov_mode(a) (fxdr_unsigned(u_int16_t, (a))&07777) +#define vtonfsv2_type(a) txdr_unsigned(nfsv2_type[((int32_t)(a))]) +#define vtonfsv3_type(a) txdr_unsigned(nfsv3_type[((int32_t)(a))]) +#define nfsv2tov_type(a) nv2tov_type[fxdr_unsigned(uint32_t,(a))&0x7] +#define nfsv3tov_type(a) nv3tov_type[fxdr_unsigned(uint32_t,(a))&0x7] -#define NFS_MAXFHSIZE 64 +#define NFS_MAXFHSIZE 64 /* Mode bit values */ -#define NFSMMODE_IXOTH 0x00001 /* Execute permission for others on a file */ -#define NFSMMODE_IWOTH 0x00002 /* Write permission for others */ -#define NFSMMODE_IROTH 0x00004 /* Read permission for others */ -#define NFSMMODE_IXGRP 0x00008 /* Execute permission for group on a file */ -#define NFSMMODE_IWGRP 0x00010 /* Write permission for group */ -#define NFSMMODE_IRGRP 0x00020 /* Read permission for group */ -#define NFSMMODE_IXUSR 0x00040 /* Execute permission for owner on a file */ -#define NFSMMODE_IWUSR 0x00080 /* Write permission for owner */ -#define NFSMMODE_IRUSR 0x00100 /* Read permission for owner */ -#define NFSMMODE_SAVETEXT 0x00200 /* Save swapped text */ -#define NFSMMODE_ISGID 0x00400 /* Set group ID on execution */ -#define NFSMMODE_ISUID 0x00800 /* Set user ID on execution */ +#define NFSMODE_IXOTH 0x00001 /* Execute permission for others on a file */ +#define NFSMODE_IWOTH 0x00002 /* Write permission for others */ +#define NFSMODE_IROTH 0x00004 /* Read permission for others */ +#define NFSMODE_IXGRP 0x00008 /* Execute permission for group on a file */ +#define NFSMODE_IWGRP 0x00010 /* Write permission for group */ +#define NFSMODE_IRGRP 0x00020 /* Read permission for group */ +#define NFSMODE_IXUSR 0x00040 /* Execute permission for owner on a file */ +#define NFSMODE_IWUSR 0x00080 /* Write permission for owner */ +#define NFSMODE_IRUSR 0x00100 /* Read permission for owner */ +#define NFSMODE_SAVETEXT 0x00200 /* Save swapped text */ +#define NFSMODE_ISGID 0x00400 /* Set group ID on execution */ +#define NFSMODE_ISUID 0x00800 /* Set user ID on execution */ /* File identifier */ -#define MAXFIDSZ 16 +#define MAXFIDSZ 16 /**************************************************************************** * Public Types @@ -620,29 +621,42 @@ struct LOOKUP3resok struct READ3args { - nfstype file; + struct file_handle fshandle; /* Variable length */ uint64_t offset; uint32_t count; }; -struct READ3resok +struct nfs_rdhdr_s { - struct nfs_fattr file_attributes; - uint32_t count; - bool eof; - const char *data; + uint32_t attributes_follow; + struct nfs_fattr attributes; /* Will not be present if attributes_follow == 0 */ + uint32_t count; /* Number of bytes read */ + uint32_t eof; /* Non-zero if at the end of file */ + uint32_t length; /* Length of data (same as count?) */ }; +struct READ3resok +{ + struct nfs_rdhdr_s hdr; + uint8_t data[1]; /* Actual data size depends on count */ +}; +#define SIZEOF_READ3resok(n) (sizeof(struct nfs_rdhdr_s) + (n)) -struct WRITE3args +struct nfs_wrhdr_s { - nfstype file; + struct file_handle fshandle; /* Variable length */ uint64_t offset; uint32_t count; uint32_t stable; - const char *data; }; +struct WRITE3args +{ + struct nfs_wrhdr_s hdr; + uint8_t data[1]; /* Actual data size depends on count */ +}; +#define SIZEOF_WRITE3args(n) (sizeof(struct nfs_wrhdr_s) + (n)) + struct WRITE3resok { struct wcc_data file_wcc; |