diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2013-05-15 20:23:06 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2013-06-29 04:46:48 -0400 |
commit | 5f99f4e79abc64ed9d93a4b0158b21c64ff7f478 (patch) | |
tree | bb76629861592bee919344521fb2d55ce866a17f /include/linux/fs.h | |
parent | 80886298c07234331458e963b5f9f57c68edd700 (diff) |
[readdir] switch dcache_readdir() users to ->iterate()
new helpers - dir_emit_dot(file, ctx, dentry), dir_emit_dotdot(file, ctx),
dir_emit_dots(file, ctx).
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'include/linux/fs.h')
-rw-r--r-- | include/linux/fs.h | 39 |
1 files changed, 32 insertions, 7 deletions
diff --git a/include/linux/fs.h b/include/linux/fs.h index b9641ae68da8..40293a6ce804 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h | |||
@@ -1511,12 +1511,6 @@ struct dir_context { | |||
1511 | loff_t pos; | 1511 | loff_t pos; |
1512 | }; | 1512 | }; |
1513 | 1513 | ||
1514 | static inline bool dir_emit(struct dir_context *ctx, | ||
1515 | const char *name, int namelen, | ||
1516 | u64 ino, unsigned type) | ||
1517 | { | ||
1518 | return ctx->actor(ctx, name, namelen, ctx->pos, ino, type) == 0; | ||
1519 | } | ||
1520 | struct block_device_operations; | 1514 | struct block_device_operations; |
1521 | 1515 | ||
1522 | /* These macros are for out of kernel modules to test that | 1516 | /* These macros are for out of kernel modules to test that |
@@ -2537,7 +2531,7 @@ extern void iterate_supers_type(struct file_system_type *, | |||
2537 | extern int dcache_dir_open(struct inode *, struct file *); | 2531 | extern int dcache_dir_open(struct inode *, struct file *); |
2538 | extern int dcache_dir_close(struct inode *, struct file *); | 2532 | extern int dcache_dir_close(struct inode *, struct file *); |
2539 | extern loff_t dcache_dir_lseek(struct file *, loff_t, int); | 2533 | extern loff_t dcache_dir_lseek(struct file *, loff_t, int); |
2540 | extern int dcache_readdir(struct file *, void *, filldir_t); | 2534 | extern int dcache_readdir(struct file *, struct dir_context *); |
2541 | extern int simple_setattr(struct dentry *, struct iattr *); | 2535 | extern int simple_setattr(struct dentry *, struct iattr *); |
2542 | extern int simple_getattr(struct vfsmount *, struct dentry *, struct kstat *); | 2536 | extern int simple_getattr(struct vfsmount *, struct dentry *, struct kstat *); |
2543 | extern int simple_statfs(struct dentry *, struct kstatfs *); | 2537 | extern int simple_statfs(struct dentry *, struct kstatfs *); |
@@ -2701,4 +2695,35 @@ static inline void inode_has_no_xattr(struct inode *inode) | |||
2701 | inode->i_flags |= S_NOSEC; | 2695 | inode->i_flags |= S_NOSEC; |
2702 | } | 2696 | } |
2703 | 2697 | ||
2698 | static inline bool dir_emit(struct dir_context *ctx, | ||
2699 | const char *name, int namelen, | ||
2700 | u64 ino, unsigned type) | ||
2701 | { | ||
2702 | return ctx->actor(ctx, name, namelen, ctx->pos, ino, type) == 0; | ||
2703 | } | ||
2704 | static inline bool dir_emit_dot(struct file *file, struct dir_context *ctx) | ||
2705 | { | ||
2706 | return ctx->actor(ctx, ".", 1, ctx->pos, | ||
2707 | file->f_path.dentry->d_inode->i_ino, DT_DIR) == 0; | ||
2708 | } | ||
2709 | static inline bool dir_emit_dotdot(struct file *file, struct dir_context *ctx) | ||
2710 | { | ||
2711 | return ctx->actor(ctx, "..", 2, ctx->pos, | ||
2712 | parent_ino(file->f_path.dentry), DT_DIR) == 0; | ||
2713 | } | ||
2714 | static inline bool dir_emit_dots(struct file *file, struct dir_context *ctx) | ||
2715 | { | ||
2716 | if (ctx->pos == 0) { | ||
2717 | if (!dir_emit_dot(file, ctx)) | ||
2718 | return false; | ||
2719 | ctx->pos = 1; | ||
2720 | } | ||
2721 | if (ctx->pos == 1) { | ||
2722 | if (!dir_emit_dotdot(file, ctx)) | ||
2723 | return false; | ||
2724 | ctx->pos = 2; | ||
2725 | } | ||
2726 | return true; | ||
2727 | } | ||
2728 | |||
2704 | #endif /* _LINUX_FS_H */ | 2729 | #endif /* _LINUX_FS_H */ |