23 .readdir = affs_readdir,
47 struct buffer_head *dir_bh;
48 struct buffer_head *fh_bh;
59 pr_debug(
"AFFS: readdir(ino=%lu,f_pos=%lx)\n",inode->
i_ino,(
unsigned long)filp->
f_pos);
69 if (filldir(dirent,
".", 1, f_pos, inode->
i_ino,
DT_DIR) < 0)
71 filp->
f_pos = f_pos = 1;
77 filp->
f_pos = f_pos = 2;
82 chain_pos = (f_pos - 2) & 0xffff;
83 hash_pos = (f_pos - 2) >> 16;
84 if (chain_pos == 0xffff) {
85 affs_warning(sb,
"readdir",
"More than 65535 entries in chain");
88 filp->
f_pos = ((hash_pos << 16) | chain_pos) + 2;
90 dir_bh = affs_bread(sb, inode->
i_ino);
99 pr_debug(
"AFFS: readdir() left off=%d\n", ino);
104 for (i = 0; ino && i < chain_pos; i++) {
105 fh_bh = affs_bread(sb, ino);
107 affs_error(sb,
"readdir",
"Cannot read block %d", i);
118 for (; hash_pos < AFFS_SB(sb)->s_hashsize; hash_pos++) {
122 f_pos = (hash_pos << 16) + 2;
125 fh_bh = affs_bread(sb, ino);
127 affs_error(sb,
"readdir",
"Cannot read block %d", ino);
133 pr_debug(
"AFFS: readdir(): filldir(\"%.*s\", ino=%u), hash=%d, f_pos=%x\n",
134 namelen, name, ino, hash_pos, f_pos);
135 if (filldir(dirent, name, namelen, f_pos, ino,
DT_UNKNOWN) < 0)
153 affs_unlock_dir(inode);
154 pr_debug(
"AFFS: readdir()=%d\n", stored);