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
23struct 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	int (*convert)(char *, int, const char *, int,
58		       struct nls_table *, struct nls_table *);
59};
60
61
62static inline void
63smb_lock_server(struct smb_sb_info *server)
64{
65	down(&(server->sem));
66}
67
68static inline void
69smb_unlock_server(struct smb_sb_info *server)
70{
71	up(&(server->sem));
72}
73
74#endif /* __KERNEL__ */
75
76#endif
77