summaryrefslogtreecommitdiff
path: root/nuttx/fs/nfs/nfs_node.h
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2012-06-10 23:17:10 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2012-06-10 23:17:10 +0000
commit2e3f4fdf96579fbcc0f2c9d017ceb4cc6dd5ef2c (patch)
tree3c82b2818e6362433b43db3bf37e4799ab287b86 /nuttx/fs/nfs/nfs_node.h
parentbd4defc1489e67d10a8ebbadc0ef91d48ff584fa (diff)
downloadpx4-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_node.h')
-rw-r--r--nuttx/fs/nfs/nfs_node.h99
1 files changed, 24 insertions, 75 deletions
diff --git a/nuttx/fs/nfs/nfs_node.h b/nuttx/fs/nfs/nfs_node.h
index ff0380c85..377d2a88f 100644
--- a/nuttx/fs/nfs/nfs_node.h
+++ b/nuttx/fs/nfs/nfs_node.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:
*
@@ -53,91 +54,39 @@
* Pre-processor Definitions
****************************************************************************/
-/* Values for n_commitflags */
+/* Flags for struct nfsnode n_flag */
-#define NFS_COMMIT_PUSH_VALID 0x0001 /* Push range valid */
-#define NFS_COMMIT_PUSHED_VALID 0x0002 /* Pushed range valid */
-
-#define n_atim n_un1.nf_atim
-#define n_mtim n_un2.nf_mtim
-#define n_cookieverf n_un1.nd_cookieverf
-
-/* Flags for n_flag */
-
-#define NFLUSHWANT 0x0001/* Want wakeup from a flush in prog. */
-#define NFLUSHINPROG 0x0002/* Avoid multiple calls to vinvalbuf() */
-#define NMODIFIED 0x0004/* Might have a modified buffer in bio */
-#define NWRITEERR 0x0008/* Flag write errors so close will know */
-#define NACC 0x0100/* Special file accessed */
-#define NUPD 0x0200/* Special file updated */
-#define NCHG 0x0400/* Special file times changed */
-
-#define NFS_INVALIDATE_ATTRCACHE(np) ((np)->n_attrstamp = 0)
-
-/* Convert between nfsnode pointers and vnode pointers */
-
-#define VTONFS(vp) ((struct nfsnode *)(vp)->f_priv)
-#define NFSTOV(np) ((np)->n_vnode)
-
-#define n_atim n_un1.nf_atim
-#define n_mtim n_un2.nf_mtim
-#define n_sillyrename n_un3.nf_silly
-#define n_cookieverf n_un1.nd_cookieverf
-#define n4_cookieverf n_un1.nd4_cookieverf
-#define n_cookies n_un3.nd_cook
+#define NFSNODE_OPEN (1 << 0) /* File is still open */
+#define NFSNODE_MODIFIED (1 << 1) /* Might have a modified buffer */
/****************************************************************************
* Public Types
****************************************************************************/
-/* The nfsnode is the nfs equivalent to ufs's inode. Any similarity
- * is purely coincidental.
- * There is a unique nfsnode allocated for each active file,
- * each current directory, each mounted-on file, text file, and the root.
- * An nfsnode is 'named' by its file handle. (nget/nfs_node.c)
- * If this structure exceeds 256 bytes (it is currently 256 using 4.4BSD-Lite
- * type definitions), file handles of > 32 bytes should probably be split out
- * into a separate malloc()'d data structure. (Reduce the size of nfsfh_t by
- * changing the definition in sys/mount.h of NFS_SMALLFH.)
- * NB: Hopefully the current order of the fields is such that everything will
- * be well aligned and, therefore, tightly packed.
+/* There is a unique nfsnode allocated for each active file. An nfsnode is
+ * 'named' by its file handle.
+ *
+ * NOTE: n_size, n_mtime, and n_ctime are duplicted withing n_attr. We could
+ * eliminate those fields and save some memory.
*/
struct nfsnode
{
- struct nfsnode *n_next; /* Retained in a singly linked list filehandle/node tree. */
- bool n_open; /* true: The file is (still) open */
- uint64_t n_size; /* Current size of file */
- struct nfs_fattr n_fattr; /* nfs file attribute cache */
- uint8_t nfsv3_type; /* File type */
- time_t n_attrstamp; /* Attr. cache timestamp */
- struct timespec n_mtime; /* Prev modify time. */
- time_t n_ctime; /* Prev create time. */
- nfsfh_t n_fhp; /* NFS File Handle */
- uint32_t n_error; /* Save write error value */
- union
- {
- struct timespec nf_atim; /* Special file times */
- uint8_t nd_cookieverf[NFSX_V3WRITEVERF]; /* Cookie verifier (dir only) */
- } n_un1;
- union
- {
- struct timespec nf_mtim;
- } n_un2;
- uint32_t n_fhsize; /* size in bytes, of fh */
- short n_flag; /* Flag for locking.. */
-//nfsfh_t n_fh; /* Small File Handle */
- time_t n_accstamp; /* Access cache timestamp */
- uid_t n_accuid; /* Last access requester */
- int n_accmode; /* Last mode requested */
- int n_accerror; /* Last returned error */
-
-//off_t n_pushedlo; /* 1st blk in commited range */
-//off_t n_pushedhi; /* Last block in range */
-//off_t n_pushlo; /* 1st block in commit range */
-//off_t n_pushhi; /* Last block in range */
-//struct rwlock n_commitlock; /* Serialize commits */
-//int n_commitflags;
+ struct nfsnode *n_next; /* Retained in a singly linked list. */
+ uint8_t n_type; /* File type */
+ uint8_t n_fhsize; /* Size in bytes of the file handle */
+ uint8_t n_flags; /* Node flags */
+ uint16_t n_buflen; /* Size of I/O buffer */
+ struct nfs_fattr n_fattr; /* nfs file attribute cache (network order) */
+ struct timespec n_mtime; /* Prev modify time (see NOTE) */
+ time_t n_ctime; /* Prev create time (see NOTE) */
+ nfsfh_t n_fhandle; /* NFS File Handle */
+ uint64_t n_size; /* Current size of file (see NOTE) */
+
+ /* I/O buffer (must be a aligned to 32-bit boundaries) */
+
+ uint8_t n_iobuffer[1]; /* Actual size is given by n_buflen */
};
+#define SIZEOF_nfsnode(n) (sizeof(struct nfsnode) + ((n)-1))
#endif /* __FS_NFS_NFS_NODE_H */