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 void smb_init_root(struct smb_server *server);
108 int smb_stat_root(struct smb_server *server);
109 void smb_init_dir_cache(void);
110 void smb_invalid_dir_cache(unsigned long ino);
111 void smb_invalidate_all_inodes(struct smb_server *server);
112 void smb_free_dir_cache(void);
113
114
115 int smb_ioctl (struct inode * inode, struct file * filp,
116 unsigned int cmd, unsigned long arg);
117
118
119 struct super_block *smb_read_super(struct super_block *sb,
120 void *raw_data, int silent);
121 int smb_notify_change(struct inode *inode, struct iattr *attr);
122 void smb_invalidate_connection(struct smb_server *server);
123 int smb_conn_is_valid(struct smb_server *server);
124
125
126 dword smb_len(unsigned char *packet);
127 int smb_proc_open(struct smb_server *server, const char *pathname,
128 int len, struct smb_dirent *entry);
129 int smb_proc_close(struct smb_server *server, struct smb_dirent *finfo);
130 int smb_proc_read(struct smb_server *server, struct smb_dirent *finfo,
131 off_t offset, long count, char *data, int fs);
132 int smb_proc_write(struct smb_server *server, struct smb_dirent *finfo,
133 off_t offset, int count, const char *data);
134 int smb_proc_create(struct smb_server *server, const char *path,
135 int len, struct smb_dirent *entry);
136 int smb_proc_mknew(struct smb_server *server, const char *path, int len,
137 struct smb_dirent *entry);
138 int smb_proc_mv(struct smb_server *server, const char *opath, const int olen,
139 const char *npath, const int nlen);
140 int smb_proc_mkdir(struct smb_server *server, const char *path, const int len);
141 int smb_proc_rmdir(struct smb_server *server, const char *path, const int len);
142 int smb_proc_unlink(struct smb_server *server, const char *path,
143 const int len);
144 int smb_proc_readdir(struct smb_server *server, struct inode *dir,
145 int fpos, int cache_size,
146 struct smb_dirent *entry);
147 int smb_proc_getattr(struct smb_server *server, const char *path,
148 int len, struct smb_dirent *entry);
149 int smb_proc_setattr(struct smb_server *server,
150 struct inode *ino,
151 struct smb_dirent *new_finfo);
152 int smb_proc_chkpath(struct smb_server *server, char *path, int len,
153 int *result);
154 int smb_proc_dskattr(struct super_block *super, struct smb_dskattr *attr);
155 int smb_proc_reconnect(struct smb_server *server);
156 int smb_proc_connect(struct smb_server *server);
157 int smb_proc_disconnect(struct smb_server *server);
158 int smb_proc_trunc(struct smb_server *server, word fid, dword length);
159
160
161 int smb_release(struct smb_server *server);
162 int smb_connect(struct smb_server *server);
163 int smb_request(struct smb_server *server);
164 int smb_catch_keepalive(struct smb_server *server);
165 int smb_dont_catch_keepalive(struct smb_server *server);
166 int smb_trans2_request(struct smb_server *server,
167 int *data_len, int *param_len,
168 char **data, char **param);
169
170
171 int smb_mmap(struct inode * inode, struct file * file, struct vm_area_struct * vma);
172
173 #endif
174
175 #endif