1 /*
2  *  smb_fs_sb.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 _SMB_FS_SB
10 #define _SMB_FS_SB
11 
12 #ifdef __KERNEL__
13 
14 #include <linux/types.h>
15 #include <linux/smb.h>
16 
17 /* structure access macros */
18 #define server_from_inode(inode) (&(inode)->i_sb->u.smbfs_sb)
19 #define server_from_dentry(dentry) (&(dentry)->d_sb->u.smbfs_sb)
20 #define SB_of(server) ((struct super_block *) ((char *)(server) - \
21 	(unsigned long)(&((struct super_block *)0)->u.smbfs_sb)))
22 
23 struct smb_sb_info {
24         enum smb_conn_state state;
25 	struct file * sock_file;
26 
27         struct smb_mount_data_kernel *mnt;
28         unsigned char *temp_buf;
29 
30 	/* Connections are counted. Each time a new socket arrives,
31 	 * generation is incremented.
32 	 */
33 	unsigned int generation;
34 	pid_t conn_pid;
35 	struct smb_conn_opt opt;
36 
37 	struct semaphore sem;
38 	wait_queue_head_t wait;
39 
40 	__u32              packet_size;
41 	unsigned char *    packet;
42         unsigned short     rcls; /* The error codes we received */
43         unsigned short     err;
44 
45         /* We use our own data_ready callback, but need the original one */
46         void *data_ready;
47 
48 	/* nls pointers for codepage conversions */
49 	struct nls_table *remote_nls;
50 	struct nls_table *local_nls;
51 
52 	/* utf8 can make strings longer so we can't do in-place conversion.
53 	   This is a buffer for temporary stuff. We only need one so no need
54 	   to put it on the stack. This points to temp_buf space. */
55 	char *name_buf;
56 
57 	struct smb_ops *ops;
58 };
59 
60 
61 static inline void
smb_lock_server(struct smb_sb_info * server)62 smb_lock_server(struct smb_sb_info *server)
63 {
64 	down(&(server->sem));
65 }
66 
67 static inline void
smb_unlock_server(struct smb_sb_info * server)68 smb_unlock_server(struct smb_sb_info *server)
69 {
70 	up(&(server->sem));
71 }
72 
73 #endif /* __KERNEL__ */
74 
75 #endif
76