linux26-more-updates-20040420
[openafs.git] / src / afs / LINUX / osi_vfs.hin
1 /*
2  * Copyright 2000, International Business Machines Corporation and others.
3  * All Rights Reserved.
4  * 
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
8  */
9
10 /*
11  * Linux interpretations of vnode and vfs structs.
12  *
13  * The Linux "inode" has been abstracted to the fs independent part to avoid
14  * wasting 100+bytes per vnode.
15  */
16
17 #ifndef OSI_VFS_H_
18 #define OSI_VFS_H_
19
20 #if !defined(AFS_LINUX26_ENV)
21 /* The vnode should match the current implementation of the fs independent
22  * part of the Linux inode.
23  */
24 /* The first cut is to continue to use a separate vnode pool. */
25 /* LINUX VNODE INCLUDED BELOW -- DO NOT MODIFY */
26
27 typedef struct vnode vnode_t;
28 #else
29 typedef struct inode vnode_t;
30 #define vnode inode
31 #endif
32
33 /* Map vnode fields to inode fields. */
34 #define i_number        i_ino
35 #define v_count         i_count
36 #define v_op            i_op
37 #if defined(AFS_LINUX24_ENV)
38 #define v_fop           i_fop
39 #endif
40 #define v_type          i_mode
41 #define v_vfsp          i_sb
42 #define vfs_vnodecovered s_covered
43
44 /* v_type bits map to mode bits: */
45 #define VNON 0
46 #define VREG S_IFREG
47 #define VDIR S_IFDIR
48 #define VBLK S_IFBLK
49 #define VCHR S_IFCHR
50 #define VLNK S_IFLNK
51 #define VSOCK S_IFSOCK
52 #define VFIFO S_IFIFO
53
54 /* vcexcl - used only by afs_create */
55 enum vcexcl { EXCL, NONEXCL } ;
56
57 /* afs_open and afs_close needs to distinguish these cases */
58 #define FWRITE  O_WRONLY|O_RDWR|O_APPEND
59 #define FTRUNC  O_TRUNC
60
61
62 #define IO_APPEND O_APPEND
63 #define FSYNC O_SYNC
64
65 #define VTOI(V)  ((struct inode*)V)
66 #define VFS_STATFS(V, S) ((V)->s_op->statfs)((V), (S), sizeof(*(S)))
67
68
69
70 /* Various mode bits */
71 #define VWRITE  S_IWUSR
72 #define VREAD   S_IRUSR
73 #define VEXEC   S_IXUSR
74 #define VSUID   S_ISUID
75 #define VSGID   S_ISGID
76
77
78 #define vfs super_block
79
80 typedef struct vattr {
81     int         va_type;        /* One of v_types above. */
82     afs_size_t  va_size;
83     unsigned long va_blocks;
84     unsigned long va_blocksize;
85     int         va_mask;        /* AT_xxx operation to perform. */
86     umode_t     va_mode;        /* mode bits. */
87     uid_t       va_uid;
88     gid_t       va_gid;
89     int         va_fsid;        /* Not used? */
90     dev_t       va_rdev;
91     ino_t       va_nodeid;      /* Inode number */
92     nlink_t     va_nlink;       /* link count for file. */
93     struct timeval va_atime;
94     struct timeval va_mtime;
95     struct timeval va_ctime;
96 } vattr_t;
97
98 #define VATTR_NULL(A) memset(A, 0, sizeof(struct vattr))
99
100
101 /* va_masks - these should match their respective ATTR_xxx #defines in fs.h.
102  * afs_notify_change has to use the attr bits in both the Linux and AFS
103  * meanings. The glue layer code uses the ATTR_xxx style names.
104  */
105 #define AT_SIZE         ATTR_SIZE
106 #define AT_MODE         ATTR_MODE
107 #undef AT_UID
108 #define AT_UID          ATTR_UID
109 #undef AT_GID
110 #define AT_GID          ATTR_GID
111 #define AT_MTIME        ATTR_MTIME
112
113
114 #define vnodeops inode_operations
115
116 #endif /* OSI_VFS_H_ */