~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

Linux Cross Reference
Linux/include/linux/smb_fs.h

Version: ~ [ 2.4.0 ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /*
  2  *  smb_fs.h
  3  *
  4  *  Copyright (C) 1995 by Paal-Kr. Engstad and Volker Lendecke
  5  *  Copyright (C) 1997 by Volker Lendecke
  6  *
  7  */
  8 
  9 #ifndef _LINUX_SMB_FS_H
 10 #define _LINUX_SMB_FS_H
 11 
 12 #include <linux/smb.h>
 13 
 14 /*
 15  * ioctl commands
 16  */
 17 #define SMB_IOC_GETMOUNTUID             _IOR('u', 1, __kernel_old_uid_t)
 18 #define SMB_IOC_NEWCONN                 _IOW('u', 2, struct smb_conn_opt)
 19 
 20 /* __kernel_uid_t can never change, so we have to use __kernel_uid32_t */
 21 #define SMB_IOC_GETMOUNTUID32           _IOR('u', 3, __kernel_uid32_t)
 22 
 23 #ifdef __KERNEL__
 24 
 25 #include <asm/unaligned.h>
 26 
 27 #define WVAL(buf,pos) \
 28 (le16_to_cpu(get_unaligned((__u16 *)((__u8 *)(buf) + (pos)))))
 29 #define DVAL(buf,pos) \
 30 (le32_to_cpu(get_unaligned((__u32 *)((__u8 *)(buf) + (pos)))))
 31 #define WSET(buf,pos,val) \
 32 put_unaligned(cpu_to_le16((__u16)(val)), (__u16 *)((__u8 *)(buf) + (pos)))
 33 #define DSET(buf,pos,val) \
 34 put_unaligned(cpu_to_le32((__u32)(val)), (__u32 *)((__u8 *)(buf) + (pos)))
 35 
 36 /* where to find the base of the SMB packet proper */
 37 #define smb_base(buf) ((__u8 *)(((__u8 *)(buf))+4))
 38 
 39 #include <linux/vmalloc.h>
 40 
 41 #ifdef DEBUG_SMB_MALLOC
 42 
 43 extern int smb_malloced;
 44 extern int smb_current_vmalloced;
 45 
 46 static inline void *
 47 smb_vmalloc(unsigned int size)
 48 {
 49         smb_malloced += 1;
 50         smb_current_vmalloced += 1;
 51         return vmalloc(size);
 52 }
 53 
 54 static inline void
 55 smb_vfree(void *obj)
 56 {
 57         smb_current_vmalloced -= 1;
 58         vfree(obj);
 59 }
 60 
 61 #else /* DEBUG_SMB_MALLOC */
 62 
 63 #define smb_kmalloc(s,p) kmalloc(s,p)
 64 #define smb_kfree_s(o,s) kfree(o)
 65 #define smb_vmalloc(s)   vmalloc(s)
 66 #define smb_vfree(o)     vfree(o)
 67 
 68 #endif /* DEBUG_SMB_MALLOC */
 69 
 70 /*
 71  * Flags for the in-memory inode
 72  */
 73 #define SMB_F_CACHEVALID        0x01    /* directory cache valid */
 74 #define SMB_F_LOCALWRITE        0x02    /* file modified locally */
 75 
 76 
 77 /* NT1 protocol capability bits */
 78 #define SMB_CAP_RAW_MODE         0x0001
 79 #define SMB_CAP_MPX_MODE         0x0002
 80 #define SMB_CAP_UNICODE          0x0004
 81 #define SMB_CAP_LARGE_FILES      0x0008
 82 #define SMB_CAP_NT_SMBS          0x0010
 83 #define SMB_CAP_RPC_REMOTE_APIS  0x0020
 84 #define SMB_CAP_STATUS32         0x0040
 85 #define SMB_CAP_LEVEL_II_OPLOCKS 0x0080
 86 #define SMB_CAP_LOCK_AND_READ    0x0100
 87 #define SMB_CAP_NT_FIND          0x0200
 88 #define SMB_CAP_DFS              0x1000
 89 #define SMB_CAP_LARGE_READX      0x4000
 90 
 91 
 92 /* linux/fs/smbfs/mmap.c */
 93 int smb_mmap(struct file *, struct vm_area_struct *);
 94 
 95 /* linux/fs/smbfs/file.c */
 96 extern struct inode_operations smb_file_inode_operations;
 97 extern struct file_operations smb_file_operations;
 98 extern struct address_space_operations smb_file_aops;
 99 
100 /* linux/fs/smbfs/dir.c */
101 extern struct inode_operations smb_dir_inode_operations;
102 extern struct file_operations smb_dir_operations;
103 void smb_renew_times(struct dentry *);
104 
105 /* linux/fs/smbfs/ioctl.c */
106 int smb_ioctl (struct inode *, struct file *, unsigned int, unsigned long);
107 
108 /* linux/fs/smbfs/inode.c */
109 struct super_block *smb_read_super(struct super_block *, void *, int);
110 void smb_get_inode_attr(struct inode *, struct smb_fattr *);
111 void smb_invalidate_inodes(struct smb_sb_info *);
112 int  smb_revalidate_inode(struct dentry *);
113 int  smb_notify_change(struct dentry *, struct iattr *);
114 unsigned long smb_invent_inos(unsigned long);
115 struct inode *smb_iget(struct super_block *, struct smb_fattr *);
116 
117 /* linux/fs/smbfs/proc.c */
118 int smb_setcodepage(struct smb_sb_info *server, struct smb_nls_codepage *cp);
119 __u32 smb_len(unsigned char *);
120 __u8 *smb_encode_smb_length(__u8 *, __u32);
121 __u8 *smb_setup_header(struct smb_sb_info *, __u8, __u16, __u16);
122 int smb_get_rsize(struct smb_sb_info *);
123 int smb_get_wsize(struct smb_sb_info *);
124 int smb_newconn(struct smb_sb_info *, struct smb_conn_opt *);
125 int smb_errno(struct smb_sb_info *);
126 int smb_close(struct inode *);
127 int smb_close_fileid(struct dentry *, __u16);
128 int smb_open(struct dentry *, int);
129 int smb_proc_read(struct inode *, off_t, int, char *);
130 int smb_proc_write(struct inode *, off_t, int, const char *);
131 int smb_proc_create(struct dentry *, __u16, time_t, __u16 *);
132 int smb_proc_mv(struct dentry *, struct dentry *);
133 int smb_proc_mkdir(struct dentry *);
134 int smb_proc_rmdir(struct dentry *);
135 int smb_proc_unlink(struct dentry *);
136 int smb_proc_readdir(struct dentry *, int, void *);
137 int smb_proc_getattr(struct dentry *, struct smb_fattr *);
138 int smb_proc_setattr(struct dentry *, struct smb_fattr *);
139 int smb_proc_settime(struct dentry *, struct smb_fattr *);
140 int smb_proc_dskattr(struct super_block *, struct statfs *);
141 int smb_proc_reconnect(struct smb_sb_info *);
142 int smb_proc_connect(struct smb_sb_info *);
143 int smb_proc_disconnect(struct smb_sb_info *);
144 int smb_proc_trunc(struct smb_sb_info *, __u16, __u32);
145 void smb_init_root_dirent(struct smb_sb_info *, struct smb_fattr *);
146 
147 static inline int
148 smb_is_open(struct inode *i)
149 {
150         return (i->u.smbfs_i.open == SMB_SERVER(i)->generation);
151 }
152 
153 /* linux/fs/smbfs/sock.c */
154 int smb_round_length(int);
155 int smb_valid_socket(struct inode *);
156 void smb_close_socket(struct smb_sb_info *);
157 int smb_release(struct smb_sb_info *server);
158 int smb_connect(struct smb_sb_info *server);
159 int smb_request(struct smb_sb_info *server);
160 int smb_request_read_raw(struct smb_sb_info *, unsigned char *, int);
161 int smb_request_write_raw(struct smb_sb_info *, unsigned const char *, int);
162 int smb_catch_keepalive(struct smb_sb_info *server);
163 int smb_dont_catch_keepalive(struct smb_sb_info *server);
164 int smb_trans2_request(struct smb_sb_info *server, __u16 trans2_command,
165                        int ldata, unsigned char *data,
166                        int lparam, unsigned char *param,
167                        int *lrdata, unsigned char **rdata,
168                        int *lrparam, unsigned char **rparam);
169 
170 /* fs/smbfs/cache.c */
171 
172 /*
173  * The cache index describes the pages mapped starting
174  * at offset PAGE_SIZE.  We keep only a minimal amount
175  * of information here.
176  */
177 struct cache_index {
178         unsigned short num_entries;
179         unsigned short space;
180         struct cache_block * block;
181 };
182 
183 #define NINDEX (PAGE_SIZE-64)/sizeof(struct cache_index)
184 /*
185  * The cache head is mapped as the page at offset 0.
186  */
187 struct cache_head {
188         int     valid;
189         int     status;         /* error code or 0 */
190         int     entries;        /* total entries */
191         int     pages;          /* number of data pages */
192         int     idx;            /* index of current data page */
193         struct cache_index index[NINDEX];
194 };
195 
196 /*
197  * An array of cache_entry structures holds information
198  * for each object in the cache_block.
199  */
200 struct cache_entry {
201         ino_t ino;
202         unsigned short namelen;
203         unsigned short offset;
204 };
205 
206 /*
207  * The cache blocks hold the actual data.  The entry table grows up
208  * while the names grow down, and we have space until they meet.
209  */
210 struct cache_block {
211         union {
212                 struct cache_entry table[1];
213                 char    names[PAGE_SIZE];
214         } cb_data;
215 };
216 
217 /*
218  * To return an entry, we can pass a reference to the
219  * name instead of having to copy it.
220  */
221 struct cache_dirent {
222         ino_t ino;
223         unsigned long pos;
224         int len;
225         char * name;
226 };
227 
228 struct cache_head * smb_get_dircache(struct dentry *);
229 void smb_init_dircache(struct cache_head *);
230 void smb_free_dircache(struct cache_head *);
231 int  smb_refill_dircache(struct cache_head *, struct dentry *);
232 void smb_add_to_cache(struct cache_head *, struct cache_dirent *, off_t);
233 int  smb_find_in_cache(struct cache_head *, off_t, struct cache_dirent *);
234 void smb_invalid_dir_cache(struct inode *);
235 
236 #endif /* __KERNEL__ */
237 
238 #endif /* _LINUX_SMB_FS_H */
239 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

This page was automatically generated by the LXR engine.
Visit the LXR main site for more information.