Commit 6ca1584173d0320f47464092eb180a17259cc3f9

Authored by Al Viro
Committed by Linus Torvalds
1 parent 2ef1031282

[PATCH] smbfs endianness annotations

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>

Showing 1 changed file with 6 additions and 6 deletions Inline Diff

include/linux/smb_fs.h
1 /* 1 /*
2 * smb_fs.h 2 * smb_fs.h
3 * 3 *
4 * Copyright (C) 1995 by Paal-Kr. Engstad and Volker Lendecke 4 * Copyright (C) 1995 by Paal-Kr. Engstad and Volker Lendecke
5 * Copyright (C) 1997 by Volker Lendecke 5 * Copyright (C) 1997 by Volker Lendecke
6 * 6 *
7 */ 7 */
8 8
9 #ifndef _LINUX_SMB_FS_H 9 #ifndef _LINUX_SMB_FS_H
10 #define _LINUX_SMB_FS_H 10 #define _LINUX_SMB_FS_H
11 11
12 #include <linux/smb.h> 12 #include <linux/smb.h>
13 13
14 /* 14 /*
15 * ioctl commands 15 * ioctl commands
16 */ 16 */
17 #define SMB_IOC_GETMOUNTUID _IOR('u', 1, __kernel_old_uid_t) 17 #define SMB_IOC_GETMOUNTUID _IOR('u', 1, __kernel_old_uid_t)
18 #define SMB_IOC_NEWCONN _IOW('u', 2, struct smb_conn_opt) 18 #define SMB_IOC_NEWCONN _IOW('u', 2, struct smb_conn_opt)
19 19
20 /* __kernel_uid_t can never change, so we have to use __kernel_uid32_t */ 20 /* __kernel_uid_t can never change, so we have to use __kernel_uid32_t */
21 #define SMB_IOC_GETMOUNTUID32 _IOR('u', 3, __kernel_uid32_t) 21 #define SMB_IOC_GETMOUNTUID32 _IOR('u', 3, __kernel_uid32_t)
22 22
23 23
24 #ifdef __KERNEL__ 24 #ifdef __KERNEL__
25 #include <linux/smb_fs_i.h> 25 #include <linux/smb_fs_i.h>
26 #include <linux/smb_fs_sb.h> 26 #include <linux/smb_fs_sb.h>
27 27
28 #include <linux/fs.h> 28 #include <linux/fs.h>
29 #include <linux/pagemap.h> 29 #include <linux/pagemap.h>
30 #include <linux/vmalloc.h> 30 #include <linux/vmalloc.h>
31 #include <linux/smb_mount.h> 31 #include <linux/smb_mount.h>
32 #include <asm/unaligned.h> 32 #include <asm/unaligned.h>
33 33
34 static inline struct smb_sb_info *SMB_SB(struct super_block *sb) 34 static inline struct smb_sb_info *SMB_SB(struct super_block *sb)
35 { 35 {
36 return sb->s_fs_info; 36 return sb->s_fs_info;
37 } 37 }
38 38
39 static inline struct smb_inode_info *SMB_I(struct inode *inode) 39 static inline struct smb_inode_info *SMB_I(struct inode *inode)
40 { 40 {
41 return container_of(inode, struct smb_inode_info, vfs_inode); 41 return container_of(inode, struct smb_inode_info, vfs_inode);
42 } 42 }
43 43
44 /* macro names are short for word, double-word, long value (?) */ 44 /* macro names are short for word, double-word, long value (?) */
45 #define WVAL(buf,pos) \ 45 #define WVAL(buf,pos) \
46 (le16_to_cpu(get_unaligned((u16 *)((u8 *)(buf) + (pos))))) 46 (le16_to_cpu(get_unaligned((__le16 *)((u8 *)(buf) + (pos)))))
47 #define DVAL(buf,pos) \ 47 #define DVAL(buf,pos) \
48 (le32_to_cpu(get_unaligned((u32 *)((u8 *)(buf) + (pos))))) 48 (le32_to_cpu(get_unaligned((__le32 *)((u8 *)(buf) + (pos)))))
49 #define LVAL(buf,pos) \ 49 #define LVAL(buf,pos) \
50 (le64_to_cpu(get_unaligned((u64 *)((u8 *)(buf) + (pos))))) 50 (le64_to_cpu(get_unaligned((__le64 *)((u8 *)(buf) + (pos)))))
51 #define WSET(buf,pos,val) \ 51 #define WSET(buf,pos,val) \
52 put_unaligned(cpu_to_le16((u16)(val)), (u16 *)((u8 *)(buf) + (pos))) 52 put_unaligned(cpu_to_le16((u16)(val)), (__le16 *)((u8 *)(buf) + (pos)))
53 #define DSET(buf,pos,val) \ 53 #define DSET(buf,pos,val) \
54 put_unaligned(cpu_to_le32((u32)(val)), (u32 *)((u8 *)(buf) + (pos))) 54 put_unaligned(cpu_to_le32((u32)(val)), (__le32 *)((u8 *)(buf) + (pos)))
55 #define LSET(buf,pos,val) \ 55 #define LSET(buf,pos,val) \
56 put_unaligned(cpu_to_le64((u64)(val)), (u64 *)((u8 *)(buf) + (pos))) 56 put_unaligned(cpu_to_le64((u64)(val)), (__le64 *)((u8 *)(buf) + (pos)))
57 57
58 /* where to find the base of the SMB packet proper */ 58 /* where to find the base of the SMB packet proper */
59 #define smb_base(buf) ((u8 *)(((u8 *)(buf))+4)) 59 #define smb_base(buf) ((u8 *)(((u8 *)(buf))+4))
60 60
61 /* 61 /*
62 * Flags for the in-memory inode 62 * Flags for the in-memory inode
63 */ 63 */
64 #define SMB_F_LOCALWRITE 0x02 /* file modified locally */ 64 #define SMB_F_LOCALWRITE 0x02 /* file modified locally */
65 65
66 66
67 /* NT1 protocol capability bits */ 67 /* NT1 protocol capability bits */
68 #define SMB_CAP_RAW_MODE 0x00000001 68 #define SMB_CAP_RAW_MODE 0x00000001
69 #define SMB_CAP_MPX_MODE 0x00000002 69 #define SMB_CAP_MPX_MODE 0x00000002
70 #define SMB_CAP_UNICODE 0x00000004 70 #define SMB_CAP_UNICODE 0x00000004
71 #define SMB_CAP_LARGE_FILES 0x00000008 71 #define SMB_CAP_LARGE_FILES 0x00000008
72 #define SMB_CAP_NT_SMBS 0x00000010 72 #define SMB_CAP_NT_SMBS 0x00000010
73 #define SMB_CAP_RPC_REMOTE_APIS 0x00000020 73 #define SMB_CAP_RPC_REMOTE_APIS 0x00000020
74 #define SMB_CAP_STATUS32 0x00000040 74 #define SMB_CAP_STATUS32 0x00000040
75 #define SMB_CAP_LEVEL_II_OPLOCKS 0x00000080 75 #define SMB_CAP_LEVEL_II_OPLOCKS 0x00000080
76 #define SMB_CAP_LOCK_AND_READ 0x00000100 76 #define SMB_CAP_LOCK_AND_READ 0x00000100
77 #define SMB_CAP_NT_FIND 0x00000200 77 #define SMB_CAP_NT_FIND 0x00000200
78 #define SMB_CAP_DFS 0x00001000 78 #define SMB_CAP_DFS 0x00001000
79 #define SMB_CAP_LARGE_READX 0x00004000 79 #define SMB_CAP_LARGE_READX 0x00004000
80 #define SMB_CAP_LARGE_WRITEX 0x00008000 80 #define SMB_CAP_LARGE_WRITEX 0x00008000
81 #define SMB_CAP_UNIX 0x00800000 /* unofficial ... */ 81 #define SMB_CAP_UNIX 0x00800000 /* unofficial ... */
82 82
83 83
84 /* 84 /*
85 * This is the time we allow an inode, dentry or dir cache to live. It is bad 85 * This is the time we allow an inode, dentry or dir cache to live. It is bad
86 * for performance to have shorter ttl on an inode than on the cache. It can 86 * for performance to have shorter ttl on an inode than on the cache. It can
87 * cause refresh on each inode for a dir listing ... one-by-one 87 * cause refresh on each inode for a dir listing ... one-by-one
88 */ 88 */
89 #define SMB_MAX_AGE(server) (((server)->mnt->ttl * HZ) / 1000) 89 #define SMB_MAX_AGE(server) (((server)->mnt->ttl * HZ) / 1000)
90 90
91 static inline void 91 static inline void
92 smb_age_dentry(struct smb_sb_info *server, struct dentry *dentry) 92 smb_age_dentry(struct smb_sb_info *server, struct dentry *dentry)
93 { 93 {
94 dentry->d_time = jiffies - SMB_MAX_AGE(server); 94 dentry->d_time = jiffies - SMB_MAX_AGE(server);
95 } 95 }
96 96
97 struct smb_cache_head { 97 struct smb_cache_head {
98 time_t mtime; /* unused */ 98 time_t mtime; /* unused */
99 unsigned long time; /* cache age */ 99 unsigned long time; /* cache age */
100 unsigned long end; /* last valid fpos in cache */ 100 unsigned long end; /* last valid fpos in cache */
101 int eof; 101 int eof;
102 }; 102 };
103 103
104 #define SMB_DIRCACHE_SIZE ((int)(PAGE_CACHE_SIZE/sizeof(struct dentry *))) 104 #define SMB_DIRCACHE_SIZE ((int)(PAGE_CACHE_SIZE/sizeof(struct dentry *)))
105 union smb_dir_cache { 105 union smb_dir_cache {
106 struct smb_cache_head head; 106 struct smb_cache_head head;
107 struct dentry *dentry[SMB_DIRCACHE_SIZE]; 107 struct dentry *dentry[SMB_DIRCACHE_SIZE];
108 }; 108 };
109 109
110 #define SMB_FIRSTCACHE_SIZE ((int)((SMB_DIRCACHE_SIZE * \ 110 #define SMB_FIRSTCACHE_SIZE ((int)((SMB_DIRCACHE_SIZE * \
111 sizeof(struct dentry *) - sizeof(struct smb_cache_head)) / \ 111 sizeof(struct dentry *) - sizeof(struct smb_cache_head)) / \
112 sizeof(struct dentry *))) 112 sizeof(struct dentry *)))
113 113
114 #define SMB_DIRCACHE_START (SMB_DIRCACHE_SIZE - SMB_FIRSTCACHE_SIZE) 114 #define SMB_DIRCACHE_START (SMB_DIRCACHE_SIZE - SMB_FIRSTCACHE_SIZE)
115 115
116 struct smb_cache_control { 116 struct smb_cache_control {
117 struct smb_cache_head head; 117 struct smb_cache_head head;
118 struct page *page; 118 struct page *page;
119 union smb_dir_cache *cache; 119 union smb_dir_cache *cache;
120 unsigned long fpos, ofs; 120 unsigned long fpos, ofs;
121 int filled, valid, idx; 121 int filled, valid, idx;
122 }; 122 };
123 123
124 #define SMB_OPS_NUM_STATIC 5 124 #define SMB_OPS_NUM_STATIC 5
125 struct smb_ops { 125 struct smb_ops {
126 int (*read)(struct inode *inode, loff_t offset, int count, 126 int (*read)(struct inode *inode, loff_t offset, int count,
127 char *data); 127 char *data);
128 int (*write)(struct inode *inode, loff_t offset, int count, const 128 int (*write)(struct inode *inode, loff_t offset, int count, const
129 char *data); 129 char *data);
130 int (*readdir)(struct file *filp, void *dirent, filldir_t filldir, 130 int (*readdir)(struct file *filp, void *dirent, filldir_t filldir,
131 struct smb_cache_control *ctl); 131 struct smb_cache_control *ctl);
132 132
133 int (*getattr)(struct smb_sb_info *server, struct dentry *dir, 133 int (*getattr)(struct smb_sb_info *server, struct dentry *dir,
134 struct smb_fattr *fattr); 134 struct smb_fattr *fattr);
135 /* int (*setattr)(...); */ /* setattr is really icky! */ 135 /* int (*setattr)(...); */ /* setattr is really icky! */
136 136
137 int (*truncate)(struct inode *inode, loff_t length); 137 int (*truncate)(struct inode *inode, loff_t length);
138 138
139 139
140 /* --- --- --- end of "static" entries --- --- --- */ 140 /* --- --- --- end of "static" entries --- --- --- */
141 141
142 int (*convert)(unsigned char *output, int olen, 142 int (*convert)(unsigned char *output, int olen,
143 const unsigned char *input, int ilen, 143 const unsigned char *input, int ilen,
144 struct nls_table *nls_from, 144 struct nls_table *nls_from,
145 struct nls_table *nls_to); 145 struct nls_table *nls_to);
146 }; 146 };
147 147
148 static inline int 148 static inline int
149 smb_is_open(struct inode *i) 149 smb_is_open(struct inode *i)
150 { 150 {
151 return (SMB_I(i)->open == server_from_inode(i)->generation); 151 return (SMB_I(i)->open == server_from_inode(i)->generation);
152 } 152 }
153 153
154 extern void smb_install_null_ops(struct smb_ops *); 154 extern void smb_install_null_ops(struct smb_ops *);
155 #endif /* __KERNEL__ */ 155 #endif /* __KERNEL__ */
156 156
157 #endif /* _LINUX_SMB_FS_H */ 157 #endif /* _LINUX_SMB_FS_H */
158 158