diff options
Diffstat (limited to 'fs/nfs/internal.h')
-rw-r--r-- | fs/nfs/internal.h | 105 |
1 files changed, 69 insertions, 36 deletions
diff --git a/fs/nfs/internal.h b/fs/nfs/internal.h index e4f4e5def0fc..bea0b016bd70 100644 --- a/fs/nfs/internal.h +++ b/fs/nfs/internal.h | |||
@@ -4,6 +4,18 @@ | |||
4 | 4 | ||
5 | #include <linux/mount.h> | 5 | #include <linux/mount.h> |
6 | 6 | ||
7 | struct nfs_string; | ||
8 | struct nfs_mount_data; | ||
9 | struct nfs4_mount_data; | ||
10 | |||
11 | /* Maximum number of readahead requests | ||
12 | * FIXME: this should really be a sysctl so that users may tune it to suit | ||
13 | * their needs. People that do NFS over a slow network, might for | ||
14 | * instance want to reduce it to something closer to 1 for improved | ||
15 | * interactive response. | ||
16 | */ | ||
17 | #define NFS_MAX_READAHEAD (RPC_DEF_SLOT_TABLE - 1) | ||
18 | |||
7 | struct nfs_clone_mount { | 19 | struct nfs_clone_mount { |
8 | const struct super_block *sb; | 20 | const struct super_block *sb; |
9 | const struct dentry *dentry; | 21 | const struct dentry *dentry; |
@@ -15,7 +27,40 @@ struct nfs_clone_mount { | |||
15 | rpc_authflavor_t authflavor; | 27 | rpc_authflavor_t authflavor; |
16 | }; | 28 | }; |
17 | 29 | ||
18 | /* namespace-nfs4.c */ | 30 | /* client.c */ |
31 | extern struct rpc_program nfs_program; | ||
32 | |||
33 | extern void nfs_put_client(struct nfs_client *); | ||
34 | extern struct nfs_client *nfs_find_client(const struct sockaddr_in *, int); | ||
35 | extern struct nfs_server *nfs_create_server(const struct nfs_mount_data *, | ||
36 | struct nfs_fh *); | ||
37 | extern struct nfs_server *nfs4_create_server(const struct nfs4_mount_data *, | ||
38 | const char *, | ||
39 | const struct sockaddr_in *, | ||
40 | const char *, | ||
41 | const char *, | ||
42 | rpc_authflavor_t, | ||
43 | struct nfs_fh *); | ||
44 | extern struct nfs_server *nfs4_create_referral_server(struct nfs_clone_mount *, | ||
45 | struct nfs_fh *); | ||
46 | extern void nfs_free_server(struct nfs_server *server); | ||
47 | extern struct nfs_server *nfs_clone_server(struct nfs_server *, | ||
48 | struct nfs_fh *, | ||
49 | struct nfs_fattr *); | ||
50 | #ifdef CONFIG_PROC_FS | ||
51 | extern int __init nfs_fs_proc_init(void); | ||
52 | extern void nfs_fs_proc_exit(void); | ||
53 | #else | ||
54 | static inline int nfs_fs_proc_init(void) | ||
55 | { | ||
56 | return 0; | ||
57 | } | ||
58 | static inline void nfs_fs_proc_exit(void) | ||
59 | { | ||
60 | } | ||
61 | #endif | ||
62 | |||
63 | /* nfs4namespace.c */ | ||
19 | #ifdef CONFIG_NFS_V4 | 64 | #ifdef CONFIG_NFS_V4 |
20 | extern struct vfsmount *nfs_do_refmount(const struct vfsmount *mnt_parent, struct dentry *dentry); | 65 | extern struct vfsmount *nfs_do_refmount(const struct vfsmount *mnt_parent, struct dentry *dentry); |
21 | #else | 66 | #else |
@@ -46,6 +91,7 @@ extern void nfs_destroy_directcache(void); | |||
46 | #endif | 91 | #endif |
47 | 92 | ||
48 | /* nfs2xdr.c */ | 93 | /* nfs2xdr.c */ |
94 | extern int nfs_stat_to_errno(int); | ||
49 | extern struct rpc_procinfo nfs_procedures[]; | 95 | extern struct rpc_procinfo nfs_procedures[]; |
50 | extern u32 * nfs_decode_dirent(u32 *, struct nfs_entry *, int); | 96 | extern u32 * nfs_decode_dirent(u32 *, struct nfs_entry *, int); |
51 | 97 | ||
@@ -54,8 +100,9 @@ extern struct rpc_procinfo nfs3_procedures[]; | |||
54 | extern u32 *nfs3_decode_dirent(u32 *, struct nfs_entry *, int); | 100 | extern u32 *nfs3_decode_dirent(u32 *, struct nfs_entry *, int); |
55 | 101 | ||
56 | /* nfs4xdr.c */ | 102 | /* nfs4xdr.c */ |
57 | extern int nfs_stat_to_errno(int); | 103 | #ifdef CONFIG_NFS_V4 |
58 | extern u32 *nfs4_decode_dirent(u32 *p, struct nfs_entry *entry, int plus); | 104 | extern u32 *nfs4_decode_dirent(u32 *p, struct nfs_entry *entry, int plus); |
105 | #endif | ||
59 | 106 | ||
60 | /* nfs4proc.c */ | 107 | /* nfs4proc.c */ |
61 | #ifdef CONFIG_NFS_V4 | 108 | #ifdef CONFIG_NFS_V4 |
@@ -66,6 +113,9 @@ extern int nfs4_proc_fs_locations(struct inode *dir, struct dentry *dentry, | |||
66 | struct page *page); | 113 | struct page *page); |
67 | #endif | 114 | #endif |
68 | 115 | ||
116 | /* dir.c */ | ||
117 | extern int nfs_access_cache_shrinker(int nr_to_scan, gfp_t gfp_mask); | ||
118 | |||
69 | /* inode.c */ | 119 | /* inode.c */ |
70 | extern struct inode *nfs_alloc_inode(struct super_block *sb); | 120 | extern struct inode *nfs_alloc_inode(struct super_block *sb); |
71 | extern void nfs_destroy_inode(struct inode *); | 121 | extern void nfs_destroy_inode(struct inode *); |
@@ -76,10 +126,10 @@ extern void nfs4_clear_inode(struct inode *); | |||
76 | #endif | 126 | #endif |
77 | 127 | ||
78 | /* super.c */ | 128 | /* super.c */ |
79 | extern struct file_system_type nfs_referral_nfs4_fs_type; | 129 | extern struct file_system_type nfs_xdev_fs_type; |
80 | extern struct file_system_type clone_nfs_fs_type; | ||
81 | #ifdef CONFIG_NFS_V4 | 130 | #ifdef CONFIG_NFS_V4 |
82 | extern struct file_system_type clone_nfs4_fs_type; | 131 | extern struct file_system_type nfs4_xdev_fs_type; |
132 | extern struct file_system_type nfs4_referral_fs_type; | ||
83 | #endif | 133 | #endif |
84 | 134 | ||
85 | extern struct rpc_stat nfs_rpcstat; | 135 | extern struct rpc_stat nfs_rpcstat; |
@@ -88,30 +138,30 @@ extern int __init register_nfs_fs(void); | |||
88 | extern void __exit unregister_nfs_fs(void); | 138 | extern void __exit unregister_nfs_fs(void); |
89 | 139 | ||
90 | /* namespace.c */ | 140 | /* namespace.c */ |
91 | extern char *nfs_path(const char *base, const struct dentry *dentry, | 141 | extern char *nfs_path(const char *base, |
142 | const struct dentry *droot, | ||
143 | const struct dentry *dentry, | ||
92 | char *buffer, ssize_t buflen); | 144 | char *buffer, ssize_t buflen); |
93 | 145 | ||
94 | /* | 146 | /* getroot.c */ |
95 | * Determine the mount path as a string | 147 | extern struct dentry *nfs_get_root(struct super_block *, struct nfs_fh *); |
96 | */ | ||
97 | static inline char * | ||
98 | nfs4_path(const struct dentry *dentry, char *buffer, ssize_t buflen) | ||
99 | { | ||
100 | #ifdef CONFIG_NFS_V4 | 148 | #ifdef CONFIG_NFS_V4 |
101 | return nfs_path(NFS_SB(dentry->d_sb)->mnt_path, dentry, buffer, buflen); | 149 | extern struct dentry *nfs4_get_root(struct super_block *, struct nfs_fh *); |
102 | #else | 150 | |
103 | return NULL; | 151 | extern int nfs4_path_walk(struct nfs_server *server, |
152 | struct nfs_fh *mntfh, | ||
153 | const char *path); | ||
104 | #endif | 154 | #endif |
105 | } | ||
106 | 155 | ||
107 | /* | 156 | /* |
108 | * Determine the device name as a string | 157 | * Determine the device name as a string |
109 | */ | 158 | */ |
110 | static inline char *nfs_devname(const struct vfsmount *mnt_parent, | 159 | static inline char *nfs_devname(const struct vfsmount *mnt_parent, |
111 | const struct dentry *dentry, | 160 | const struct dentry *dentry, |
112 | char *buffer, ssize_t buflen) | 161 | char *buffer, ssize_t buflen) |
113 | { | 162 | { |
114 | return nfs_path(mnt_parent->mnt_devname, dentry, buffer, buflen); | 163 | return nfs_path(mnt_parent->mnt_devname, mnt_parent->mnt_root, |
164 | dentry, buffer, buflen); | ||
115 | } | 165 | } |
116 | 166 | ||
117 | /* | 167 | /* |
@@ -167,20 +217,3 @@ void nfs_super_set_maxbytes(struct super_block *sb, __u64 maxfilesize) | |||
167 | if (sb->s_maxbytes > MAX_LFS_FILESIZE || sb->s_maxbytes <= 0) | 217 | if (sb->s_maxbytes > MAX_LFS_FILESIZE || sb->s_maxbytes <= 0) |
168 | sb->s_maxbytes = MAX_LFS_FILESIZE; | 218 | sb->s_maxbytes = MAX_LFS_FILESIZE; |
169 | } | 219 | } |
170 | |||
171 | /* | ||
172 | * Check if the string represents a "valid" IPv4 address | ||
173 | */ | ||
174 | static inline int valid_ipaddr4(const char *buf) | ||
175 | { | ||
176 | int rc, count, in[4]; | ||
177 | |||
178 | rc = sscanf(buf, "%d.%d.%d.%d", &in[0], &in[1], &in[2], &in[3]); | ||
179 | if (rc != 4) | ||
180 | return -EINVAL; | ||
181 | for (count = 0; count < 4; count++) { | ||
182 | if (in[count] > 255) | ||
183 | return -EINVAL; | ||
184 | } | ||
185 | return 0; | ||
186 | } | ||