| 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
| 2 | #include <linux/ncp_fs.h> |
| 3 | #include "ncp_fs_i.h" |
| 4 | #include "ncp_fs_sb.h" |
| 5 | |
| 6 | #undef NCPFS_PARANOIA |
| 7 | #ifdef NCPFS_PARANOIA |
| 8 | #define ncp_vdbg(fmt, ...) \ |
| 9 | pr_debug(fmt, ##__VA_ARGS__) |
| 10 | #else |
| 11 | #define ncp_vdbg(fmt, ...) \ |
| 12 | do { \ |
| 13 | if (0) \ |
| 14 | pr_debug(fmt, ##__VA_ARGS__); \ |
| 15 | } while (0) |
| 16 | #endif |
| 17 | |
| 18 | #ifndef DEBUG_NCP |
| 19 | #define DEBUG_NCP 0 |
| 20 | #endif |
| 21 | |
| 22 | #if DEBUG_NCP > 0 && !defined(DEBUG) |
| 23 | #define DEBUG |
| 24 | #endif |
| 25 | |
| 26 | #define ncp_dbg(level, fmt, ...) \ |
| 27 | do { \ |
| 28 | if (level <= DEBUG_NCP) \ |
| 29 | pr_debug(fmt, ##__VA_ARGS__); \ |
| 30 | } while (0) |
| 31 | |
| 32 | #define NCP_MAX_RPC_TIMEOUT (6*HZ) |
| 33 | |
| 34 | |
| 35 | struct ncp_entry_info { |
| 36 | struct nw_info_struct i; |
| 37 | ino_t ino; |
| 38 | int opened; |
| 39 | int access; |
| 40 | unsigned int volume; |
| 41 | __u8 file_handle[6]; |
| 42 | }; |
| 43 | |
| 44 | static inline struct ncp_server *NCP_SBP(const struct super_block *sb) |
| 45 | { |
| 46 | return sb->s_fs_info; |
| 47 | } |
| 48 | |
| 49 | #define NCP_SERVER(inode) NCP_SBP((inode)->i_sb) |
| 50 | static inline struct ncp_inode_info *NCP_FINFO(const struct inode *inode) |
| 51 | { |
| 52 | return container_of(inode, struct ncp_inode_info, vfs_inode); |
| 53 | } |
| 54 | |
| 55 | /* linux/fs/ncpfs/inode.c */ |
| 56 | int ncp_notify_change(struct dentry *, struct iattr *); |
| 57 | struct inode *ncp_iget(struct super_block *, struct ncp_entry_info *); |
| 58 | void ncp_update_inode(struct inode *, struct ncp_entry_info *); |
| 59 | void ncp_update_inode2(struct inode *, struct ncp_entry_info *); |
| 60 | |
| 61 | /* linux/fs/ncpfs/dir.c */ |
| 62 | extern const struct inode_operations ncp_dir_inode_operations; |
| 63 | extern const struct file_operations ncp_dir_operations; |
| 64 | extern const struct dentry_operations ncp_dentry_operations; |
| 65 | int ncp_conn_logged_in(struct super_block *); |
| 66 | int ncp_date_dos2unix(__le16 time, __le16 date); |
| 67 | void ncp_date_unix2dos(int unix_date, __le16 * time, __le16 * date); |
| 68 | |
| 69 | /* linux/fs/ncpfs/ioctl.c */ |
| 70 | long ncp_ioctl(struct file *, unsigned int, unsigned long); |
| 71 | long ncp_compat_ioctl(struct file *, unsigned int, unsigned long); |
| 72 | |
| 73 | /* linux/fs/ncpfs/sock.c */ |
| 74 | int ncp_request2(struct ncp_server *server, int function, |
| 75 | void* reply, int max_reply_size); |
| 76 | static inline int ncp_request(struct ncp_server *server, int function) { |
| 77 | return ncp_request2(server, function, server->packet, server->packet_size); |
| 78 | } |
| 79 | int ncp_connect(struct ncp_server *server); |
| 80 | int ncp_disconnect(struct ncp_server *server); |
| 81 | void ncp_lock_server(struct ncp_server *server); |
| 82 | void ncp_unlock_server(struct ncp_server *server); |
| 83 | |
| 84 | /* linux/fs/ncpfs/symlink.c */ |
| 85 | #if defined(CONFIG_NCPFS_EXTRAS) || defined(CONFIG_NCPFS_NFS_NS) |
| 86 | extern const struct address_space_operations ncp_symlink_aops; |
| 87 | int ncp_symlink(struct inode*, struct dentry*, const char*); |
| 88 | #endif |
| 89 | |
| 90 | /* linux/fs/ncpfs/file.c */ |
| 91 | extern const struct inode_operations ncp_file_inode_operations; |
| 92 | extern const struct file_operations ncp_file_operations; |
| 93 | int ncp_make_open(struct inode *, int); |
| 94 | |
| 95 | /* linux/fs/ncpfs/mmap.c */ |
| 96 | int ncp_mmap(struct file *, struct vm_area_struct *); |
| 97 | |
| 98 | /* linux/fs/ncpfs/ncplib_kernel.c */ |
| 99 | int ncp_make_closed(struct inode *); |
| 100 | |
| 101 | #include "ncplib_kernel.h" |