Remove building with NOCRYPTO option
[minix3.git] / sys / ufs / chfs / chfs_inode.h
blob0d4e70e62ee3edfedac6733ba2d078f5cb5af0bd
1 /* $NetBSD: chfs_inode.h,v 1.10 2015/01/11 17:29:57 hannken Exp $ */
3 /*-
4 * Copyright (c) 2010 Department of Software Engineering,
5 * University of Szeged, Hungary
6 * Copyright (C) 2010 Tamas Toth <ttoth@inf.u-szeged.hu>
7 * Copyright (C) 2010 Adam Hoka <ahoka@NetBSD.org>
8 * All rights reserved.
10 * This code is derived from software contributed to The NetBSD Foundation
11 * by the Department of Software Engineering, University of Szeged, Hungary
13 * Redistribution and use in source and binary forms, with or without
14 * modification, are permitted provided that the following conditions
15 * are met:
16 * 1. Redistributions of source code must retain the above copyright
17 * notice, this list of conditions and the following disclaimer.
18 * 2. Redistributions in binary form must reproduce the above copyright
19 * notice, this list of conditions and the following disclaimer in the
20 * documentation and/or other materials provided with the distribution.
22 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
23 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
24 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
25 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
26 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
27 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
28 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
29 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
30 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 * SUCH DAMAGE.
35 #ifndef __CHFS_INODE_H__
36 #define __CHFS_INODE_H__
38 #ifdef _KERNEL
39 #include <sys/vnode.h>
40 #include <sys/stat.h>
41 #include <ufs/ufs/ufsmount.h>
42 #include <miscfs/genfs/genfs_node.h>
43 #endif /* _KERNEL */
45 #define CHFS_ROOTINO 2
47 /* chfs file types */
48 enum chtype {
49 CHT_BLANK, /* empty type */
50 CHT_REG, /* regular file */
51 CHT_DIR, /* directory */
52 CHT_BLK, /* block device */
53 CHT_CHR, /* character device */
54 CHT_LNK, /* link */
55 CHT_SOCK, /* socket */
56 CHT_FIFO, /* fifo */
57 CHT_BAD /* bad type */
60 /* these macros are needed because the compatibility */
61 #define CHTTOVT(ch_type) (enum vtype)(ch_type)
62 #define VTTOCHT(v_type) (enum chtype)(v_type)
64 /* vtype replaced with chtype, these are only for backward compatibility */
65 static const enum chtype iftocht_tab[16] = {
66 CHT_BLANK, CHT_FIFO, CHT_CHR, CHT_BLANK,
67 CHT_DIR, CHT_BLANK, CHT_BLK, CHT_BLANK,
68 CHT_REG, CHT_BLANK, CHT_LNK, CHT_BLANK,
69 CHT_SOCK, CHT_BLANK, CHT_BLANK, CHT_BAD,
72 #define IFTOCHT(mode) (iftocht_tab[((mode) & S_IFMT) >> 12])
74 #ifdef _KERNEL
75 struct chfs_inode
77 struct genfs_node gnode;
78 kmutex_t inode_lock; /* lock the fields of chfs_inode */
80 struct ufsmount *ump; /* ufs mount - TODO we should remove it */
81 struct chfs_mount *chmp; /* chfs mount point - TODO we should remove it */
83 struct vnode *vp; /* vnode associated with this inode */
84 ino_t ino; /* vnode identifier number */
86 struct vnode *devvp; /* vnode for block I/O */
87 dev_t dev; /* device associated with the inode */
89 struct chfs_vnode_cache *chvc; /* vnode cache of this node */
91 struct chfs_dirent *fd; /* full dirent of this node */
92 struct chfs_dirent_list dents;
94 struct rb_tree fragtree; /* fragtree of inode */
96 uint64_t version; /* version number */
98 uint32_t mode; /* mode */
99 enum chtype ch_type; /* chfs file type */
100 uint64_t size; /* file byte count */
101 uint64_t write_size; /* increasing while write the file out to the flash */
102 uint32_t uid; /* file owner */
103 uint32_t gid; /* file group */
104 uint32_t atime; /* access time */
105 uint32_t mtime; /* modify time */
106 uint32_t ctime; /* creation time */
108 uint32_t iflag; /* flags, see below */
109 uint32_t flags; /* status flags (chflags) */
111 dev_t rdev; /* used if type is VCHR or VBLK or VFIFO*/
112 char *target; /* used if type is VLNK */
115 /* These flags are kept in chfs_inode->iflag. */
116 #define IN_ACCESS 0x0001 /* Access time update request. */
117 #define IN_CHANGE 0x0002 /* Inode change time update request. */
118 #define IN_UPDATE 0x0004 /* Inode was written to; update mtime. */
119 #define IN_MODIFY 0x2000 /* Modification time update request. */
120 #define IN_MODIFIED 0x0008 /* Inode has been modified. */
121 #define IN_ACCESSED 0x0010 /* Inode has been accessed. */
122 /* unused 0x0020 */ /* was IN_RENAME */
123 #define IN_SHLOCK 0x0040 /* File has shared lock. */
124 #define IN_EXLOCK 0x0080 /* File has exclusive lock. */
125 /* unused 0x0100 */ /* was LFS-only IN_CLEANING */
126 /* unused 0x0200 */ /* was LFS-only IN_ADIROP */
127 #define IN_SPACECOUNTED 0x0400 /* Blocks to be freed in free count. */
128 /* unused 0x1000 */ /* was LFS-only IN_PAGING */
131 #ifdef VTOI
132 # undef VTOI
133 #endif
134 #ifdef ITOV
135 # undef ITOV
136 #endif
138 /* struct vnode to struct chfs_inode */
139 #define VTOI(vp) ((struct chfs_inode *)(vp)->v_data)
140 /* struct chfs_inode to struct vnode */
141 #define ITOV(ip) ((ip)->vp)
143 /* XXX copied from ufs_dinode.h and should not be duplicated here */
144 #define UFS_NDADDR 12 /* Direct addresses in inode. */
146 /* XXX this should not be duplicated here */
147 #define UFS_ROOTINO ((ino_t)2)
149 /* File permissions. */
150 #define IEXEC 0000100 /* Executable. */
151 #define IWRITE 0000200 /* Writable. */
152 #define IREAD 0000400 /* Readable. */
153 #define ISVTX 0001000 /* Sticky bit. */
154 #define ISGID 0002000 /* Set-gid. */
155 #define ISUID 0004000 /* Set-uid. */
157 /* File types. */
158 #define IFMT 0170000 /* Mask of file type. */
159 #define IFIFO 0010000 /* Named pipe (fifo). */
160 #define IFCHR 0020000 /* Character device. */
161 #define IFDIR 0040000 /* Directory file. */
162 #define IFBLK 0060000 /* Block device. */
163 #define IFREG 0100000 /* Regular file. */
164 #define IFLNK 0120000 /* Symbolic link. */
165 #define IFSOCK 0140000 /* UNIX domain socket. */
166 #define IFWHT 0160000 /* Whiteout. */
168 #endif /* _KERNEL */
169 #endif /* __CHFS_INODE_H__ */