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;
39 #if defined(AFS_LINUX24_ENV)
47 unsigned long i_blksize;
48 unsigned long i_blocks;
49 unsigned long i_version;
50 #if !defined(AFS_LINUX24_ENV)
51 unsigned long i_nrpages;
53 struct semaphore i_sem;
54 #if defined(AFS_LINUX24_ENV)
55 struct semaphore i_zombie;
57 struct semaphore i_atomic_write;
59 struct inode_operations *i_op;
60 #if defined(AFS_LINUX24_ENV)
61 struct file_operations *i_fop;
63 struct super_block *i_sb;
64 #if defined(AFS_LINUX24_ENV)
65 wait_queue_head_t i_wait;
67 struct wait_queue *i_wait;
69 struct file_lock *i_flock;
70 #if defined(AFS_LINUX24_ENV)
71 struct address_space *i_mapping;
72 struct address_space i_data;
74 struct vm_area_struct *i_mmap;
77 struct dquot *i_dquot[MAXQUOTAS];
78 #if defined(AFS_LINUX24_ENV)
79 struct pipe_inode_info *i_pipe;
80 struct block_device *i_bdev;
81 unsigned long i_dnotify_mask;
82 struct dnotify_struct *i_dnotify;
85 unsigned long i_state;
88 #if !defined(AFS_LINUX24_ENV)
93 #if defined(AFS_LINUX24_ENV)
94 atomic_t i_writecount;
98 unsigned int i_attr_flags;
99 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,2,10)
104 struct pipe_inode_info pipe_i;
105 struct minix_inode_info minix_i;
106 struct ext2_inode_info ext2_i;
107 struct hpfs_inode_info hpfs_i;
108 struct ntfs_inode_info ntfs_i;
109 struct msdos_inode_info msdos_i;
110 struct umsdos_inode_info umsdos_i;
111 struct iso_inode_info isofs_i;
112 struct nfs_inode_info nfs_i;
113 struct sysv_inode_info sysv_i;
114 struct affs_inode_info affs_i;
115 struct ufs_inode_info ufs_i;
116 struct romfs_inode_info romfs_i;
117 struct coda_inode_info coda_i;
118 struct smb_inode_info smbfs_i;
119 struct hfs_inode_info hfs_i;
120 struct adfs_inode_info adfs_i;
121 struct qnx4_inode_info qnx4_i;
122 struct socket socket_i;
128 /* Map vnode fields to inode fields. */
129 #define i_number i_ino
130 #define v_count i_count
132 #if defined(AFS_LINUX24_ENV)
135 #define v_type i_mode
137 #define vfs_vnodecovered s_covered
139 /* v_type bits map to mode bits: */
146 #define VSOCK S_IFSOCK
148 /* vcexcl - used only by afs_create */
149 enum vcexcl { EXCL, NONEXCL } ;
151 /* afs_open and afs_close needs to distinguish these cases */
152 #define FWRITE O_WRONLY|O_RDWR|O_APPEND
153 #define FTRUNC O_TRUNC
156 #define IO_APPEND O_APPEND
159 #define VTOI(V) ((struct inode*)V)
160 #define VN_HOLD(V) ((vnode_t*)V)->i_count++;
161 #define VN_RELE(V) osi_iput((struct inode *)V);
162 #define VFS_STATFS(V, S) ((V)->s_op->statfs)((V), (S), sizeof(*(S)))
166 /* Various mode bits */
167 #define VWRITE S_IWUSR
168 #define VREAD S_IRUSR
169 #define VEXEC S_IXUSR
170 #define VSUID S_ISUID
171 #define VSGID S_ISGID
174 #define vfs super_block
176 typedef struct vattr {
177 int va_type; /* One of v_types above. */
179 unsigned long va_blocks;
180 unsigned long va_blocksize;
181 int va_mask; /* AT_xxx operation to perform. */
182 umode_t va_mode; /* mode bits. */
185 int va_fsid; /* Not used? */
187 ino_t va_nodeid; /* Inode number */
188 nlink_t va_nlink; /* link count for file. */
189 struct timeval va_atime;
190 struct timeval va_mtime;
191 struct timeval va_ctime;
194 #define VATTR_NULL(A) memset(A, 0, sizeof(struct vattr))
197 /* va_masks - these should match their respective ATTR_xxx #defines in fs.h.
198 * afs_notify_change has to use the attr bits in both the Linux and AFS
199 * meanings. The glue layer code uses the ATTR_xxx style names.
201 #define AT_SIZE ATTR_SIZE
202 #define AT_MODE ATTR_MODE
203 #define AT_UID ATTR_UID
204 #define AT_GID ATTR_GID
205 #define AT_MTIME ATTR_MTIME
208 #define vnodeops inode_operations
210 #endif /* OSI_VFS_H_ */