This source file includes following definitions.
- 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 #ifdef DEBUG_SMB_MALLOC
54
55 #include <linux/malloc.h>
56
57 extern int smb_malloced;
58 extern int smb_current_malloced;
59
60 static inline void *
61 smb_kmalloc(unsigned int size, int priority)
62 {
63 smb_malloced += 1;
64 smb_current_malloced += 1;
65 return kmalloc(size, priority);
66 }
67
68 static inline void
69 smb_kfree_s(void *obj, int size)
70 {
71 smb_current_malloced -= 1;
72 kfree_s(obj, size);
73 }
74
75 #else
76
77 #define smb_kmalloc(s,p) kmalloc(s,p)
78 #define smb_kfree_s(o,s) kfree_s(o,s)
79
80 #endif
81
82 #if DEBUG_SMB > 0
83 #define DPRINTK(format, args...) printk(format , ## args)
84 #else
85 #define DPRINTK(format, args...)
86 #endif
87
88 #if DEBUG_SMB > 1
89 #define DDPRINTK(format, args...) printk(format , ## args)
90 #else
91 #define DDPRINTK(format, args...)
92 #endif
93
94
95
96 extern struct inode_operations smb_file_inode_operations;
97 int smb_make_open(struct inode *i, int right);
98
99
100 extern struct inode_operations smb_dir_inode_operations;
101 void smb_free_inode_info(struct smb_inode_info *i);
102 void smb_free_all_inodes(struct smb_server *server);
103 void smb_init_root(struct smb_server *server);
104 int smb_stat_root(struct smb_server *server);
105 void smb_init_dir_cache(void);
106 void smb_invalid_dir_cache(unsigned long ino);
107 void smb_invalidate_all_inodes(struct smb_server *server);
108 void smb_free_dir_cache(void);
109
110
111 int smb_ioctl (struct inode * inode, struct file * filp,
112 unsigned int cmd, unsigned long arg);
113
114
115 struct super_block *smb_read_super(struct super_block *sb,
116 void *raw_data, int silent);
117 extern int init_smb_fs(void);
118 int smb_notify_change(struct inode *inode, struct iattr *attr);
119 void smb_invalidate_connection(struct smb_server *server);
120 int smb_conn_is_valid(struct smb_server *server);
121
122
123 dword smb_len(unsigned char *packet);
124 byte *smb_encode_smb_length(byte *p, dword len);
125 int smb_proc_open(struct smb_server *server, const char *pathname,
126 int len, struct smb_dirent *entry);
127 int smb_proc_close(struct smb_server *server, struct smb_dirent *finfo);
128 int smb_proc_read(struct smb_server *server, struct smb_dirent *finfo,
129 off_t offset, long count, char *data, int fs);
130 int smb_proc_read_raw(struct smb_server *server, struct smb_dirent *finfo,
131 off_t offset, long count, char *data);
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_write_raw(struct smb_server *server, struct smb_dirent *finfo,
135 off_t offset, long count, const char *data);
136 int smb_proc_create(struct smb_server *server, const char *path,
137 int len, struct smb_dirent *entry);
138 int smb_proc_mknew(struct smb_server *server, const char *path, int len,
139 struct smb_dirent *entry);
140 int smb_proc_mv(struct smb_server *server, const char *opath, const int olen,
141 const char *npath, const int nlen);
142 int smb_proc_mkdir(struct smb_server *server, const char *path, const int len);
143 int smb_proc_rmdir(struct smb_server *server, const char *path, const int len);
144 int smb_proc_unlink(struct smb_server *server, const char *path,
145 const int len);
146 int smb_proc_readdir(struct smb_server *server, struct inode *dir,
147 int fpos, int cache_size,
148 struct smb_dirent *entry);
149 int smb_proc_getattr(struct smb_server *server, const char *path,
150 int len, struct smb_dirent *entry);
151 int smb_proc_setattr(struct smb_server *server,
152 struct inode *ino,
153 struct smb_dirent *new_finfo);
154 int smb_proc_chkpath(struct smb_server *server, char *path, int len,
155 int *result);
156 int smb_proc_dskattr(struct super_block *super, struct smb_dskattr *attr);
157 int smb_proc_reconnect(struct smb_server *server);
158 int smb_proc_connect(struct smb_server *server);
159 int smb_proc_disconnect(struct smb_server *server);
160 int smb_proc_trunc(struct smb_server *server, word fid, dword length);
161
162
163 int smb_release(struct smb_server *server);
164 int smb_connect(struct smb_server *server);
165 int smb_request(struct smb_server *server);
166 int smb_request_read_raw(struct smb_server *server,
167 unsigned char *target, int max_len);
168 int smb_request_write_raw(struct smb_server *server,
169 unsigned const char *source, int length);
170 int smb_catch_keepalive(struct smb_server *server);
171 int smb_dont_catch_keepalive(struct smb_server *server);
172 int smb_trans2_request(struct smb_server *server,
173 int *data_len, int *param_len,
174 char **data, char **param);
175
176
177 int smb_mmap(struct inode * inode, struct file * file, struct vm_area_struct * vma);
178
179 #endif
180
181 #endif