patch-2.1.52 linux/include/linux/smb_fs.h

Next file: linux/include/linux/smb_fs_i.h
Previous file: linux/include/linux/smb.h
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.51/linux/include/linux/smb_fs.h linux/include/linux/smb_fs.h
@@ -2,6 +2,7 @@
  *  smb_fs.h
  *
  *  Copyright (C) 1995 by Paal-Kr. Engstad and Volker Lendecke
+ *  Copyright (C) 1997 by Volker Lendecke
  *
  */
 
@@ -9,72 +10,37 @@
 #define _LINUX_SMB_FS_H
 
 #include <linux/smb.h>
-#include <linux/fs.h>
-#include <linux/in.h>
-#include <linux/types.h>
-#include <linux/vmalloc.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)
+#define SMB_IOC_NEWCONN                 _IOW('u', 2, struct smb_conn_opt)
 
 #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
+#include <asm/unaligned.h>
 
+#define WVAL(buf,pos) \
+(le16_to_cpu(get_unaligned((__u16 *)((__u8 *)(buf) + (pos)))))
+#define DVAL(buf,pos) \
+(le32_to_cpu(get_unaligned((__u32 *)((__u8 *)(buf) + (pos)))))
+#define WSET(buf,pos,val) \
+put_unaligned(cpu_to_le16((__u16)(val)), (__u16 *)((__u8 *)(buf) + (pos)))
+#define DSET(buf,pos,val) \
+put_unaligned(cpu_to_le32((__u32)(val)), (__u32 *)((__u8 *)(buf) + (pos)))
 
+/* where to find the base of the SMB packet proper */
+#define smb_base(buf) ((__u8 *)(((__u8 *)(buf))+4))
 
-#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 */
+#include <linux/vmalloc.h>
 
 #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;
@@ -98,47 +64,20 @@
 
 #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
-}
+struct smb_sb_info;
 
 /* 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);
+struct smb_inode_info *smb_find_inode(struct smb_sb_info *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_free_all_inodes(struct smb_sb_info *server);
+void smb_init_root(struct smb_sb_info *server);
+int  smb_stat_root(struct smb_sb_info *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 */
@@ -149,63 +88,63 @@
 struct super_block *smb_read_super(struct super_block *sb,
                                    void *raw_data, int silent);
 extern int init_smb_fs(void);
+void smb_invalidate_inodes(struct smb_sb_info *server);
+int smb_revalidate_inode(struct inode *i);
+int smb_refresh_inode(struct inode *i);
 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);
+void smb_invalidate_connection(struct smb_sb_info *server);
+int smb_conn_is_valid(struct smb_sb_info *server);
+unsigned long smb_invent_inos(unsigned long n);
+struct inode *smb_iget(struct super_block *, struct smb_fattr *);
 
 /* 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,
+__u32 smb_len(unsigned char *packet);
+__u8 *smb_encode_smb_length(__u8 *p, __u32 len);
+__u8 *smb_setup_header(struct smb_sb_info *server, __u8 command,
+		       __u16 wct, __u16 bcc);
+int smb_offerconn(struct smb_sb_info *server);
+int smb_newconn(struct smb_sb_info *server, struct smb_conn_opt *opt);
+int smb_close(struct inode *);
+int smb_open(struct inode *, int);
+static inline int
+smb_is_open(struct inode *i)
+{
+	return (i->u.smbfs_i.open == SMB_SERVER(i)->generation);
+}
+
+int smb_proc_read(struct inode *, off_t, long, char *);
+int smb_proc_write(struct inode *, off_t, int, const char *);
+int smb_proc_create(struct inode *, struct qstr *, __u16, time_t);
+int smb_proc_mv(struct inode *, struct qstr *, struct inode *, struct qstr *);
+int smb_proc_mkdir(struct inode *, struct qstr *);
+int smb_proc_rmdir(struct inode *, struct qstr *);
+int smb_proc_unlink(struct inode *dir, struct qstr *);
+int smb_proc_readdir(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,
+int smb_proc_getattr(struct inode *dir, struct qstr *name,
+		     struct smb_fattr *entry);
+int smb_proc_setattr(struct smb_sb_info *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);
+                     struct smb_fattr *new_finfo);
+int smb_proc_dskattr(struct super_block *sb, struct statfs *attr);
+int smb_proc_reconnect(struct smb_sb_info *server);
+int smb_proc_connect(struct smb_sb_info *server);
+int smb_proc_disconnect(struct smb_sb_info *server);
+int smb_proc_trunc(struct smb_sb_info *server, __u16 fid, __u32 length);
+void smb_init_root_dirent(struct smb_sb_info *server, struct smb_fattr *);
 
 /* 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,
+int smb_release(struct smb_sb_info *server);
+int smb_connect(struct smb_sb_info *server);
+int smb_request(struct smb_sb_info *server);
+int smb_request_read_raw(struct smb_sb_info *server,
                          unsigned char *target, int max_len);
-int smb_request_write_raw(struct smb_server *server,
+int smb_request_write_raw(struct smb_sb_info *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 smb_catch_keepalive(struct smb_sb_info *server);
+int smb_dont_catch_keepalive(struct smb_sb_info *server);
+int smb_trans2_request(struct smb_sb_info *server, __u16 trans2_command,
 		       int ldata, unsigned char *data,
 		       int lparam, unsigned char *param,
 		       int *lrdata, unsigned char **rdata,

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov