aboutsummaryrefslogtreecommitdiffstats
path: root/fs/coda/dir.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/coda/dir.c')
-rw-r--r--fs/coda/dir.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/fs/coda/dir.c b/fs/coda/dir.c
index 04a3dd84c993..8e61236abf4a 100644
--- a/fs/coda/dir.c
+++ b/fs/coda/dir.c
@@ -510,20 +510,20 @@ static int coda_venus_readdir(struct file *coda_file, void *buf,
510 vdir = kmalloc(sizeof(*vdir), GFP_KERNEL); 510 vdir = kmalloc(sizeof(*vdir), GFP_KERNEL);
511 if (!vdir) return -ENOMEM; 511 if (!vdir) return -ENOMEM;
512 512
513 switch (coda_file->f_pos) { 513 if (coda_file->f_pos == 0) {
514 case 0:
515 ret = filldir(buf, ".", 1, 0, de->d_inode->i_ino, DT_DIR); 514 ret = filldir(buf, ".", 1, 0, de->d_inode->i_ino, DT_DIR);
516 if (ret < 0) break; 515 if (ret < 0)
516 goto out;
517 result++; 517 result++;
518 coda_file->f_pos++; 518 coda_file->f_pos++;
519 /* fallthrough */ 519 }
520 case 1: 520 if (coda_file->f_pos == 1) {
521 ret = filldir(buf, "..", 2, 1, de->d_parent->d_inode->i_ino, DT_DIR); 521 ret = filldir(buf, "..", 2, 1, de->d_parent->d_inode->i_ino, DT_DIR);
522 if (ret < 0) break; 522 if (ret < 0)
523 goto out;
523 result++; 524 result++;
524 coda_file->f_pos++; 525 coda_file->f_pos++;
525 /* fallthrough */ 526 }
526 default:
527 while (1) { 527 while (1) {
528 /* read entries from the directory file */ 528 /* read entries from the directory file */
529 ret = kernel_read(host_file, coda_file->f_pos - 2, (char *)vdir, 529 ret = kernel_read(host_file, coda_file->f_pos - 2, (char *)vdir,
@@ -578,7 +578,7 @@ static int coda_venus_readdir(struct file *coda_file, void *buf,
578 * we've already established it is non-zero. */ 578 * we've already established it is non-zero. */
579 coda_file->f_pos += vdir->d_reclen; 579 coda_file->f_pos += vdir->d_reclen;
580 } 580 }
581 } 581out:
582 kfree(vdir); 582 kfree(vdir);
583 return result ? result : ret; 583 return result ? result : ret;
584} 584}