• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /****************************************************************************
2  * fs/nfs/nfs_node.h
3  *
4  *   Copyright (C) 2012-2013, 2017 Gregory Nutt. All rights reserved.
5  *   Copyright (C) 2012 Jose Pablo Rojas Vargas. All rights reserved.
6  *   Author: Jose Pablo Rojas Vargas <jrojas@nx-engineering.com>
7  *           Gregory Nutt <gnutt@nuttx.org>
8  *
9  * Leveraged from OpenBSD:
10  *
11  *   Copyright (c) 1989, 1993
12  *   The Regents of the University of California.  All rights reserved.
13  *
14  * This code is derived from software contributed to Berkeley by
15  * Rick Macklem at The University of Guelph.
16  *
17  * Redistribution and use in source and binary forms, with or without
18  * modification, are permitted provided that the following conditions
19  * are met:
20  *
21  * 1. Redistributions of source code must retain the above copyright
22  *    notice, this list of conditions and the following disclaimer.
23  * 2. Redistributions in binary form must reproduce the above copyright
24  *    notice, this list of conditions and the following disclaimer in the
25  *    documentation and/or other materials provided with the distribution.
26  * 3. Neither the name of the University nor the names of its contributors
27  *    may be used to endorse or promote products derived from this software
28  *    without specific prior written permission.
29  *
30  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
31  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
32  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
33  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
34  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
35  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
36  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
37  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
38  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
39  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
40  * SUCH DAMAGE.
41  *
42  ****************************************************************************/
43 
44 #ifndef __FS_NFS_NFS_NODE_H
45 #define __FS_NFS_NFS_NODE_H
46 
47 /****************************************************************************
48  * Included Files
49  ****************************************************************************/
50 
51 #include "nfs_proto.h"
52 
53 #ifdef __cplusplus
54 #if __cplusplus
55 extern "C" {
56 #endif /* __cplusplus */
57 #endif /* __cplusplus */
58 
59 /****************************************************************************
60  * Pre-processor Definitions
61  ****************************************************************************/
62 
63 /* Flags for struct nfsnode n_flag */
64 
65 #define NFSNODE_OPEN           (1 << 0) /* File is still open */
66 #define NFSNODE_MODIFIED       (1 << 1) /* Might have a modified buffer */
67 
68 /****************************************************************************
69  * Public Types
70  ****************************************************************************/
71 
72 /* There is a unique nfsnode allocated for each active file.  An nfsnode is
73  * 'named' by its file handle.
74  */
75 
76 struct nfsnode
77 {
78   struct nfsnode    *n_next;        /* Retained in a singly linked list. */
79   uint8_t            n_crefs;       /* Reference count (for nfs_dup) */
80   uint8_t            n_type;        /* File type */
81   uint8_t            n_fhsize;      /* Size in bytes of the file handle */
82   uint8_t            n_pfhsize;     /* Size in bytes of the file handle of parent */
83   uint8_t            n_flags;       /* Node flags */
84   uint16_t           n_mode;        /* File mode for fstat() */
85   time_t             n_atime;       /* File access time */
86   time_t             n_ctime;       /* File creation time */
87   struct timespec    n_timestamp;   /* Timestamp (modification time) */
88   nfsfh_t            n_fhandle;     /* NFS File Handle */
89   nfsfh_t            n_pfhandle;    /* NFS File Handle of parent */
90   uint64_t           n_size;        /* Current size of file */
91   int                n_oflags;      /* Flags provided when file was opened */
92   loff_t             n_fpos;        /* NFS File position */
93   struct file       *n_filep;       /* File pointer from VFS */
94   char              *n_name;
95 };
96 
97 #ifdef __cplusplus
98 #if __cplusplus
99 }
100 #endif /* __cplusplus */
101 #endif /* __cplusplus */
102 
103 #endif /* __FS_NFS_NFS_NODE_H */
104