client-64bit-file-size-support-20011031
[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 /* The vnode should match the current implementation of the fs independent
21  * part of the Linux inode.
22  */
23 /* The first cut is to continue to use a separate vnode pool. */
24 /* LINUX VNODE INCLUDED BELOW -- DO NOT MODIFY */
25
26 typedef struct vnode vnode_t;
27
28 /* Map vnode fields to inode fields. */
29 #define i_number        i_ino
30 #define v_count         i_count
31 #define v_op            i_op
32 #if defined(AFS_LINUX24_ENV)
33 #define v_fop           i_fop
34 #endif
35 #define v_type          i_mode
36 #define v_vfsp          i_sb
37 #define vfs_vnodecovered s_covered
38
39 /* v_type bits map to mode bits: */
40 #define VNON 0
41 #define VREG S_IFREG
42 #define VDIR S_IFDIR
43 #define VBLK S_IFBLK
44 #define VCHR S_IFCHR
45 #define VLNK S_IFLNK
46 #define VSOCK S_IFSOCK
47
48 /* vcexcl - used only by afs_create */
49 enum vcexcl { EXCL, NONEXCL } ;
50
51 /* afs_open and afs_close needs to distinguish these cases */
52 #define FWRITE  O_WRONLY|O_RDWR|O_APPEND
53 #define FTRUNC  O_TRUNC
54
55
56 #define IO_APPEND O_APPEND
57 #define FSYNC O_SYNC
58
59 #define VTOI(V)  ((struct inode*)V)
60 #ifdef AFS_LINUX24_ENV
61 #define VN_HOLD(V) atomic_inc(&((vnode_t*)V)->i_count)
62 #else
63 #define VN_HOLD(V) ((vnode_t*)V)->i_count++;
64 #endif
65 #define VN_RELE(V) osi_iput((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 #define AT_UID          ATTR_UID
108 #define AT_GID          ATTR_GID
109 #define AT_MTIME        ATTR_MTIME
110
111
112 #define vnodeops inode_operations
113
114 #endif /* OSI_VFS_H_ */