diff options
author | Jan Kara <jack@suse.cz> | 2008-02-13 18:03:33 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2008-02-13 19:21:20 -0500 |
commit | e28d80f18211e5d49e450ba0f07b8fdca6dfb83b (patch) | |
tree | 9aa3d12294fd44c156c8255c92c4fa390d7f5025 /fs | |
parent | ac76cff2ecd73944473a437cd87770f812635025 (diff) |
udf: fix directory offset handling
Patch cleaning up UDF directory offset handling missed modifications in dir.c
(because I've submitted an old version :(). Fix it.
Signed-off-by: Jan Kara <jack@suse.cz>
Reported-by: Marcin Slusarz <marcin.slusarz@gmail.com>
Tested-by: Marcin Slusarz <marcin.slusarz@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/udf/dir.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/fs/udf/dir.c b/fs/udf/dir.c index 4b44e23caa12..8d8643ada199 100644 --- a/fs/udf/dir.c +++ b/fs/udf/dir.c | |||
@@ -43,13 +43,13 @@ static int do_udf_readdir(struct inode *dir, struct file *filp, | |||
43 | struct fileIdentDesc *fi = NULL; | 43 | struct fileIdentDesc *fi = NULL; |
44 | struct fileIdentDesc cfi; | 44 | struct fileIdentDesc cfi; |
45 | int block, iblock; | 45 | int block, iblock; |
46 | loff_t nf_pos = filp->f_pos - 1; | 46 | loff_t nf_pos = (filp->f_pos - 1) << 2; |
47 | int flen; | 47 | int flen; |
48 | char fname[UDF_NAME_LEN]; | 48 | char fname[UDF_NAME_LEN]; |
49 | char *nameptr; | 49 | char *nameptr; |
50 | uint16_t liu; | 50 | uint16_t liu; |
51 | uint8_t lfi; | 51 | uint8_t lfi; |
52 | loff_t size = (udf_ext0_offset(dir) + dir->i_size) >> 2; | 52 | loff_t size = udf_ext0_offset(dir) + dir->i_size; |
53 | struct buffer_head *tmp, *bha[16]; | 53 | struct buffer_head *tmp, *bha[16]; |
54 | kernel_lb_addr eloc; | 54 | kernel_lb_addr eloc; |
55 | uint32_t elen; | 55 | uint32_t elen; |
@@ -63,13 +63,13 @@ static int do_udf_readdir(struct inode *dir, struct file *filp, | |||
63 | return 0; | 63 | return 0; |
64 | 64 | ||
65 | if (nf_pos == 0) | 65 | if (nf_pos == 0) |
66 | nf_pos = (udf_ext0_offset(dir) >> 2); | 66 | nf_pos = udf_ext0_offset(dir); |
67 | 67 | ||
68 | fibh.soffset = fibh.eoffset = (nf_pos & ((dir->i_sb->s_blocksize - 1) >> 2)) << 2; | 68 | fibh.soffset = fibh.eoffset = nf_pos & (dir->i_sb->s_blocksize - 1); |
69 | iinfo = UDF_I(dir); | 69 | iinfo = UDF_I(dir); |
70 | if (iinfo->i_alloc_type == ICBTAG_FLAG_AD_IN_ICB) { | 70 | if (iinfo->i_alloc_type == ICBTAG_FLAG_AD_IN_ICB) { |
71 | fibh.sbh = fibh.ebh = NULL; | 71 | fibh.sbh = fibh.ebh = NULL; |
72 | } else if (inode_bmap(dir, nf_pos >> (dir->i_sb->s_blocksize_bits - 2), | 72 | } else if (inode_bmap(dir, nf_pos >> dir->i_sb->s_blocksize_bits, |
73 | &epos, &eloc, &elen, &offset) == (EXT_RECORDED_ALLOCATED >> 30)) { | 73 | &epos, &eloc, &elen, &offset) == (EXT_RECORDED_ALLOCATED >> 30)) { |
74 | block = udf_get_lb_pblock(dir->i_sb, eloc, offset); | 74 | block = udf_get_lb_pblock(dir->i_sb, eloc, offset); |
75 | if ((++offset << dir->i_sb->s_blocksize_bits) < elen) { | 75 | if ((++offset << dir->i_sb->s_blocksize_bits) < elen) { |
@@ -111,7 +111,7 @@ static int do_udf_readdir(struct inode *dir, struct file *filp, | |||
111 | } | 111 | } |
112 | 112 | ||
113 | while (nf_pos < size) { | 113 | while (nf_pos < size) { |
114 | filp->f_pos = nf_pos + 1; | 114 | filp->f_pos = (nf_pos >> 2) + 1; |
115 | 115 | ||
116 | fi = udf_fileident_read(dir, &nf_pos, &fibh, &cfi, &epos, &eloc, | 116 | fi = udf_fileident_read(dir, &nf_pos, &fibh, &cfi, &epos, &eloc, |
117 | &elen, &offset); | 117 | &elen, &offset); |
@@ -178,7 +178,7 @@ static int do_udf_readdir(struct inode *dir, struct file *filp, | |||
178 | } | 178 | } |
179 | } /* end while */ | 179 | } /* end while */ |
180 | 180 | ||
181 | filp->f_pos = nf_pos + 1; | 181 | filp->f_pos = (nf_pos >> 2) + 1; |
182 | 182 | ||
183 | if (fibh.sbh != fibh.ebh) | 183 | if (fibh.sbh != fibh.ebh) |
184 | brelse(fibh.ebh); | 184 | brelse(fibh.ebh); |