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