aboutsummaryrefslogtreecommitdiffstats
path: root/fs/udf/directory.c
diff options
context:
space:
mode:
authorJan Kara <jack@suse.cz>2008-02-08 07:20:50 -0500
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2008-02-08 12:22:36 -0500
commitaf793295bf9ee92660f5e77d337b0493cea3f9b9 (patch)
tree139f7dd09dbfcae1f98c3af52638e94a52ed5560 /fs/udf/directory.c
parent32a8f24dd75c2be34606e77414afba7bc6b5b366 (diff)
udf: cleanup directory offset handling
Position in directory returned by readdir is offset of directory entry divided by four (don't ask me why). Make this conversion only when reading f_pos from userspace / writing it there and internally work in bytes. It makes things more easily readable and also fixes a bug (we forgot to divide length of the entry by 4 when advancing f_pos in udf_add_entry()). Signed-off-by: Jan Kara <jack@suse.cz> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/udf/directory.c')
-rw-r--r--fs/udf/directory.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/fs/udf/directory.c b/fs/udf/directory.c
index be16d7698a8c..2820f8fcf4cc 100644
--- a/fs/udf/directory.c
+++ b/fs/udf/directory.c
@@ -95,7 +95,7 @@ struct fileIdentDesc *udf_fileident_read(struct inode *dir, loff_t *nf_pos,
95 if (!fi) 95 if (!fi)
96 return NULL; 96 return NULL;
97 97
98 *nf_pos += ((fibh->eoffset - fibh->soffset) >> 2); 98 *nf_pos += fibh->eoffset - fibh->soffset;
99 99
100 memcpy((uint8_t *)cfi, (uint8_t *)fi, 100 memcpy((uint8_t *)cfi, (uint8_t *)fi,
101 sizeof(struct fileIdentDesc)); 101 sizeof(struct fileIdentDesc));
@@ -157,7 +157,7 @@ struct fileIdentDesc *udf_fileident_read(struct inode *dir, loff_t *nf_pos,
157 if (!fi) 157 if (!fi)
158 return NULL; 158 return NULL;
159 159
160 *nf_pos += ((fibh->eoffset - fibh->soffset) >> 2); 160 *nf_pos += fibh->eoffset - fibh->soffset;
161 161
162 if (fibh->eoffset <= dir->i_sb->s_blocksize) { 162 if (fibh->eoffset <= dir->i_sb->s_blocksize) {
163 memcpy((uint8_t *)cfi, (uint8_t *)fi, 163 memcpy((uint8_t *)cfi, (uint8_t *)fi,
@@ -197,8 +197,7 @@ struct fileIdentDesc *udf_fileident_read(struct inode *dir, loff_t *nf_pos,
197 cfi->lengthFileIdent + 197 cfi->lengthFileIdent +
198 le16_to_cpu(cfi->lengthOfImpUse) + 3) & ~3; 198 le16_to_cpu(cfi->lengthOfImpUse) + 3) & ~3;
199 199
200 *nf_pos += (fi_len - (fibh->eoffset - fibh->soffset)) 200 *nf_pos += fi_len - (fibh->eoffset - fibh->soffset);
201 >> 2;
202 fibh->eoffset = fibh->soffset + fi_len; 201 fibh->eoffset = fibh->soffset + fi_len;
203 } else { 202 } else {
204 memcpy((uint8_t *)cfi, (uint8_t *)fi, 203 memcpy((uint8_t *)cfi, (uint8_t *)fi,