2 * Copyright 2000, International Business Machines Corporation and others.
5 * This software has been released under the terms of the IBM Public
6 * License. For details, see the LICENSE file in the top-level source
7 * directory or online at http://www.openafs.org/dl/license10.html
11 * Linux interpretations of vnode and vfs structs.
13 * The Linux "inode" has been abstracted to the fs independent part to avoid
14 * wasting 100+bytes per vnode.
20 /* The vnode should match the current implementation of the fs independent
21 * part of the Linux inode.
23 /* The first cut is to continue to use a separate vnode pool. */
24 typedef struct vnode {
25 struct list_head i_hash;
26 struct list_head i_list;
27 struct list_head i_dentry;
28 #if defined(AFS_LINUX24_ENV)
29 struct list_head i_dirty_buffers;
31 #if defined(STRUCT_INODE_HAS_I_DIRTY_DATA_BUFFERS)
32 struct list_head i_dirty_data_buffers;
42 #if defined(AFS_LINUX24_ENV) || defined(pgoff2loff)
50 unsigned long i_blksize;
51 unsigned long i_blocks;
52 unsigned long i_version;
53 #if !defined(AFS_LINUX24_ENV)
54 unsigned long i_nrpages;
56 #ifdef STRUCT_INODE_HAS_I_BYTES
57 unsigned short i_bytes;
59 struct semaphore i_sem;
60 #ifdef STRUCT_INODE_HAS_I_TRUNCATE_SEM
61 struct rw_semaphore i_truncate_sem;
63 #if defined(AFS_LINUX24_ENV)
64 struct semaphore i_zombie;
66 struct semaphore i_atomic_write;
68 struct inode_operations *i_op;
69 #if defined(AFS_LINUX24_ENV)
70 struct file_operations *i_fop;
72 struct super_block *i_sb;
73 #if defined(AFS_LINUX24_ENV)
74 wait_queue_head_t i_wait;
76 struct wait_queue *i_wait;
78 struct file_lock *i_flock;
79 #if defined(AFS_LINUX24_ENV)
80 struct address_space *i_mapping;
81 struct address_space i_data;
83 struct vm_area_struct *i_mmap;
84 #if defined(STRUCT_INODE_HAS_I_MMAP_SHARED)
85 struct vm_area_struct *i_mmap_shared;
89 #if defined(STRUCT_INODE_HAS_I_MAPPING_OVERLOAD)
90 int i_mapping_overload;
92 struct dquot *i_dquot[MAXQUOTAS];
93 #if defined(AFS_LINUX24_ENV)
94 struct pipe_inode_info *i_pipe;
95 struct block_device *i_bdev;
96 #if defined(STRUCT_INODE_HAS_I_CDEV)
97 struct char_device *i_cdev;
99 unsigned long i_dnotify_mask;
100 struct dnotify_struct *i_dnotify;
103 unsigned long i_state;
105 unsigned int i_flags;
106 #if !defined(AFS_LINUX24_ENV)
107 unsigned char i_pipe;
109 unsigned char i_sock;
111 #if defined(AFS_LINUX24_ENV)
112 atomic_t i_writecount;
116 unsigned int i_attr_flags;
117 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,2,10)
122 struct pipe_inode_info pipe_i;
123 struct minix_inode_info minix_i;
124 struct ext2_inode_info ext2_i;
125 struct hpfs_inode_info hpfs_i;
126 struct ntfs_inode_info ntfs_i;
127 struct msdos_inode_info msdos_i;
128 struct umsdos_inode_info umsdos_i;
129 struct iso_inode_info isofs_i;
130 struct nfs_inode_info nfs_i;
131 struct sysv_inode_info sysv_i;
132 struct affs_inode_info affs_i;
133 struct ufs_inode_info ufs_i;
134 struct romfs_inode_info romfs_i;
135 struct coda_inode_info coda_i;
136 struct smb_inode_info smbfs_i;
137 struct hfs_inode_info hfs_i;
138 struct adfs_inode_info adfs_i;
139 struct qnx4_inode_info qnx4_i;
140 struct socket socket_i;
146 /* Map vnode fields to inode fields. */
147 #define i_number i_ino
148 #define v_count i_count
150 #if defined(AFS_LINUX24_ENV)
153 #define v_type i_mode
155 #define vfs_vnodecovered s_covered
157 /* v_type bits map to mode bits: */
164 #define VSOCK S_IFSOCK
166 /* vcexcl - used only by afs_create */
167 enum vcexcl { EXCL, NONEXCL } ;
169 /* afs_open and afs_close needs to distinguish these cases */
170 #define FWRITE O_WRONLY|O_RDWR|O_APPEND
171 #define FTRUNC O_TRUNC
174 #define IO_APPEND O_APPEND
177 #define VTOI(V) ((struct inode*)V)
178 #define VN_HOLD(V) ((vnode_t*)V)->i_count++;
179 #define VN_RELE(V) osi_iput((struct inode *)V);
180 #define VFS_STATFS(V, S) ((V)->s_op->statfs)((V), (S), sizeof(*(S)))
184 /* Various mode bits */
185 #define VWRITE S_IWUSR
186 #define VREAD S_IRUSR
187 #define VEXEC S_IXUSR
188 #define VSUID S_ISUID
189 #define VSGID S_ISGID
192 #define vfs super_block
194 typedef struct vattr {
195 int va_type; /* One of v_types above. */
197 unsigned long va_blocks;
198 unsigned long va_blocksize;
199 int va_mask; /* AT_xxx operation to perform. */
200 umode_t va_mode; /* mode bits. */
203 int va_fsid; /* Not used? */
205 ino_t va_nodeid; /* Inode number */
206 nlink_t va_nlink; /* link count for file. */
207 struct timeval va_atime;
208 struct timeval va_mtime;
209 struct timeval va_ctime;
212 #define VATTR_NULL(A) memset(A, 0, sizeof(struct vattr))
215 /* va_masks - these should match their respective ATTR_xxx #defines in fs.h.
216 * afs_notify_change has to use the attr bits in both the Linux and AFS
217 * meanings. The glue layer code uses the ATTR_xxx style names.
219 #define AT_SIZE ATTR_SIZE
220 #define AT_MODE ATTR_MODE
221 #define AT_UID ATTR_UID
222 #define AT_GID ATTR_GID
223 #define AT_MTIME ATTR_MTIME
226 #define vnodeops inode_operations
228 #endif /* OSI_VFS_H_ */