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