smb_fs_sb.h 2.2 KB

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