Subversion Repositories shark

Rev

Rev 422 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
422 giacomo 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
/*
18
 * Upper limit on the total number of active smb_request structs.
19
 */
20
#define MAX_REQUEST_HARD       256
21
 
22
enum smb_receive_state {
23
        SMB_RECV_START,         /* No data read, looking for length + sig */
24
        SMB_RECV_HEADER,        /* Reading the header data */
25
        SMB_RECV_HCOMPLETE,     /* Done with the header */
26
        SMB_RECV_PARAM,         /* Reading parameter words */
27
        SMB_RECV_DATA,          /* Reading data bytes */
28
        SMB_RECV_END,           /* End of request */
29
        SMB_RECV_DROP,          /* Dropping this SMB */
30
        SMB_RECV_REQUEST,       /* Received a request and not a reply */
31
};
32
 
33
/* structure access macros */
34
#define server_from_inode(inode) SMB_SB((inode)->i_sb)
35
#define server_from_dentry(dentry) SMB_SB((dentry)->d_sb)
36
#define SB_of(server) ((server)->super_block)
37
 
38
struct smb_sb_info {
39
        /* List of all smbfs superblocks */
40
        struct list_head entry;
41
 
42
        enum smb_conn_state state;
43
        struct file * sock_file;
44
        int conn_error;
45
        enum smb_receive_state rstate;
46
 
47
        atomic_t nr_requests;
48
        struct list_head xmitq;
49
        struct list_head recvq;
50
        u16 mid;
51
 
52
        struct smb_mount_data_kernel *mnt;
53
 
54
        /* Connections are counted. Each time a new socket arrives,
55
         * generation is incremented.
56
         */
57
        unsigned int generation;
58
        pid_t conn_pid;
59
        struct smb_conn_opt opt;
60
 
61
        struct semaphore sem;
62
 
63
        unsigned short     rcls; /* The error codes we received */
64
        unsigned short     err;
65
 
66
        unsigned char      header[SMB_HEADER_LEN + 20*2 + 2];
67
        u32                header_len;
68
        u32                smb_len;
69
        u32                smb_read;
70
 
71
        /* We use our own data_ready callback, but need the original one */
72
        void *data_ready;
73
 
74
        /* nls pointers for codepage conversions */
75
        struct nls_table *remote_nls;
76
        struct nls_table *local_nls;
77
 
78
        struct smb_ops *ops;
79
 
80
        struct super_block *super_block;
81
};
82
 
83
static inline int
84
smb_lock_server_interruptible(struct smb_sb_info *server)
85
{
86
        return down_interruptible(&(server->sem));
87
}
88
 
89
static inline void
90
smb_lock_server(struct smb_sb_info *server)
91
{
92
        down(&(server->sem));
93
}
94
 
95
static inline void
96
smb_unlock_server(struct smb_sb_info *server)
97
{
98
        up(&(server->sem));
99
}
100
 
101
#endif /* __KERNEL__ */
102
 
103
#endif