Commit bfee7169 authored by Al Viro's avatar Al Viro

[readdir] convert isofs

Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent 0312fa7c
...@@ -78,8 +78,8 @@ int get_acorn_filename(struct iso_directory_record *de, ...@@ -78,8 +78,8 @@ int get_acorn_filename(struct iso_directory_record *de,
/* /*
* This should _really_ be cleaned up some day.. * This should _really_ be cleaned up some day..
*/ */
static int do_isofs_readdir(struct inode *inode, struct file *filp, static int do_isofs_readdir(struct inode *inode, struct file *file,
void *dirent, filldir_t filldir, struct dir_context *ctx,
char *tmpname, struct iso_directory_record *tmpde) char *tmpname, struct iso_directory_record *tmpde)
{ {
unsigned long bufsize = ISOFS_BUFFER_SIZE(inode); unsigned long bufsize = ISOFS_BUFFER_SIZE(inode);
...@@ -94,10 +94,10 @@ static int do_isofs_readdir(struct inode *inode, struct file *filp, ...@@ -94,10 +94,10 @@ static int do_isofs_readdir(struct inode *inode, struct file *filp,
struct iso_directory_record *de; struct iso_directory_record *de;
struct isofs_sb_info *sbi = ISOFS_SB(inode->i_sb); struct isofs_sb_info *sbi = ISOFS_SB(inode->i_sb);
offset = filp->f_pos & (bufsize - 1); offset = ctx->pos & (bufsize - 1);
block = filp->f_pos >> bufbits; block = ctx->pos >> bufbits;
while (filp->f_pos < inode->i_size) { while (ctx->pos < inode->i_size) {
int de_len; int de_len;
if (!bh) { if (!bh) {
...@@ -108,7 +108,7 @@ static int do_isofs_readdir(struct inode *inode, struct file *filp, ...@@ -108,7 +108,7 @@ static int do_isofs_readdir(struct inode *inode, struct file *filp,
de = (struct iso_directory_record *) (bh->b_data + offset); de = (struct iso_directory_record *) (bh->b_data + offset);
de_len = *(unsigned char *) de; de_len = *(unsigned char *)de;
/* /*
* If the length byte is zero, we should move on to the next * If the length byte is zero, we should move on to the next
...@@ -119,8 +119,8 @@ static int do_isofs_readdir(struct inode *inode, struct file *filp, ...@@ -119,8 +119,8 @@ static int do_isofs_readdir(struct inode *inode, struct file *filp,
if (de_len == 0) { if (de_len == 0) {
brelse(bh); brelse(bh);
bh = NULL; bh = NULL;
filp->f_pos = (filp->f_pos + ISOFS_BLOCK_SIZE) & ~(ISOFS_BLOCK_SIZE - 1); ctx->pos = (ctx->pos + ISOFS_BLOCK_SIZE) & ~(ISOFS_BLOCK_SIZE - 1);
block = filp->f_pos >> bufbits; block = ctx->pos >> bufbits;
offset = 0; offset = 0;
continue; continue;
} }
...@@ -164,16 +164,16 @@ static int do_isofs_readdir(struct inode *inode, struct file *filp, ...@@ -164,16 +164,16 @@ static int do_isofs_readdir(struct inode *inode, struct file *filp,
if (de->flags[-sbi->s_high_sierra] & 0x80) { if (de->flags[-sbi->s_high_sierra] & 0x80) {
first_de = 0; first_de = 0;
filp->f_pos += de_len; ctx->pos += de_len;
continue; continue;
} }
first_de = 1; first_de = 1;
/* Handle the case of the '.' directory */ /* Handle the case of the '.' directory */
if (de->name_len[0] == 1 && de->name[0] == 0) { if (de->name_len[0] == 1 && de->name[0] == 0) {
if (filldir(dirent, ".", 1, filp->f_pos, inode->i_ino, DT_DIR) < 0) if (!dir_emit_dot(file, ctx))
break; break;
filp->f_pos += de_len; ctx->pos += de_len;
continue; continue;
} }
...@@ -181,10 +181,9 @@ static int do_isofs_readdir(struct inode *inode, struct file *filp, ...@@ -181,10 +181,9 @@ static int do_isofs_readdir(struct inode *inode, struct file *filp,
/* Handle the case of the '..' directory */ /* Handle the case of the '..' directory */
if (de->name_len[0] == 1 && de->name[0] == 1) { if (de->name_len[0] == 1 && de->name[0] == 1) {
inode_number = parent_ino(filp->f_path.dentry); if (!dir_emit_dotdot(file, ctx))
if (filldir(dirent, "..", 2, filp->f_pos, inode_number, DT_DIR) < 0)
break; break;
filp->f_pos += de_len; ctx->pos += de_len;
continue; continue;
} }
...@@ -198,7 +197,7 @@ static int do_isofs_readdir(struct inode *inode, struct file *filp, ...@@ -198,7 +197,7 @@ static int do_isofs_readdir(struct inode *inode, struct file *filp,
if ((sbi->s_hide && (de->flags[-sbi->s_high_sierra] & 1)) || if ((sbi->s_hide && (de->flags[-sbi->s_high_sierra] & 1)) ||
(!sbi->s_showassoc && (!sbi->s_showassoc &&
(de->flags[-sbi->s_high_sierra] & 4))) { (de->flags[-sbi->s_high_sierra] & 4))) {
filp->f_pos += de_len; ctx->pos += de_len;
continue; continue;
} }
...@@ -230,10 +229,10 @@ static int do_isofs_readdir(struct inode *inode, struct file *filp, ...@@ -230,10 +229,10 @@ static int do_isofs_readdir(struct inode *inode, struct file *filp,
} }
} }
if (len > 0) { if (len > 0) {
if (filldir(dirent, p, len, filp->f_pos, inode_number, DT_UNKNOWN) < 0) if (!dir_emit(ctx, p, len, inode_number, DT_UNKNOWN))
break; break;
} }
filp->f_pos += de_len; ctx->pos += de_len;
continue; continue;
} }
...@@ -247,13 +246,12 @@ static int do_isofs_readdir(struct inode *inode, struct file *filp, ...@@ -247,13 +246,12 @@ static int do_isofs_readdir(struct inode *inode, struct file *filp,
* handling split directory entries.. The real work is done by * handling split directory entries.. The real work is done by
* "do_isofs_readdir()". * "do_isofs_readdir()".
*/ */
static int isofs_readdir(struct file *filp, static int isofs_readdir(struct file *file, struct dir_context *ctx)
void *dirent, filldir_t filldir)
{ {
int result; int result;
char *tmpname; char *tmpname;
struct iso_directory_record *tmpde; struct iso_directory_record *tmpde;
struct inode *inode = file_inode(filp); struct inode *inode = file_inode(file);
tmpname = (char *)__get_free_page(GFP_KERNEL); tmpname = (char *)__get_free_page(GFP_KERNEL);
if (tmpname == NULL) if (tmpname == NULL)
...@@ -261,7 +259,7 @@ static int isofs_readdir(struct file *filp, ...@@ -261,7 +259,7 @@ static int isofs_readdir(struct file *filp,
tmpde = (struct iso_directory_record *) (tmpname+1024); tmpde = (struct iso_directory_record *) (tmpname+1024);
result = do_isofs_readdir(inode, filp, dirent, filldir, tmpname, tmpde); result = do_isofs_readdir(inode, file, ctx, tmpname, tmpde);
free_page((unsigned long) tmpname); free_page((unsigned long) tmpname);
return result; return result;
...@@ -271,7 +269,7 @@ const struct file_operations isofs_dir_operations = ...@@ -271,7 +269,7 @@ const struct file_operations isofs_dir_operations =
{ {
.llseek = generic_file_llseek, .llseek = generic_file_llseek,
.read = generic_read_dir, .read = generic_read_dir,
.readdir = isofs_readdir, .iterate = isofs_readdir,
}; };
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment