aboutsummaryrefslogtreecommitdiffstats
path: root/fs/isofs
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2013-05-17 21:11:59 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2013-06-29 04:56:47 -0400
commitbfee7169c0210f501a79e4dfdfc309a975775fa6 (patch)
tree93f6dcd82542e30e73e542d359b54a794accde53 /fs/isofs
parent0312fa7ccd7bda2ce074799f4784c2d95d03a62c (diff)
[readdir] convert isofs
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/isofs')
-rw-r--r--fs/isofs/dir.c42
1 files changed, 20 insertions, 22 deletions
diff --git a/fs/isofs/dir.c b/fs/isofs/dir.c
index a7d5c3c3d4e6..b943cbd963bb 100644
--- a/fs/isofs/dir.c
+++ b/fs/isofs/dir.c
@@ -78,8 +78,8 @@ int get_acorn_filename(struct iso_directory_record *de,
78/* 78/*
79 * This should _really_ be cleaned up some day.. 79 * This should _really_ be cleaned up some day..
80 */ 80 */
81static int do_isofs_readdir(struct inode *inode, struct file *filp, 81static int do_isofs_readdir(struct inode *inode, struct file *file,
82 void *dirent, filldir_t filldir, 82 struct dir_context *ctx,
83 char *tmpname, struct iso_directory_record *tmpde) 83 char *tmpname, struct iso_directory_record *tmpde)
84{ 84{
85 unsigned long bufsize = ISOFS_BUFFER_SIZE(inode); 85 unsigned long bufsize = ISOFS_BUFFER_SIZE(inode);
@@ -94,10 +94,10 @@ static int do_isofs_readdir(struct inode *inode, struct file *filp,
94 struct iso_directory_record *de; 94 struct iso_directory_record *de;
95 struct isofs_sb_info *sbi = ISOFS_SB(inode->i_sb); 95 struct isofs_sb_info *sbi = ISOFS_SB(inode->i_sb);
96 96
97 offset = filp->f_pos & (bufsize - 1); 97 offset = ctx->pos & (bufsize - 1);
98 block = filp->f_pos >> bufbits; 98 block = ctx->pos >> bufbits;
99 99
100 while (filp->f_pos < inode->i_size) { 100 while (ctx->pos < inode->i_size) {
101 int de_len; 101 int de_len;
102 102
103 if (!bh) { 103 if (!bh) {
@@ -108,7 +108,7 @@ static int do_isofs_readdir(struct inode *inode, struct file *filp,
108 108
109 de = (struct iso_directory_record *) (bh->b_data + offset); 109 de = (struct iso_directory_record *) (bh->b_data + offset);
110 110
111 de_len = *(unsigned char *) de; 111 de_len = *(unsigned char *)de;
112 112
113 /* 113 /*
114 * If the length byte is zero, we should move on to the next 114 * 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 if (de_len == 0) { 119 if (de_len == 0) {
120 brelse(bh); 120 brelse(bh);
121 bh = NULL; 121 bh = NULL;
122 filp->f_pos = (filp->f_pos + ISOFS_BLOCK_SIZE) & ~(ISOFS_BLOCK_SIZE - 1); 122 ctx->pos = (ctx->pos + ISOFS_BLOCK_SIZE) & ~(ISOFS_BLOCK_SIZE - 1);
123 block = filp->f_pos >> bufbits; 123 block = ctx->pos >> bufbits;
124 offset = 0; 124 offset = 0;
125 continue; 125 continue;
126 } 126 }
@@ -164,16 +164,16 @@ static int do_isofs_readdir(struct inode *inode, struct file *filp,
164 164
165 if (de->flags[-sbi->s_high_sierra] & 0x80) { 165 if (de->flags[-sbi->s_high_sierra] & 0x80) {
166 first_de = 0; 166 first_de = 0;
167 filp->f_pos += de_len; 167 ctx->pos += de_len;
168 continue; 168 continue;
169 } 169 }
170 first_de = 1; 170 first_de = 1;
171 171
172 /* Handle the case of the '.' directory */ 172 /* Handle the case of the '.' directory */
173 if (de->name_len[0] == 1 && de->name[0] == 0) { 173 if (de->name_len[0] == 1 && de->name[0] == 0) {
174 if (filldir(dirent, ".", 1, filp->f_pos, inode->i_ino, DT_DIR) < 0) 174 if (!dir_emit_dot(file, ctx))
175 break; 175 break;
176 filp->f_pos += de_len; 176 ctx->pos += de_len;
177 continue; 177 continue;
178 } 178 }
179 179
@@ -181,10 +181,9 @@ static int do_isofs_readdir(struct inode *inode, struct file *filp,
181 181
182 /* Handle the case of the '..' directory */ 182 /* Handle the case of the '..' directory */
183 if (de->name_len[0] == 1 && de->name[0] == 1) { 183 if (de->name_len[0] == 1 && de->name[0] == 1) {
184 inode_number = parent_ino(filp->f_path.dentry); 184 if (!dir_emit_dotdot(file, ctx))
185 if (filldir(dirent, "..", 2, filp->f_pos, inode_number, DT_DIR) < 0)
186 break; 185 break;
187 filp->f_pos += de_len; 186 ctx->pos += de_len;
188 continue; 187 continue;
189 } 188 }
190 189
@@ -198,7 +197,7 @@ static int do_isofs_readdir(struct inode *inode, struct file *filp,
198 if ((sbi->s_hide && (de->flags[-sbi->s_high_sierra] & 1)) || 197 if ((sbi->s_hide && (de->flags[-sbi->s_high_sierra] & 1)) ||
199 (!sbi->s_showassoc && 198 (!sbi->s_showassoc &&
200 (de->flags[-sbi->s_high_sierra] & 4))) { 199 (de->flags[-sbi->s_high_sierra] & 4))) {
201 filp->f_pos += de_len; 200 ctx->pos += de_len;
202 continue; 201 continue;
203 } 202 }
204 203
@@ -230,10 +229,10 @@ static int do_isofs_readdir(struct inode *inode, struct file *filp,
230 } 229 }
231 } 230 }
232 if (len > 0) { 231 if (len > 0) {
233 if (filldir(dirent, p, len, filp->f_pos, inode_number, DT_UNKNOWN) < 0) 232 if (!dir_emit(ctx, p, len, inode_number, DT_UNKNOWN))
234 break; 233 break;
235 } 234 }
236 filp->f_pos += de_len; 235 ctx->pos += de_len;
237 236
238 continue; 237 continue;
239 } 238 }
@@ -247,13 +246,12 @@ static int do_isofs_readdir(struct inode *inode, struct file *filp,
247 * handling split directory entries.. The real work is done by 246 * handling split directory entries.. The real work is done by
248 * "do_isofs_readdir()". 247 * "do_isofs_readdir()".
249 */ 248 */
250static int isofs_readdir(struct file *filp, 249static int isofs_readdir(struct file *file, struct dir_context *ctx)
251 void *dirent, filldir_t filldir)
252{ 250{
253 int result; 251 int result;
254 char *tmpname; 252 char *tmpname;
255 struct iso_directory_record *tmpde; 253 struct iso_directory_record *tmpde;
256 struct inode *inode = file_inode(filp); 254 struct inode *inode = file_inode(file);
257 255
258 tmpname = (char *)__get_free_page(GFP_KERNEL); 256 tmpname = (char *)__get_free_page(GFP_KERNEL);
259 if (tmpname == NULL) 257 if (tmpname == NULL)
@@ -261,7 +259,7 @@ static int isofs_readdir(struct file *filp,
261 259
262 tmpde = (struct iso_directory_record *) (tmpname+1024); 260 tmpde = (struct iso_directory_record *) (tmpname+1024);
263 261
264 result = do_isofs_readdir(inode, filp, dirent, filldir, tmpname, tmpde); 262 result = do_isofs_readdir(inode, file, ctx, tmpname, tmpde);
265 263
266 free_page((unsigned long) tmpname); 264 free_page((unsigned long) tmpname);
267 return result; 265 return result;
@@ -271,7 +269,7 @@ const struct file_operations isofs_dir_operations =
271{ 269{
272 .llseek = generic_file_llseek, 270 .llseek = generic_file_llseek,
273 .read = generic_read_dir, 271 .read = generic_read_dir,
274 .readdir = isofs_readdir, 272 .iterate = isofs_readdir,
275}; 273};
276 274
277/* 275/*