diff options
Diffstat (limited to 'fs/nfs/internal.h')
-rw-r--r-- | fs/nfs/internal.h | 118 |
1 files changed, 98 insertions, 20 deletions
diff --git a/fs/nfs/internal.h b/fs/nfs/internal.h index c961bc92c107..2a55347a2daa 100644 --- a/fs/nfs/internal.h +++ b/fs/nfs/internal.h | |||
@@ -39,6 +39,23 @@ static inline int nfs4_has_persistent_session(const struct nfs_client *clp) | |||
39 | return 0; | 39 | return 0; |
40 | } | 40 | } |
41 | 41 | ||
42 | static inline void nfs_attr_check_mountpoint(struct super_block *parent, struct nfs_fattr *fattr) | ||
43 | { | ||
44 | if (!nfs_fsid_equal(&NFS_SB(parent)->fsid, &fattr->fsid)) | ||
45 | fattr->valid |= NFS_ATTR_FATTR_MOUNTPOINT; | ||
46 | } | ||
47 | |||
48 | static inline int nfs_attr_use_mounted_on_fileid(struct nfs_fattr *fattr) | ||
49 | { | ||
50 | if (((fattr->valid & NFS_ATTR_FATTR_MOUNTED_ON_FILEID) == 0) || | ||
51 | (((fattr->valid & NFS_ATTR_FATTR_MOUNTPOINT) == 0) && | ||
52 | ((fattr->valid & NFS_ATTR_FATTR_V4_REFERRAL) == 0))) | ||
53 | return 0; | ||
54 | |||
55 | fattr->fileid = fattr->mounted_on_fileid; | ||
56 | return 1; | ||
57 | } | ||
58 | |||
42 | struct nfs_clone_mount { | 59 | struct nfs_clone_mount { |
43 | const struct super_block *sb; | 60 | const struct super_block *sb; |
44 | const struct dentry *dentry; | 61 | const struct dentry *dentry; |
@@ -63,6 +80,12 @@ struct nfs_clone_mount { | |||
63 | #define NFS_UNSPEC_PORT (-1) | 80 | #define NFS_UNSPEC_PORT (-1) |
64 | 81 | ||
65 | /* | 82 | /* |
83 | * Maximum number of pages that readdir can use for creating | ||
84 | * a vmapped array of pages. | ||
85 | */ | ||
86 | #define NFS_MAX_READDIR_PAGES 8 | ||
87 | |||
88 | /* | ||
66 | * In-kernel mount arguments | 89 | * In-kernel mount arguments |
67 | */ | 90 | */ |
68 | struct nfs_parsed_mount_data { | 91 | struct nfs_parsed_mount_data { |
@@ -122,9 +145,12 @@ extern void nfs_umount(const struct nfs_mount_request *info); | |||
122 | /* client.c */ | 145 | /* client.c */ |
123 | extern struct rpc_program nfs_program; | 146 | extern struct rpc_program nfs_program; |
124 | 147 | ||
148 | extern void nfs_cleanup_cb_ident_idr(void); | ||
125 | extern void nfs_put_client(struct nfs_client *); | 149 | extern void nfs_put_client(struct nfs_client *); |
126 | extern struct nfs_client *nfs_find_client(const struct sockaddr *, u32); | 150 | extern struct nfs_client *nfs4_find_client_no_ident(const struct sockaddr *); |
127 | extern struct nfs_client *nfs_find_client_next(struct nfs_client *); | 151 | extern struct nfs_client *nfs4_find_client_ident(int); |
152 | extern struct nfs_client * | ||
153 | nfs4_find_client_sessionid(const struct sockaddr *, struct nfs4_sessionid *); | ||
128 | extern struct nfs_server *nfs_create_server( | 154 | extern struct nfs_server *nfs_create_server( |
129 | const struct nfs_parsed_mount_data *, | 155 | const struct nfs_parsed_mount_data *, |
130 | struct nfs_fh *); | 156 | struct nfs_fh *); |
@@ -139,6 +165,9 @@ extern struct nfs_server *nfs_clone_server(struct nfs_server *, | |||
139 | struct nfs_fattr *); | 165 | struct nfs_fattr *); |
140 | extern void nfs_mark_client_ready(struct nfs_client *clp, int state); | 166 | extern void nfs_mark_client_ready(struct nfs_client *clp, int state); |
141 | extern int nfs4_check_client_ready(struct nfs_client *clp); | 167 | extern int nfs4_check_client_ready(struct nfs_client *clp); |
168 | extern struct nfs_client *nfs4_set_ds_client(struct nfs_client* mds_clp, | ||
169 | const struct sockaddr *ds_addr, | ||
170 | int ds_addrlen, int ds_proto); | ||
142 | #ifdef CONFIG_PROC_FS | 171 | #ifdef CONFIG_PROC_FS |
143 | extern int __init nfs_fs_proc_init(void); | 172 | extern int __init nfs_fs_proc_init(void); |
144 | extern void nfs_fs_proc_exit(void); | 173 | extern void nfs_fs_proc_exit(void); |
@@ -154,10 +183,10 @@ static inline void nfs_fs_proc_exit(void) | |||
154 | 183 | ||
155 | /* nfs4namespace.c */ | 184 | /* nfs4namespace.c */ |
156 | #ifdef CONFIG_NFS_V4 | 185 | #ifdef CONFIG_NFS_V4 |
157 | extern struct vfsmount *nfs_do_refmount(const struct vfsmount *mnt_parent, struct dentry *dentry); | 186 | extern struct vfsmount *nfs_do_refmount(struct dentry *dentry); |
158 | #else | 187 | #else |
159 | static inline | 188 | static inline |
160 | struct vfsmount *nfs_do_refmount(const struct vfsmount *mnt_parent, struct dentry *dentry) | 189 | struct vfsmount *nfs_do_refmount(struct dentry *dentry) |
161 | { | 190 | { |
162 | return ERR_PTR(-ENOENT); | 191 | return ERR_PTR(-ENOENT); |
163 | } | 192 | } |
@@ -179,17 +208,20 @@ extern int __init nfs_init_directcache(void); | |||
179 | extern void nfs_destroy_directcache(void); | 208 | extern void nfs_destroy_directcache(void); |
180 | 209 | ||
181 | /* nfs2xdr.c */ | 210 | /* nfs2xdr.c */ |
182 | extern int nfs_stat_to_errno(int); | 211 | extern int nfs_stat_to_errno(enum nfs_stat); |
183 | extern struct rpc_procinfo nfs_procedures[]; | 212 | extern struct rpc_procinfo nfs_procedures[]; |
184 | extern __be32 * nfs_decode_dirent(__be32 *, struct nfs_entry *, int); | 213 | extern int nfs2_decode_dirent(struct xdr_stream *, |
214 | struct nfs_entry *, int); | ||
185 | 215 | ||
186 | /* nfs3xdr.c */ | 216 | /* nfs3xdr.c */ |
187 | extern struct rpc_procinfo nfs3_procedures[]; | 217 | extern struct rpc_procinfo nfs3_procedures[]; |
188 | extern __be32 *nfs3_decode_dirent(__be32 *, struct nfs_entry *, int); | 218 | extern int nfs3_decode_dirent(struct xdr_stream *, |
219 | struct nfs_entry *, int); | ||
189 | 220 | ||
190 | /* nfs4xdr.c */ | 221 | /* nfs4xdr.c */ |
191 | #ifdef CONFIG_NFS_V4 | 222 | #ifdef CONFIG_NFS_V4 |
192 | extern __be32 *nfs4_decode_dirent(__be32 *p, struct nfs_entry *entry, int plus); | 223 | extern int nfs4_decode_dirent(struct xdr_stream *, |
224 | struct nfs_entry *, int); | ||
193 | #endif | 225 | #endif |
194 | #ifdef CONFIG_NFS_V4_1 | 226 | #ifdef CONFIG_NFS_V4_1 |
195 | extern const u32 nfs41_maxread_overhead; | 227 | extern const u32 nfs41_maxread_overhead; |
@@ -199,14 +231,21 @@ extern const u32 nfs41_maxwrite_overhead; | |||
199 | /* nfs4proc.c */ | 231 | /* nfs4proc.c */ |
200 | #ifdef CONFIG_NFS_V4 | 232 | #ifdef CONFIG_NFS_V4 |
201 | extern struct rpc_procinfo nfs4_procedures[]; | 233 | extern struct rpc_procinfo nfs4_procedures[]; |
234 | void nfs_fixup_secinfo_attributes(struct nfs_fattr *, struct nfs_fh *); | ||
202 | #endif | 235 | #endif |
203 | 236 | ||
237 | extern int nfs4_init_ds_session(struct nfs_client *clp); | ||
238 | |||
204 | /* proc.c */ | 239 | /* proc.c */ |
205 | void nfs_close_context(struct nfs_open_context *ctx, int is_sync); | 240 | void nfs_close_context(struct nfs_open_context *ctx, int is_sync); |
241 | extern int nfs_init_client(struct nfs_client *clp, | ||
242 | const struct rpc_timeout *timeparms, | ||
243 | const char *ip_addr, rpc_authflavor_t authflavour, | ||
244 | int noresvport); | ||
206 | 245 | ||
207 | /* dir.c */ | 246 | /* dir.c */ |
208 | extern int nfs_access_cache_shrinker(struct shrinker *shrink, | 247 | extern int nfs_access_cache_shrinker(struct shrinker *shrink, |
209 | int nr_to_scan, gfp_t gfp_mask); | 248 | struct shrink_control *sc); |
210 | 249 | ||
211 | /* inode.c */ | 250 | /* inode.c */ |
212 | extern struct workqueue_struct *nfsiod_workqueue; | 251 | extern struct workqueue_struct *nfsiod_workqueue; |
@@ -235,24 +274,45 @@ extern void nfs_sb_active(struct super_block *sb); | |||
235 | extern void nfs_sb_deactive(struct super_block *sb); | 274 | extern void nfs_sb_deactive(struct super_block *sb); |
236 | 275 | ||
237 | /* namespace.c */ | 276 | /* namespace.c */ |
238 | extern char *nfs_path(const char *base, | 277 | extern char *nfs_path(char **p, struct dentry *dentry, |
239 | const struct dentry *droot, | ||
240 | const struct dentry *dentry, | ||
241 | char *buffer, ssize_t buflen); | 278 | char *buffer, ssize_t buflen); |
279 | extern struct vfsmount *nfs_d_automount(struct path *path); | ||
242 | 280 | ||
243 | /* getroot.c */ | 281 | /* getroot.c */ |
244 | extern struct dentry *nfs_get_root(struct super_block *, struct nfs_fh *); | 282 | extern struct dentry *nfs_get_root(struct super_block *, struct nfs_fh *, |
283 | const char *); | ||
245 | #ifdef CONFIG_NFS_V4 | 284 | #ifdef CONFIG_NFS_V4 |
246 | extern struct dentry *nfs4_get_root(struct super_block *, struct nfs_fh *); | 285 | extern struct dentry *nfs4_get_root(struct super_block *, struct nfs_fh *, |
286 | const char *); | ||
247 | 287 | ||
248 | extern int nfs4_get_rootfh(struct nfs_server *server, struct nfs_fh *mntfh); | 288 | extern int nfs4_get_rootfh(struct nfs_server *server, struct nfs_fh *mntfh); |
249 | #endif | 289 | #endif |
250 | 290 | ||
251 | /* read.c */ | 291 | /* read.c */ |
292 | extern int nfs_initiate_read(struct nfs_read_data *data, struct rpc_clnt *clnt, | ||
293 | const struct rpc_call_ops *call_ops); | ||
252 | extern void nfs_read_prepare(struct rpc_task *task, void *calldata); | 294 | extern void nfs_read_prepare(struct rpc_task *task, void *calldata); |
253 | 295 | ||
254 | /* write.c */ | 296 | /* write.c */ |
297 | extern void nfs_commit_free(struct nfs_write_data *p); | ||
298 | extern int nfs_initiate_write(struct nfs_write_data *data, | ||
299 | struct rpc_clnt *clnt, | ||
300 | const struct rpc_call_ops *call_ops, | ||
301 | int how); | ||
255 | extern void nfs_write_prepare(struct rpc_task *task, void *calldata); | 302 | extern void nfs_write_prepare(struct rpc_task *task, void *calldata); |
303 | extern int nfs_initiate_commit(struct nfs_write_data *data, | ||
304 | struct rpc_clnt *clnt, | ||
305 | const struct rpc_call_ops *call_ops, | ||
306 | int how); | ||
307 | extern void nfs_init_commit(struct nfs_write_data *data, | ||
308 | struct list_head *head, | ||
309 | struct pnfs_layout_segment *lseg); | ||
310 | void nfs_retry_commit(struct list_head *page_list, | ||
311 | struct pnfs_layout_segment *lseg); | ||
312 | void nfs_commit_clear_lock(struct nfs_inode *nfsi); | ||
313 | void nfs_commitdata_release(void *data); | ||
314 | void nfs_commit_release_pages(struct nfs_write_data *data); | ||
315 | |||
256 | #ifdef CONFIG_MIGRATION | 316 | #ifdef CONFIG_MIGRATION |
257 | extern int nfs_migrate_page(struct address_space *, | 317 | extern int nfs_migrate_page(struct address_space *, |
258 | struct page *, struct page *); | 318 | struct page *, struct page *); |
@@ -261,12 +321,22 @@ extern int nfs_migrate_page(struct address_space *, | |||
261 | #endif | 321 | #endif |
262 | 322 | ||
263 | /* nfs4proc.c */ | 323 | /* nfs4proc.c */ |
264 | extern int _nfs4_call_sync(struct nfs_server *server, | 324 | extern void __nfs4_read_done_cb(struct nfs_read_data *); |
325 | extern void nfs4_reset_read(struct rpc_task *task, struct nfs_read_data *data); | ||
326 | extern int nfs4_init_client(struct nfs_client *clp, | ||
327 | const struct rpc_timeout *timeparms, | ||
328 | const char *ip_addr, | ||
329 | rpc_authflavor_t authflavour, | ||
330 | int noresvport); | ||
331 | extern void nfs4_reset_write(struct rpc_task *task, struct nfs_write_data *data); | ||
332 | extern int _nfs4_call_sync(struct rpc_clnt *clnt, | ||
333 | struct nfs_server *server, | ||
265 | struct rpc_message *msg, | 334 | struct rpc_message *msg, |
266 | struct nfs4_sequence_args *args, | 335 | struct nfs4_sequence_args *args, |
267 | struct nfs4_sequence_res *res, | 336 | struct nfs4_sequence_res *res, |
268 | int cache_reply); | 337 | int cache_reply); |
269 | extern int _nfs4_call_sync_session(struct nfs_server *server, | 338 | extern int _nfs4_call_sync_session(struct rpc_clnt *clnt, |
339 | struct nfs_server *server, | ||
270 | struct rpc_message *msg, | 340 | struct rpc_message *msg, |
271 | struct nfs4_sequence_args *args, | 341 | struct nfs4_sequence_args *args, |
272 | struct nfs4_sequence_res *res, | 342 | struct nfs4_sequence_res *res, |
@@ -275,12 +345,11 @@ extern int _nfs4_call_sync_session(struct nfs_server *server, | |||
275 | /* | 345 | /* |
276 | * Determine the device name as a string | 346 | * Determine the device name as a string |
277 | */ | 347 | */ |
278 | static inline char *nfs_devname(const struct vfsmount *mnt_parent, | 348 | static inline char *nfs_devname(struct dentry *dentry, |
279 | const struct dentry *dentry, | ||
280 | char *buffer, ssize_t buflen) | 349 | char *buffer, ssize_t buflen) |
281 | { | 350 | { |
282 | return nfs_path(mnt_parent->mnt_devname, mnt_parent->mnt_root, | 351 | char *dummy; |
283 | dentry, buffer, buflen); | 352 | return nfs_path(&dummy, dentry, buffer, buflen); |
284 | } | 353 | } |
285 | 354 | ||
286 | /* | 355 | /* |
@@ -356,6 +425,15 @@ unsigned int nfs_page_length(struct page *page) | |||
356 | } | 425 | } |
357 | 426 | ||
358 | /* | 427 | /* |
428 | * Convert a umode to a dirent->d_type | ||
429 | */ | ||
430 | static inline | ||
431 | unsigned char nfs_umode_to_dtype(umode_t mode) | ||
432 | { | ||
433 | return (mode >> 12) & 15; | ||
434 | } | ||
435 | |||
436 | /* | ||
359 | * Determine the number of pages in an array of length 'len' and | 437 | * Determine the number of pages in an array of length 'len' and |
360 | * with a base offset of 'base' | 438 | * with a base offset of 'base' |
361 | */ | 439 | */ |