aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOGAWA Hirofumi <hirofumi@mail.parknet.co.jp>2014-02-21 04:02:52 +0900
committerDaniel Phillips <daniel@tux3.org>2014-02-21 04:02:52 +0900
commit7055cc72a966174e3e6d08abe9626ec2b5560c29 (patch)
treebc868f11f601bb69745b64f6d83d50d471f90e44
parent42bb9a3cf9b33323e3b0638849fb00ddf1c1277f (diff)
downloadlinux-tux3-7055cc72a966174e3e6d08abe9626ec2b5560c29.tar.gz
tux3: Fix tux_readdir() for kernel v3.11
Signed-off-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
-rw-r--r--fs/tux3/dir.c18
-rw-r--r--fs/tux3/namei.c2
-rw-r--r--fs/tux3/tux3.h2
3 files changed, 9 insertions, 13 deletions
diff --git a/fs/tux3/dir.c b/fs/tux3/dir.c
index 1c0cfb3519c2e9..f294dece05c0bf 100644
--- a/fs/tux3/dir.c
+++ b/fs/tux3/dir.c
@@ -317,19 +317,18 @@ static unsigned char filetype[TUX_TYPES] = {
[TUX_LNK] = DT_LNK,
};
-int tux_readdir(struct file *file, void *state, filldir_t filldir)
+int tux_readdir(struct file *file, struct dir_context *ctx)
{
- loff_t pos = file->f_pos;
struct inode *dir = file_inode(file);
int revalidate = file->f_version != dir->i_version;
struct sb *sb = tux_sb(dir->i_sb);
unsigned blockbits = sb->blockbits;
block_t block, blocks = dir->i_size >> blockbits;
- unsigned offset = pos & sb->blockmask;
+ unsigned offset = ctx->pos & sb->blockmask;
assert(!(dir->i_size & sb->blockmask));
- for (block = pos >> blockbits ; block < blocks; block++) {
+ for (block = ctx->pos >> blockbits; block < blocks; block++) {
struct buffer_head *buffer = blockread(mapping(dir), block);
if (!buffer)
return -EIO;
@@ -341,7 +340,7 @@ int tux_readdir(struct file *file, void *state, filldir_t filldir)
while (p < entry && p->rec_len)
p = next_entry(p);
offset = (void *)p - base;
- file->f_pos = (block << blockbits) + offset;
+ ctx->pos = (block << blockbits) + offset;
}
file->f_version = dir->i_version;
revalidate = 0;
@@ -355,16 +354,13 @@ int tux_readdir(struct file *file, void *state, filldir_t filldir)
}
if (!is_deleted(entry)) {
unsigned type = (entry->type < TUX_TYPES) ? filetype[entry->type] : DT_UNKNOWN;
- int lame = filldir(
- state, entry->name, entry->name_len,
- (block << blockbits) | ((void *)entry - base),
- be64_to_cpu(entry->inum), type);
- if (lame) {
+ if (!dir_emit(ctx, entry->name, entry->name_len,
+ be64_to_cpu(entry->inum), type)) {
blockput(buffer);
return 0;
}
}
- file->f_pos += tux_rec_len_from_disk(entry->rec_len);
+ ctx->pos += tux_rec_len_from_disk(entry->rec_len);
}
blockput(buffer);
offset = 0;
diff --git a/fs/tux3/namei.c b/fs/tux3/namei.c
index 6da96aed8efe32..6d6afbfeb4f190 100644
--- a/fs/tux3/namei.c
+++ b/fs/tux3/namei.c
@@ -342,7 +342,7 @@ error:
const struct file_operations tux_dir_fops = {
.llseek = generic_file_llseek,
.read = generic_read_dir,
- .readdir = tux_readdir,
+ .iterate = tux_readdir,
.fsync = tux3_sync_file,
};
diff --git a/fs/tux3/tux3.h b/fs/tux3/tux3.h
index b1ea39abb8b6c5..b10dc6fd8189b2 100644
--- a/fs/tux3/tux3.h
+++ b/fs/tux3/tux3.h
@@ -800,7 +800,7 @@ int tux_delete_entry(struct inode *dir, struct buffer_head *buffer,
tux_dirent *entry);
int tux_delete_dirent(struct inode *dir, struct buffer_head *buffer,
tux_dirent *entry);
-int tux_readdir(struct file *file, void *state, filldir_t filldir);
+int tux_readdir(struct file *file, struct dir_context *ctx);
int tux_dir_is_empty(struct inode *dir);
/* dleaf.c */