This source file includes following definitions.
- min
- smb_kmalloc
- smb_kfree_s
1
2
3
4
5
6
7
8 #ifndef _LINUX_SMB_FS_H
9 #define _LINUX_SMB_FS_H
10
11 #include <linux/smb.h>
12 #include <linux/fs.h>
13 #include <linux/in.h>
14 #include <linux/types.h>
15
16 #include <linux/smb_mount.h>
17 #include <linux/smb_fs_sb.h>
18 #include <linux/smb_fs_i.h>
19
20
21
22
23 #define SMB_IOC_GETMOUNTUID _IOR('u', 1, uid_t)
24
25 #ifdef __KERNEL__
26
27
28
29
30 #define SMB_READDIR_CACHE_SIZE 64
31
32
33
34
35
36 #define SMB_CACHE_TABLE_SIZE 64
37
38 #define SMB_SUPER_MAGIC 0x517B
39
40
41
42 #define SMB_SBP(sb) ((struct smb_sb_info *)(sb->u.generic_sbp))
43 #define SMB_INOP(inode) ((struct smb_inode_info *)(inode->u.generic_ip))
44
45 #define SMB_SERVER(inode) (&(SMB_SBP(inode->i_sb)->s_server))
46 #define SMB_SERVATTR(inode) (&(SMB_SBP(inode->i_sb)->s_attr))
47
48 #define SMB_FINFO(inode) (&(SMB_INOP(inode)->finfo))
49
50 #define SMB_HEADER_LEN 37
51
52
53 static inline int min(int a, int b) {
54 return a<b ? a : b;
55 }
56
57 #ifdef DEBUG_SMB_MALLOC
58
59 #include <linux/malloc.h>
60
61 extern int smb_malloced;
62 extern int smb_current_malloced;
63
64 static inline void *
65 smb_kmalloc(unsigned int size, int priority)
66 {
67 smb_malloced += 1;
68 smb_current_malloced += 1;
69 return kmalloc(size, priority);
70 }
71
72 static inline void
73 smb_kfree_s(void *obj, int size)
74 {
75 smb_current_malloced -= 1;
76 kfree_s(obj, size);
77 }
78
79 #else
80
81 #define smb_kmalloc(s,p) kmalloc(s,p)
82 #define smb_kfree_s(o,s) kfree_s(o,s)
83
84 #endif
85
86 #if DEBUG_SMB > 0
87 #define DPRINTK(format, args...) printk(format , ## args)
88 #else
89 #define DPRINTK(format, args...)
90 #endif
91
92 #if DEBUG_SMB > 1
93 #define DDPRINTK(format, args...) printk(format , ## args)
94 #else
95 #define DDPRINTK(format, args...)
96 #endif
97
98
99
100 extern struct inode_operations smb_file_inode_operations;
101 int smb_make_open(struct inode *i, int right);
102
103
104 extern struct inode_operations smb_dir_inode_operations;
105 void smb_free_inode_info(struct smb_inode_info *i);
106 void smb_free_all_inodes(struct smb_server *server);
107 int smb_init_root(struct smb_server *server);
108 void smb_init_dir_cache(void);
109 void smb_invalid_dir_cache(unsigned long ino);
110 void smb_invalidate_all_inodes(struct smb_server *server);
111 void smb_free_dir_cache(void);
112
113
114 int smb_ioctl (struct inode * inode, struct file * filp,
115 unsigned int cmd, unsigned long arg);
116
117
118 struct super_block *smb_read_super(struct super_block *sb,
119 void *raw_data, int silent);
120 int smb_notify_change(struct inode *inode, struct iattr *attr);
121 void smb_invalidate_connection(struct smb_server *server);
122 int smb_conn_is_valid(struct smb_server *server);
123
124
125 dword smb_len(unsigned char *packet);
126 int smb_proc_open(struct smb_server *server, const char *pathname,
127 int len, struct smb_dirent *entry);
128 int smb_proc_close(struct smb_server *server, struct smb_dirent *finfo);
129 int smb_proc_read(struct smb_server *server, struct smb_dirent *finfo,
130 off_t offset, long count, char *data, int fs);
131 int smb_proc_write(struct smb_server *server, struct smb_dirent *finfo,
132 off_t offset, int count, char *data);
133 int smb_proc_create(struct smb_server *server, const char *path,
134 int len, struct smb_dirent *entry);
135 int smb_proc_mknew(struct smb_server *server, const char *path, int len,
136 struct smb_dirent *entry);
137 int smb_proc_mv(struct smb_server *server, const char *opath, const int olen,
138 const char *npath, const int nlen);
139 int smb_proc_mkdir(struct smb_server *server, const char *path, const int len);
140 int smb_proc_rmdir(struct smb_server *server, const char *path, const int len);
141 int smb_proc_unlink(struct smb_server *server, const char *path,
142 const int len);
143 int smb_proc_readdir(struct smb_server *server, struct inode *dir,
144 int fpos, int cache_size,
145 struct smb_dirent *entry);
146 int smb_proc_getattr(struct smb_server *server, const char *path,
147 int len, struct smb_dirent *entry);
148 int smb_proc_setattr(struct smb_server *server,
149 struct inode *ino,
150 struct smb_dirent *new_finfo);
151 int smb_proc_chkpath(struct smb_server *server, char *path, int len,
152 int *result);
153 int smb_proc_dskattr(struct super_block *super, struct smb_dskattr *attr);
154 int smb_proc_reconnect(struct smb_server *server);
155 int smb_proc_connect(struct smb_server *server);
156 int smb_proc_disconnect(struct smb_server *server);
157 int smb_proc_trunc(struct smb_server *server, word fid, dword length);
158
159
160 int smb_release(struct smb_server *server);
161 int smb_connect(struct smb_server *server);
162 int smb_request(struct smb_server *server);
163 int smb_catch_keepalive(struct smb_server *server);
164 int smb_dont_catch_keepalive(struct smb_server *server);
165 int smb_trans2_request(struct smb_server *server,
166 int *data_len, int *param_len,
167 char **data, char **param);
168
169
170 int smb_mmap(struct inode * inode, struct file * file, struct vm_area_struct * vma);
171
172 #endif
173
174 #endif