/include/linux/ncp_fs.h

https://bitbucket.org/thekraven/iscream_thunderc-2.6.35 · C++ Header · 274 lines · 199 code · 52 blank · 23 comment · 9 complexity · e0447c7604fca2c068b9d29f07da8668 MD5 · raw file

  1. /*
  2. * ncp_fs.h
  3. *
  4. * Copyright (C) 1995, 1996 by Volker Lendecke
  5. *
  6. */
  7. #ifndef _LINUX_NCP_FS_H
  8. #define _LINUX_NCP_FS_H
  9. #include <linux/fs.h>
  10. #include <linux/in.h>
  11. #include <linux/types.h>
  12. #include <linux/magic.h>
  13. #include <linux/ipx.h>
  14. #include <linux/ncp_no.h>
  15. /*
  16. * ioctl commands
  17. */
  18. struct ncp_ioctl_request {
  19. unsigned int function;
  20. unsigned int size;
  21. char __user *data;
  22. };
  23. struct ncp_fs_info {
  24. int version;
  25. struct sockaddr_ipx addr;
  26. __kernel_uid_t mounted_uid;
  27. int connection; /* Connection number the server assigned us */
  28. int buffer_size; /* The negotiated buffer size, to be
  29. used for read/write requests! */
  30. int volume_number;
  31. __le32 directory_id;
  32. };
  33. struct ncp_fs_info_v2 {
  34. int version;
  35. unsigned long mounted_uid;
  36. unsigned int connection;
  37. unsigned int buffer_size;
  38. unsigned int volume_number;
  39. __le32 directory_id;
  40. __u32 dummy1;
  41. __u32 dummy2;
  42. __u32 dummy3;
  43. };
  44. struct ncp_sign_init
  45. {
  46. char sign_root[8];
  47. char sign_last[16];
  48. };
  49. struct ncp_lock_ioctl
  50. {
  51. #define NCP_LOCK_LOG 0
  52. #define NCP_LOCK_SH 1
  53. #define NCP_LOCK_EX 2
  54. #define NCP_LOCK_CLEAR 256
  55. int cmd;
  56. int origin;
  57. unsigned int offset;
  58. unsigned int length;
  59. #define NCP_LOCK_DEFAULT_TIMEOUT 18
  60. #define NCP_LOCK_MAX_TIMEOUT 180
  61. int timeout;
  62. };
  63. struct ncp_setroot_ioctl
  64. {
  65. int volNumber;
  66. int namespace;
  67. __le32 dirEntNum;
  68. };
  69. struct ncp_objectname_ioctl
  70. {
  71. #define NCP_AUTH_NONE 0x00
  72. #define NCP_AUTH_BIND 0x31
  73. #define NCP_AUTH_NDS 0x32
  74. int auth_type;
  75. size_t object_name_len;
  76. void __user * object_name; /* a userspace data, in most cases user name */
  77. };
  78. struct ncp_privatedata_ioctl
  79. {
  80. size_t len;
  81. void __user * data; /* ~1000 for NDS */
  82. };
  83. /* NLS charsets by ioctl */
  84. #define NCP_IOCSNAME_LEN 20
  85. struct ncp_nls_ioctl
  86. {
  87. unsigned char codepage[NCP_IOCSNAME_LEN+1];
  88. unsigned char iocharset[NCP_IOCSNAME_LEN+1];
  89. };
  90. #define NCP_IOC_NCPREQUEST _IOR('n', 1, struct ncp_ioctl_request)
  91. #define NCP_IOC_GETMOUNTUID _IOW('n', 2, __kernel_old_uid_t)
  92. #define NCP_IOC_GETMOUNTUID2 _IOW('n', 2, unsigned long)
  93. #define NCP_IOC_CONN_LOGGED_IN _IO('n', 3)
  94. #define NCP_GET_FS_INFO_VERSION (1)
  95. #define NCP_IOC_GET_FS_INFO _IOWR('n', 4, struct ncp_fs_info)
  96. #define NCP_GET_FS_INFO_VERSION_V2 (2)
  97. #define NCP_IOC_GET_FS_INFO_V2 _IOWR('n', 4, struct ncp_fs_info_v2)
  98. #define NCP_IOC_SIGN_INIT _IOR('n', 5, struct ncp_sign_init)
  99. #define NCP_IOC_SIGN_WANTED _IOR('n', 6, int)
  100. #define NCP_IOC_SET_SIGN_WANTED _IOW('n', 6, int)
  101. #define NCP_IOC_LOCKUNLOCK _IOR('n', 7, struct ncp_lock_ioctl)
  102. #define NCP_IOC_GETROOT _IOW('n', 8, struct ncp_setroot_ioctl)
  103. #define NCP_IOC_SETROOT _IOR('n', 8, struct ncp_setroot_ioctl)
  104. #define NCP_IOC_GETOBJECTNAME _IOWR('n', 9, struct ncp_objectname_ioctl)
  105. #define NCP_IOC_SETOBJECTNAME _IOR('n', 9, struct ncp_objectname_ioctl)
  106. #define NCP_IOC_GETPRIVATEDATA _IOWR('n', 10, struct ncp_privatedata_ioctl)
  107. #define NCP_IOC_SETPRIVATEDATA _IOR('n', 10, struct ncp_privatedata_ioctl)
  108. #define NCP_IOC_GETCHARSETS _IOWR('n', 11, struct ncp_nls_ioctl)
  109. #define NCP_IOC_SETCHARSETS _IOR('n', 11, struct ncp_nls_ioctl)
  110. #define NCP_IOC_GETDENTRYTTL _IOW('n', 12, __u32)
  111. #define NCP_IOC_SETDENTRYTTL _IOR('n', 12, __u32)
  112. /*
  113. * The packet size to allocate. One page should be enough.
  114. */
  115. #define NCP_PACKET_SIZE 4070
  116. #define NCP_MAXPATHLEN 255
  117. #define NCP_MAXNAMELEN 14
  118. #ifdef __KERNEL__
  119. #include <linux/ncp_fs_i.h>
  120. #include <linux/ncp_fs_sb.h>
  121. /* define because it is easy to change PRINTK to {*}PRINTK */
  122. #define PRINTK(format, args...) printk(KERN_DEBUG format , ## args)
  123. #undef NCPFS_PARANOIA
  124. #ifdef NCPFS_PARANOIA
  125. #define PPRINTK(format, args...) PRINTK(format , ## args)
  126. #else
  127. #define PPRINTK(format, args...)
  128. #endif
  129. #ifndef DEBUG_NCP
  130. #define DEBUG_NCP 0
  131. #endif
  132. #if DEBUG_NCP > 0
  133. #define DPRINTK(format, args...) PRINTK(format , ## args)
  134. #else
  135. #define DPRINTK(format, args...)
  136. #endif
  137. #if DEBUG_NCP > 1
  138. #define DDPRINTK(format, args...) PRINTK(format , ## args)
  139. #else
  140. #define DDPRINTK(format, args...)
  141. #endif
  142. #define NCP_MAX_RPC_TIMEOUT (6*HZ)
  143. struct ncp_entry_info {
  144. struct nw_info_struct i;
  145. ino_t ino;
  146. int opened;
  147. int access;
  148. unsigned int volume;
  149. __u8 file_handle[6];
  150. };
  151. static inline struct ncp_server *NCP_SBP(struct super_block *sb)
  152. {
  153. return sb->s_fs_info;
  154. }
  155. #define NCP_SERVER(inode) NCP_SBP((inode)->i_sb)
  156. static inline struct ncp_inode_info *NCP_FINFO(struct inode *inode)
  157. {
  158. return container_of(inode, struct ncp_inode_info, vfs_inode);
  159. }
  160. /* linux/fs/ncpfs/inode.c */
  161. int ncp_notify_change(struct dentry *, struct iattr *);
  162. struct inode *ncp_iget(struct super_block *, struct ncp_entry_info *);
  163. void ncp_update_inode(struct inode *, struct ncp_entry_info *);
  164. void ncp_update_inode2(struct inode *, struct ncp_entry_info *);
  165. /* linux/fs/ncpfs/dir.c */
  166. extern const struct inode_operations ncp_dir_inode_operations;
  167. extern const struct file_operations ncp_dir_operations;
  168. extern const struct dentry_operations ncp_root_dentry_operations;
  169. int ncp_conn_logged_in(struct super_block *);
  170. int ncp_date_dos2unix(__le16 time, __le16 date);
  171. void ncp_date_unix2dos(int unix_date, __le16 * time, __le16 * date);
  172. /* linux/fs/ncpfs/ioctl.c */
  173. long ncp_ioctl(struct file *, unsigned int, unsigned long);
  174. long ncp_compat_ioctl(struct file *, unsigned int, unsigned long);
  175. /* linux/fs/ncpfs/sock.c */
  176. int ncp_request2(struct ncp_server *server, int function,
  177. void* reply, int max_reply_size);
  178. static inline int ncp_request(struct ncp_server *server, int function) {
  179. return ncp_request2(server, function, server->packet, server->packet_size);
  180. }
  181. int ncp_connect(struct ncp_server *server);
  182. int ncp_disconnect(struct ncp_server *server);
  183. void ncp_lock_server(struct ncp_server *server);
  184. void ncp_unlock_server(struct ncp_server *server);
  185. /* linux/fs/ncpfs/symlink.c */
  186. #if defined(CONFIG_NCPFS_EXTRAS) || defined(CONFIG_NCPFS_NFS_NS)
  187. extern const struct address_space_operations ncp_symlink_aops;
  188. int ncp_symlink(struct inode*, struct dentry*, const char*);
  189. #endif
  190. /* linux/fs/ncpfs/file.c */
  191. extern const struct inode_operations ncp_file_inode_operations;
  192. extern const struct file_operations ncp_file_operations;
  193. int ncp_make_open(struct inode *, int);
  194. /* linux/fs/ncpfs/mmap.c */
  195. int ncp_mmap(struct file *, struct vm_area_struct *);
  196. /* linux/fs/ncpfs/ncplib_kernel.c */
  197. int ncp_make_closed(struct inode *);
  198. #define ncp_namespace(i) (NCP_SERVER(i)->name_space[NCP_FINFO(i)->volNumber])
  199. static inline int ncp_preserve_entry_case(struct inode *i, __u32 nscreator)
  200. {
  201. #ifdef CONFIG_NCPFS_SMALLDOS
  202. int ns = ncp_namespace(i);
  203. if ((ns == NW_NS_DOS)
  204. #ifdef CONFIG_NCPFS_OS2_NS
  205. || ((ns == NW_NS_OS2) && (nscreator == NW_NS_DOS))
  206. #endif /* CONFIG_NCPFS_OS2_NS */
  207. )
  208. return 0;
  209. #endif /* CONFIG_NCPFS_SMALLDOS */
  210. return 1;
  211. }
  212. #define ncp_preserve_case(i) (ncp_namespace(i) != NW_NS_DOS)
  213. static inline int ncp_case_sensitive(struct inode *i)
  214. {
  215. #ifdef CONFIG_NCPFS_NFS_NS
  216. return ncp_namespace(i) == NW_NS_NFS;
  217. #else
  218. return 0;
  219. #endif /* CONFIG_NCPFS_NFS_NS */
  220. }
  221. #endif /* __KERNEL__ */
  222. #endif /* _LINUX_NCP_FS_H */