patch-2.1.63 linux/include/linux/ncp_fs.h

Next file: linux/include/linux/nfs_fs.h
Previous file: linux/include/linux/miscdevice.h
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.62/linux/include/linux/ncp_fs.h linux/include/linux/ncp_fs.h
@@ -55,6 +55,20 @@
 
 #ifdef __KERNEL__
 
+#undef NCPFS_PARANOIA
+#define DEBUG_NCP 0
+#if DEBUG_NCP > 0
+#define DPRINTK(format, args...) printk(format , ## args)
+#else
+#define DPRINTK(format, args...)
+#endif
+
+#if DEBUG_NCP > 1
+#define DDPRINTK(format, args...) printk(format , ## args)
+#else
+#define DDPRINTK(format, args...)
+#endif
+
 /* The readdir cache size controls how many directory entries are
  * cached.
  */
@@ -62,16 +76,40 @@
 
 #define NCP_MAX_RPC_TIMEOUT (6*HZ)
 
+/*
+ * This is the ncpfs part of the inode structure. This must contain
+ * all the information we need to work with an inode after creation.
+ * (Move to ncp_fs_i.h once it stabilizes, and add a union in fs.h)
+ */
+struct ncpfs_i {
+	__u32	dirEntNum __attribute__((packed));
+	__u32	DosDirNum __attribute__((packed));
+	__u32	volNumber __attribute__((packed));
+	int	opened;
+	int	access;
+	__u32	server_file_handle __attribute__((packed));
+	__u8	open_create_action __attribute__((packed));
+	__u8	file_handle[6] __attribute__((packed));
+};
+
+/*
+ * This is an extension of the nw_file_info structure with
+ * the additional information we need to create an inode.
+ */
+struct ncpfs_inode_info {
+	ino_t	ino;		/* dummy inode number */
+	struct nw_file_info nw_info;
+};
+
 /* Guess, what 0x564c is :-) */
 #define NCP_SUPER_MAGIC  0x564c
 
 
 #define NCP_SBP(sb)          ((struct ncp_server *)((sb)->u.generic_sbp))
-#define NCP_INOP(inode)      ((struct ncp_inode_info *)((inode)->u.generic_ip))
 
 #define NCP_SERVER(inode)    NCP_SBP((inode)->i_sb)
-#define NCP_FINFO(inode)     (&(NCP_INOP(inode)->finfo))
-#define NCP_ISTRUCT(inode)   (&(NCP_FINFO(inode)->i))
+/* We don't have an ncpfs union yet, so use smbfs ... */
+#define NCP_FINFO(inode)     ((struct ncpfs_i *)&((inode)->u.smbfs_i))
 
 #ifdef DEBUG_NCP_MALLOC
 
@@ -101,46 +139,23 @@
 
 #endif				/* DEBUG_NCP_MALLOC */
 
-#if DEBUG_NCP > 0
-#define DPRINTK(format, args...) printk(format , ## args)
-#else
-#define DPRINTK(format, args...)
-#endif
-
-#if DEBUG_NCP > 1
-#define DDPRINTK(format, args...) printk(format , ## args)
-#else
-#define DDPRINTK(format, args...)
-#endif
-
-
-/* linux/fs/ncpfs/file.c */
-extern struct inode_operations ncp_file_inode_operations;
-int ncp_make_open(struct inode *i, int right);
+/* linux/fs/ncpfs/inode.c */
+struct super_block *ncp_read_super(struct super_block *, void *, int);
+struct inode *ncp_iget(struct super_block *, struct ncpfs_inode_info *);
+void ncp_update_inode(struct inode *, struct nw_file_info *);
+extern int init_ncp_fs(void);
 
 /* linux/fs/ncpfs/dir.c */
 extern struct inode_operations ncp_dir_inode_operations;
-void ncp_free_inode_info(struct ncp_inode_info *i);
-void ncp_free_all_inodes(struct ncp_server *server);
-void ncp_init_root(struct ncp_server *server);
-int ncp_conn_logged_in(struct ncp_server *server);
+int ncp_conn_logged_in(struct ncp_server *);
 void ncp_init_dir_cache(void);
-void ncp_invalid_dir_cache(struct inode *ino);
-struct ncp_inode_info *ncp_find_inode(struct inode *inode);
-ino_t ncp_info_ino(struct ncp_server *server, struct ncp_inode_info *info);
+void ncp_invalid_dir_cache(struct inode *);
 void ncp_free_dir_cache(void);
 int ncp_date_dos2unix(__u16 time, __u16 date);
 void ncp_date_unix2dos(int unix_date, __u16 * time, __u16 * date);
 
-
 /* linux/fs/ncpfs/ioctl.c */
-int ncp_ioctl(struct inode *inode, struct file *filp,
-	      unsigned int cmd, unsigned long arg);
-
-/* linux/fs/ncpfs/inode.c */
-struct super_block *ncp_read_super(struct super_block *sb,
-				   void *raw_data, int silent);
-extern int init_ncp_fs(void);
+int ncp_ioctl(struct inode *, struct file *, unsigned int, unsigned long);
 
 /* linux/fs/ncpfs/sock.c */
 int ncp_request(struct ncp_server *server, int function);
@@ -149,8 +164,50 @@
 void ncp_lock_server(struct ncp_server *server);
 void ncp_unlock_server(struct ncp_server *server);
 
+/* linux/fs/ncpfs/file.c */
+extern struct inode_operations ncp_file_inode_operations;
+int ncp_make_open(struct inode *, int);
+
 /* linux/fs/ncpfs/mmap.c */
-int ncp_mmap(struct file *file, struct vm_area_struct *vma);
+int ncp_mmap(struct file *, struct vm_area_struct *);
+
+/* linux/fs/ncpfs/ncplib_kernel.c */
+int ncp_make_closed(struct inode *);
+
+static inline void str_upper(char *name)
+{
+	while (*name) {
+		if (*name >= 'a' && *name <= 'z') {
+			*name -= ('a' - 'A');
+		}
+		name++;
+	}
+}
+
+static inline void str_lower(char *name)
+{
+	while (*name) {
+		if (*name >= 'A' && *name <= 'Z') {
+			*name += ('a' - 'A');
+		}
+		name++;
+	}
+}
+
+static inline int ncp_namespace(struct inode *inode)
+{
+	struct ncp_server *server = NCP_SERVER(inode);
+	return server->name_space[NCP_FINFO(inode)->volNumber];
+}
+
+static inline int ncp_preserve_case(struct inode *i)
+{
+	/* If we can get case-sensitive server lookups working, then
+	 *
+	 *  return (ncp_namespace(i) == NW_NS_OS2);
+	 */
+	return 0;
+}
 
 #endif				/* __KERNEL__ */
 

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