1 |
1633 |
jcastillo |
/*
|
2 |
|
|
* smb_fs.h
|
3 |
|
|
*
|
4 |
|
|
* Copyright (C) 1995 by Paal-Kr. Engstad and Volker Lendecke
|
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 |
|
|
* ioctl commands
|
22 |
|
|
*/
|
23 |
|
|
#define SMB_IOC_GETMOUNTUID _IOR('u', 1, uid_t)
|
24 |
|
|
|
25 |
|
|
#ifdef __KERNEL__
|
26 |
|
|
|
27 |
|
|
/*
|
28 |
|
|
* The readdir cache size controls how many directory entries are cached.
|
29 |
|
|
*/
|
30 |
|
|
#define SMB_READDIR_CACHE_SIZE 64
|
31 |
|
|
|
32 |
|
|
/*
|
33 |
|
|
* This defines the number of filenames cached in memory to avoid
|
34 |
|
|
* constructing filenames from \
|
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 /* includes everything up to, but not
|
51 |
|
|
* including smb_bcc */
|
52 |
|
|
|
53 |
|
|
#ifdef DEBUG_SMB_MALLOC
|
54 |
|
|
|
55 |
|
|
#include <linux/malloc.h>
|
56 |
|
|
|
57 |
|
|
extern int smb_malloced;
|
58 |
|
|
extern int smb_current_kmalloced;
|
59 |
|
|
extern int smb_current_vmalloced;
|
60 |
|
|
|
61 |
|
|
static inline void *
|
62 |
|
|
smb_kmalloc(unsigned int size, int priority)
|
63 |
|
|
{
|
64 |
|
|
smb_malloced += 1;
|
65 |
|
|
smb_current_kmalloced += 1;
|
66 |
|
|
return kmalloc(size, priority);
|
67 |
|
|
}
|
68 |
|
|
|
69 |
|
|
static inline void
|
70 |
|
|
smb_kfree_s(void *obj, int size)
|
71 |
|
|
{
|
72 |
|
|
smb_current_kmalloced -= 1;
|
73 |
|
|
kfree_s(obj, size);
|
74 |
|
|
}
|
75 |
|
|
|
76 |
|
|
static inline void *
|
77 |
|
|
smb_vmalloc(unsigned int size)
|
78 |
|
|
{
|
79 |
|
|
smb_malloced += 1;
|
80 |
|
|
smb_current_vmalloced += 1;
|
81 |
|
|
return vmalloc(size);
|
82 |
|
|
}
|
83 |
|
|
|
84 |
|
|
static inline void
|
85 |
|
|
smb_vfree(void *obj)
|
86 |
|
|
{
|
87 |
|
|
smb_current_vmalloced -= 1;
|
88 |
|
|
vfree(obj);
|
89 |
|
|
}
|
90 |
|
|
|
91 |
|
|
#else /* DEBUG_SMB_MALLOC */
|
92 |
|
|
|
93 |
|
|
#define smb_kmalloc(s,p) kmalloc(s,p)
|
94 |
|
|
#define smb_kfree_s(o,s) kfree_s(o,s)
|
95 |
|
|
#define smb_vmalloc(s) vmalloc(s)
|
96 |
|
|
#define smb_vfree(o) vfree(o)
|
97 |
|
|
|
98 |
|
|
#endif /* DEBUG_SMB_MALLOC */
|
99 |
|
|
|
100 |
|
|
#if DEBUG_SMB > 0
|
101 |
|
|
#define DPRINTK(format, args...) printk(format , ## args)
|
102 |
|
|
#else
|
103 |
|
|
#define DPRINTK(format, args...)
|
104 |
|
|
#endif
|
105 |
|
|
|
106 |
|
|
#if DEBUG_SMB > 1
|
107 |
|
|
#define DDPRINTK(format, args...) printk(format , ## args)
|
108 |
|
|
#else
|
109 |
|
|
#define DDPRINTK(format, args...)
|
110 |
|
|
#endif
|
111 |
|
|
|
112 |
|
|
|
113 |
|
|
static inline ino_t
|
114 |
|
|
smb_info_ino(struct smb_inode_info *info)
|
115 |
|
|
{
|
116 |
|
|
#if 0
|
117 |
|
|
return (ino_t) info;
|
118 |
|
|
#else
|
119 |
|
|
if (info != NULL)
|
120 |
|
|
{
|
121 |
|
|
return info->finfo.f_ino;
|
122 |
|
|
}
|
123 |
|
|
return 1;
|
124 |
|
|
#endif
|
125 |
|
|
}
|
126 |
|
|
|
127 |
|
|
/* linux/fs/smbfs/file.c */
|
128 |
|
|
extern struct inode_operations smb_file_inode_operations;
|
129 |
|
|
int smb_make_open(struct inode *i, int right);
|
130 |
|
|
|
131 |
|
|
/* linux/fs/smbfs/dir.c */
|
132 |
|
|
extern struct inode_operations smb_dir_inode_operations;
|
133 |
|
|
struct smb_inode_info *smb_find_inode(struct smb_server *server, ino_t ino);
|
134 |
|
|
void smb_free_inode_info(struct smb_inode_info *i);
|
135 |
|
|
void smb_free_all_inodes(struct smb_server *server);
|
136 |
|
|
void smb_init_root(struct smb_server *server);
|
137 |
|
|
int smb_stat_root(struct smb_server *server);
|
138 |
|
|
void smb_init_dir_cache(void);
|
139 |
|
|
void smb_invalid_dir_cache(unsigned long ino);
|
140 |
|
|
void smb_invalidate_all_inodes(struct smb_server *server);
|
141 |
|
|
void smb_free_dir_cache(void);
|
142 |
|
|
|
143 |
|
|
/* linux/fs/smbfs/ioctl.c */
|
144 |
|
|
int smb_ioctl (struct inode * inode, struct file * filp,
|
145 |
|
|
unsigned int cmd, unsigned long arg);
|
146 |
|
|
|
147 |
|
|
/* linux/fs/smbfs/inode.c */
|
148 |
|
|
struct super_block *smb_read_super(struct super_block *sb,
|
149 |
|
|
void *raw_data, int silent);
|
150 |
|
|
extern int init_smb_fs(void);
|
151 |
|
|
int smb_notify_change(struct inode *inode, struct iattr *attr);
|
152 |
|
|
void smb_invalidate_connection(struct smb_server *server);
|
153 |
|
|
int smb_conn_is_valid(struct smb_server *server);
|
154 |
|
|
|
155 |
|
|
/* linux/fs/smbfs/proc.c */
|
156 |
|
|
dword smb_len(unsigned char *packet);
|
157 |
|
|
byte *smb_encode_smb_length(byte *p, dword len);
|
158 |
|
|
__u8 *smb_setup_header(struct smb_server *server, byte command,
|
159 |
|
|
word wct, word bcc);
|
160 |
|
|
void smb_init_root_dirent(struct smb_server *server, struct smb_dirent *entry);
|
161 |
|
|
int smb_proc_open(struct smb_server *server,
|
162 |
|
|
struct smb_inode_info *dir, const char *name, int len,
|
163 |
|
|
struct smb_dirent *entry);
|
164 |
|
|
int smb_proc_close(struct smb_server *server,
|
165 |
|
|
__u16 fileid, __u32 mtime);
|
166 |
|
|
int smb_proc_read(struct smb_server *server, struct smb_dirent *finfo,
|
167 |
|
|
off_t offset, long count, char *data, int fs);
|
168 |
|
|
int smb_proc_read_raw(struct smb_server *server, struct smb_dirent *finfo,
|
169 |
|
|
off_t offset, long count, char *data);
|
170 |
|
|
int smb_proc_write(struct smb_server *server, struct smb_dirent *finfo,
|
171 |
|
|
off_t offset, int count, const char *data);
|
172 |
|
|
int smb_proc_write_raw(struct smb_server *server, struct smb_dirent *finfo,
|
173 |
|
|
off_t offset, long count, const char *data);
|
174 |
|
|
int smb_proc_create(struct inode *dir, const char *name, int len,
|
175 |
|
|
word attr, time_t ctime);
|
176 |
|
|
int smb_proc_mv(struct inode *odir, const char *oname, const int olen,
|
177 |
|
|
struct inode *ndir, const char *nname, const int nlen);
|
178 |
|
|
int smb_proc_mkdir(struct inode *dir, const char *name, const int len);
|
179 |
|
|
int smb_proc_rmdir(struct inode *dir, const char *name, const int len);
|
180 |
|
|
int smb_proc_unlink(struct inode *dir, const char *name, const int len);
|
181 |
|
|
int smb_proc_readdir(struct smb_server *server, struct inode *dir,
|
182 |
|
|
int fpos, int cache_size,
|
183 |
|
|
struct smb_dirent *entry);
|
184 |
|
|
int smb_proc_getattr(struct inode *dir, const char *name, int len,
|
185 |
|
|
struct smb_dirent *entry);
|
186 |
|
|
int smb_proc_setattr(struct smb_server *server,
|
187 |
|
|
struct inode *ino,
|
188 |
|
|
struct smb_dirent *new_finfo);
|
189 |
|
|
int smb_proc_chkpath(struct smb_server *server, char *path, int len,
|
190 |
|
|
int *result);
|
191 |
|
|
int smb_proc_dskattr(struct super_block *super, struct smb_dskattr *attr);
|
192 |
|
|
int smb_proc_reconnect(struct smb_server *server);
|
193 |
|
|
int smb_proc_connect(struct smb_server *server);
|
194 |
|
|
int smb_proc_disconnect(struct smb_server *server);
|
195 |
|
|
int smb_proc_trunc(struct smb_server *server, word fid, dword length);
|
196 |
|
|
|
197 |
|
|
/* linux/fs/smbfs/sock.c */
|
198 |
|
|
int smb_release(struct smb_server *server);
|
199 |
|
|
int smb_connect(struct smb_server *server);
|
200 |
|
|
int smb_request(struct smb_server *server);
|
201 |
|
|
int smb_request_read_raw(struct smb_server *server,
|
202 |
|
|
unsigned char *target, int max_len);
|
203 |
|
|
int smb_request_write_raw(struct smb_server *server,
|
204 |
|
|
unsigned const char *source, int length);
|
205 |
|
|
int smb_catch_keepalive(struct smb_server *server);
|
206 |
|
|
int smb_dont_catch_keepalive(struct smb_server *server);
|
207 |
|
|
int smb_trans2_request(struct smb_server *server, __u16 trans2_command,
|
208 |
|
|
int ldata, unsigned char *data,
|
209 |
|
|
int lparam, unsigned char *param,
|
210 |
|
|
int *lrdata, unsigned char **rdata,
|
211 |
|
|
int *lrparam, unsigned char **rparam);
|
212 |
|
|
|
213 |
|
|
/* linux/fs/smbfs/mmap.c */
|
214 |
|
|
int smb_mmap(struct inode * inode, struct file * file, struct vm_area_struct * vma);
|
215 |
|
|
|
216 |
|
|
#endif /* __KERNEL__ */
|
217 |
|
|
|
218 |
|
|
#endif /* _LINUX_SMB_FS_H */
|