diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2013-05-15 20:23:06 -0400 |
---|---|---|
committer | Pawel Osmialowski <p.osmialowsk@mcdsrvbld02.digital.local> | 2015-03-27 18:13:00 +0100 |
commit | 7542710d018a9e101cfcd62263ff8d3c04f73746 (patch) | |
tree | 6fe727b8ee9cebf2c867a8346afbaaf27821fb9b /include | |
parent | 9f7b13b188b97980a8178e19b4fb3a2360f65733 (diff) | |
download | linux-3.10-7542710d018a9e101cfcd62263ff8d3c04f73746.tar.gz linux-3.10-7542710d018a9e101cfcd62263ff8d3c04f73746.tar.bz2 linux-3.10-7542710d018a9e101cfcd62263ff8d3c04f73746.zip |
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')
-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 d6a14447bb7..59d68c32447 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -1536,12 +1536,6 @@ struct dir_context { loff_t pos; }; -static inline bool dir_emit(struct dir_context *ctx, - const char *name, int namelen, - u64 ino, unsigned type) -{ - return ctx->actor(ctx, name, namelen, ctx->pos, ino, type) == 0; -} struct block_device_operations; /* These macros are for out of kernel modules to test that @@ -2574,7 +2568,7 @@ extern void iterate_supers_type(struct file_system_type *, extern int dcache_dir_open(struct inode *, struct file *); extern int dcache_dir_close(struct inode *, struct file *); extern loff_t dcache_dir_lseek(struct file *, loff_t, int); -extern int dcache_readdir(struct file *, void *, filldir_t); +extern int dcache_readdir(struct file *, struct dir_context *); extern int simple_setattr(struct dentry *, struct iattr *); extern int simple_getattr(struct vfsmount *, struct dentry *, struct kstat *); extern int simple_statfs(struct dentry *, struct kstatfs *); @@ -2738,4 +2732,35 @@ static inline void inode_has_no_xattr(struct inode *inode) inode->i_flags |= S_NOSEC; } +static inline bool dir_emit(struct dir_context *ctx, + const char *name, int namelen, + u64 ino, unsigned type) +{ + return ctx->actor(ctx, name, namelen, ctx->pos, ino, type) == 0; +} +static inline bool dir_emit_dot(struct file *file, struct dir_context *ctx) +{ + return ctx->actor(ctx, ".", 1, ctx->pos, + file->f_path.dentry->d_inode->i_ino, DT_DIR) == 0; +} +static inline bool dir_emit_dotdot(struct file *file, struct dir_context *ctx) +{ + return ctx->actor(ctx, "..", 2, ctx->pos, + parent_ino(file->f_path.dentry), DT_DIR) == 0; +} +static inline bool dir_emit_dots(struct file *file, struct dir_context *ctx) +{ + if (ctx->pos == 0) { + if (!dir_emit_dot(file, ctx)) + return false; + ctx->pos = 1; + } + if (ctx->pos == 1) { + if (!dir_emit_dotdot(file, ctx)) + return false; + ctx->pos = 2; + } + return true; +} + #endif /* _LINUX_FS_H */ |