29 #include <linux/string.h>
30 #include <linux/errno.h>
32 #include <linux/slab.h>
38 static int do_udf_readdir(
struct inode *dir,
struct file *filp,
45 loff_t nf_pos = (filp->
f_pos - 1) << 2;
48 unsigned char *nameptr;
51 loff_t
size = udf_ext0_offset(dir) + dir->
i_size;
52 struct buffer_head *
tmp, *bha[16];
71 nf_pos = udf_ext0_offset(dir);
77 &epos, &eloc, &elen, &offset)
82 block = udf_get_lb_pblock(dir->
i_sb, &eloc, offset);
83 if ((++offset << dir->
i_sb->s_blocksize_bits) < elen) {
86 else if (iinfo->i_alloc_type ==
98 if (!(offset & ((16 >> (dir->
i_sb->s_blocksize_bits - 9)) - 1))) {
99 i = 16 >> (dir->
i_sb->s_blocksize_bits - 9);
100 if (i + offset > (elen >> dir->
i_sb->s_blocksize_bits))
101 i = (elen >> dir->
i_sb->s_blocksize_bits) -
offset;
102 for (num = 0; i > 0; i--) {
103 block = udf_get_lb_pblock(dir->
i_sb, &eloc, offset + i);
105 if (tmp && !buffer_uptodate(tmp) && !buffer_locked(tmp))
112 for (i = 0; i < num; i++)
118 while (nf_pos < size) {
119 filp->
f_pos = (nf_pos >> 2) + 1;
127 lfi = cfi.lengthFileIdent;
129 if (fibh.
sbh == fibh.
ebh) {
136 if (poffset >= lfi) {
137 nameptr = (
char *)(fibh.
ebh->b_data + poffset - lfi);
142 memcpy(nameptr + lfi - poffset,
143 fibh.
ebh->b_data, poffset);
160 memcpy(fname,
"..", flen);
165 iblock = udf_get_lb_pblock(dir->
i_sb, &tloc, 0);
170 if (flen && filldir(dirent, fname, flen, filp->
f_pos,
171 iblock, dt_type) < 0)
175 filp->
f_pos = (nf_pos >> 2) + 1;
187 static int udf_readdir(
struct file *filp,
void *dirent,
filldir_t filldir)
192 if (filp->
f_pos == 0) {
199 result = do_udf_readdir(dir, filp, filldir, dirent);
207 .readdir = udf_readdir,