diff options
author | Jan Kara <jack@suse.cz> | 2007-05-08 03:35:13 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-05-08 14:15:21 -0400 |
commit | 60448b1d6db4e82946ff9a2ac88df341f5fa87a2 (patch) | |
tree | d0623c3dc26be55aa17319e1e9e8d0fbeea98ac4 /fs/udf/namei.c | |
parent | 277866a0e3a4f97e859f7a621f5b4f5359c9526c (diff) |
udf: use sector_t and loff_t for file offsets
Use sector_t and loff_t for file offsets in UDF filesystem. Otherwise an
overflow may occur for long files. Also make inode_bmap() return offset in
the extent in number of blocks instead of number of bytes - for most
callers this is more convenient.
Signed-off-by: Jan Kara <jack@suse.cz>
Acked-by: Christoph Hellwig <hch@infradead.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/udf/namei.c')
-rw-r--r-- | fs/udf/namei.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/fs/udf/namei.c b/fs/udf/namei.c index b25437527de4..b9859ac169c4 100644 --- a/fs/udf/namei.c +++ b/fs/udf/namei.c | |||
@@ -156,7 +156,8 @@ udf_find_entry(struct inode *dir, struct dentry *dentry, | |||
156 | uint16_t liu; | 156 | uint16_t liu; |
157 | loff_t size; | 157 | loff_t size; |
158 | kernel_lb_addr bloc, eloc; | 158 | kernel_lb_addr bloc, eloc; |
159 | uint32_t extoffset, elen, offset; | 159 | uint32_t extoffset, elen; |
160 | sector_t offset; | ||
160 | struct buffer_head *bh = NULL; | 161 | struct buffer_head *bh = NULL; |
161 | 162 | ||
162 | size = (udf_ext0_offset(dir) + dir->i_size) >> 2; | 163 | size = (udf_ext0_offset(dir) + dir->i_size) >> 2; |
@@ -168,7 +169,6 @@ udf_find_entry(struct inode *dir, struct dentry *dentry, | |||
168 | else if (inode_bmap(dir, f_pos >> (dir->i_sb->s_blocksize_bits - 2), | 169 | else if (inode_bmap(dir, f_pos >> (dir->i_sb->s_blocksize_bits - 2), |
169 | &bloc, &extoffset, &eloc, &elen, &offset, &bh) == (EXT_RECORDED_ALLOCATED >> 30)) | 170 | &bloc, &extoffset, &eloc, &elen, &offset, &bh) == (EXT_RECORDED_ALLOCATED >> 30)) |
170 | { | 171 | { |
171 | offset >>= dir->i_sb->s_blocksize_bits; | ||
172 | block = udf_get_lb_pblock(dir->i_sb, eloc, offset); | 172 | block = udf_get_lb_pblock(dir->i_sb, eloc, offset); |
173 | if ((++offset << dir->i_sb->s_blocksize_bits) < elen) | 173 | if ((++offset << dir->i_sb->s_blocksize_bits) < elen) |
174 | { | 174 | { |
@@ -354,7 +354,8 @@ udf_add_entry(struct inode *dir, struct dentry *dentry, | |||
354 | uint16_t liu; | 354 | uint16_t liu; |
355 | int block; | 355 | int block; |
356 | kernel_lb_addr bloc, eloc; | 356 | kernel_lb_addr bloc, eloc; |
357 | uint32_t extoffset, elen, offset; | 357 | uint32_t extoffset, elen; |
358 | sector_t offset; | ||
358 | struct buffer_head *bh = NULL; | 359 | struct buffer_head *bh = NULL; |
359 | 360 | ||
360 | sb = dir->i_sb; | 361 | sb = dir->i_sb; |
@@ -386,7 +387,6 @@ udf_add_entry(struct inode *dir, struct dentry *dentry, | |||
386 | else if (inode_bmap(dir, f_pos >> (dir->i_sb->s_blocksize_bits - 2), | 387 | else if (inode_bmap(dir, f_pos >> (dir->i_sb->s_blocksize_bits - 2), |
387 | &bloc, &extoffset, &eloc, &elen, &offset, &bh) == (EXT_RECORDED_ALLOCATED >> 30)) | 388 | &bloc, &extoffset, &eloc, &elen, &offset, &bh) == (EXT_RECORDED_ALLOCATED >> 30)) |
388 | { | 389 | { |
389 | offset >>= dir->i_sb->s_blocksize_bits; | ||
390 | block = udf_get_lb_pblock(dir->i_sb, eloc, offset); | 390 | block = udf_get_lb_pblock(dir->i_sb, eloc, offset); |
391 | if ((++offset << dir->i_sb->s_blocksize_bits) < elen) | 391 | if ((++offset << dir->i_sb->s_blocksize_bits) < elen) |
392 | { | 392 | { |
@@ -782,7 +782,8 @@ static int empty_dir(struct inode *dir) | |||
782 | loff_t size = (udf_ext0_offset(dir) + dir->i_size) >> 2; | 782 | loff_t size = (udf_ext0_offset(dir) + dir->i_size) >> 2; |
783 | int block; | 783 | int block; |
784 | kernel_lb_addr bloc, eloc; | 784 | kernel_lb_addr bloc, eloc; |
785 | uint32_t extoffset, elen, offset; | 785 | uint32_t extoffset, elen; |
786 | sector_t offset; | ||
786 | struct buffer_head *bh = NULL; | 787 | struct buffer_head *bh = NULL; |
787 | 788 | ||
788 | f_pos = (udf_ext0_offset(dir) >> 2); | 789 | f_pos = (udf_ext0_offset(dir) >> 2); |
@@ -794,7 +795,6 @@ static int empty_dir(struct inode *dir) | |||
794 | else if (inode_bmap(dir, f_pos >> (dir->i_sb->s_blocksize_bits - 2), | 795 | else if (inode_bmap(dir, f_pos >> (dir->i_sb->s_blocksize_bits - 2), |
795 | &bloc, &extoffset, &eloc, &elen, &offset, &bh) == (EXT_RECORDED_ALLOCATED >> 30)) | 796 | &bloc, &extoffset, &eloc, &elen, &offset, &bh) == (EXT_RECORDED_ALLOCATED >> 30)) |
796 | { | 797 | { |
797 | offset >>= dir->i_sb->s_blocksize_bits; | ||
798 | block = udf_get_lb_pblock(dir->i_sb, eloc, offset); | 798 | block = udf_get_lb_pblock(dir->i_sb, eloc, offset); |
799 | if ((++offset << dir->i_sb->s_blocksize_bits) < elen) | 799 | if ((++offset << dir->i_sb->s_blocksize_bits) < elen) |
800 | { | 800 | { |