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