diff options
author | patacongo <patacongo@7fd9a85b-ad96-42d3-883c-3090e2eb8679> | 2012-06-10 23:17:10 +0000 |
---|---|---|
committer | patacongo <patacongo@7fd9a85b-ad96-42d3-883c-3090e2eb8679> | 2012-06-10 23:17:10 +0000 |
commit | 744fec52392e8d154eacb3ff2bdd5992266d8dd5 (patch) | |
tree | 3c82b2818e6362433b43db3bf37e4799ab287b86 /nuttx/fs/nfs/nfs_node.h | |
parent | 7aecf6e0d49944b5c2a3024cc4b75a82b3ca8078 (diff) | |
download | px4-firmware-744fec52392e8d154eacb3ff2bdd5992266d8dd5.tar.gz px4-firmware-744fec52392e8d154eacb3ff2bdd5992266d8dd5.tar.bz2 px4-firmware-744fec52392e8d154eacb3ff2bdd5992266d8dd5.zip |
NFS update
git-svn-id: https://nuttx.svn.sourceforge.net/svnroot/nuttx/trunk@4825 7fd9a85b-ad96-42d3-883c-3090e2eb8679
Diffstat (limited to 'nuttx/fs/nfs/nfs_node.h')
-rw-r--r-- | nuttx/fs/nfs/nfs_node.h | 99 |
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 */ |