summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2013-05-17 17:30:10 -0400
committerPawel Osmialowski <p.osmialowsk@mcdsrvbld02.digital.local>2015-03-27 14:37:37 +0100
commit16b48b2fa6edfe70b8ac64022822264b0b8f7869 (patch)
tree23a77183fadd029c26602a8191abf46aa3dc9f90
parent0992c26c63533de86c586859ddc5e1aa23d74150 (diff)
downloadlinux-3.10-16b48b2fa6edfe70b8ac64022822264b0b8f7869.tar.gz
linux-3.10-16b48b2fa6edfe70b8ac64022822264b0b8f7869.tar.bz2
linux-3.10-16b48b2fa6edfe70b8ac64022822264b0b8f7869.zip
convert adfs
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
-rw-r--r--fs/adfs/dir.c42
1 files changed, 18 insertions, 24 deletions
diff --git a/fs/adfs/dir.c b/fs/adfs/dir.c
index 9cf874ce833..ade28bb058e 100644
--- a/fs/adfs/dir.c
+++ b/fs/adfs/dir.c
@@ -17,47 +17,43 @@
static DEFINE_RWLOCK(adfs_dir_lock);
static int
-adfs_readdir(struct file *filp, void *dirent, filldir_t filldir)
+adfs_readdir(struct file *file, struct dir_context *ctx)
{
- struct inode *inode = file_inode(filp);
+ struct inode *inode = file_inode(file);
struct super_block *sb = inode->i_sb;
struct adfs_dir_ops *ops = ADFS_SB(sb)->s_dir;
struct object_info obj;
struct adfs_dir dir;
int ret = 0;
- if (filp->f_pos >> 32)
- goto out;
+ if (ctx->pos >> 32)
+ return 0;
ret = ops->read(sb, inode->i_ino, inode->i_size, &dir);
if (ret)
- goto out;
+ return ret;
- switch ((unsigned long)filp->f_pos) {
- case 0:
- if (filldir(dirent, ".", 1, 0, inode->i_ino, DT_DIR) < 0)
+ if (ctx->pos == 0) {
+ if (!dir_emit_dot(file, ctx))
goto free_out;
- filp->f_pos += 1;
-
- case 1:
- if (filldir(dirent, "..", 2, 1, dir.parent_id, DT_DIR) < 0)
+ ctx->pos = 1;
+ }
+ if (ctx->pos == 1) {
+ if (!dir_emit(ctx, "..", 2, dir.parent_id, DT_DIR))
goto free_out;
- filp->f_pos += 1;
-
- default:
- break;
+ ctx->pos = 2;
}
read_lock(&adfs_dir_lock);
- ret = ops->setpos(&dir, filp->f_pos - 2);
+ ret = ops->setpos(&dir, ctx->pos - 2);
if (ret)
goto unlock_out;
while (ops->getnext(&dir, &obj) == 0) {
- if (filldir(dirent, obj.name, obj.name_len,
- filp->f_pos, obj.file_id, DT_UNKNOWN) < 0)
- goto unlock_out;
- filp->f_pos += 1;
+ if (!dir_emit(ctx, obj.name, obj.name_len,
+ obj.file_id, DT_UNKNOWN))
+ break;
+ ctx->pos++;
}
unlock_out:
@@ -65,8 +61,6 @@ unlock_out:
free_out:
ops->free(&dir);
-
-out:
return ret;
}
@@ -192,7 +186,7 @@ out:
const struct file_operations adfs_dir_operations = {
.read = generic_read_dir,
.llseek = generic_file_llseek,
- .readdir = adfs_readdir,
+ .iterate = adfs_readdir,
.fsync = generic_file_fsync,
};