diff options
author | Mikulas Patocka <mikulas@artax.karlin.mff.cuni.cz> | 2011-05-08 14:44:26 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-05-09 12:04:24 -0400 |
commit | 0b69760be6968c528869d4aec95ecf64dbf3e8bd (patch) | |
tree | ebc1f353c7df72bfe28b9da64af810c20ca8cdd4 /fs/hpfs/dir.c | |
parent | bc8728ee56bca62df269b2dd159bc60838ac8e80 (diff) |
HPFS: Fix endianity. Make hpfs work on big-endian machines
Fix endianity. Make hpfs work on big-endian machines.
Signed-off-by: Mikulas Patocka <mikulas@artax.karlin.mff.cuni.cz>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/hpfs/dir.c')
-rw-r--r-- | fs/hpfs/dir.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/fs/hpfs/dir.c b/fs/hpfs/dir.c index 208f3d7769d5..f46ae025bfb5 100644 --- a/fs/hpfs/dir.c +++ b/fs/hpfs/dir.c | |||
@@ -88,9 +88,9 @@ static int hpfs_readdir(struct file *filp, void *dirent, filldir_t filldir) | |||
88 | hpfs_error(inode->i_sb, "not a directory, fnode %08lx", | 88 | hpfs_error(inode->i_sb, "not a directory, fnode %08lx", |
89 | (unsigned long)inode->i_ino); | 89 | (unsigned long)inode->i_ino); |
90 | } | 90 | } |
91 | if (hpfs_inode->i_dno != fno->u.external[0].disk_secno) { | 91 | if (hpfs_inode->i_dno != le32_to_cpu(fno->u.external[0].disk_secno)) { |
92 | e = 1; | 92 | e = 1; |
93 | hpfs_error(inode->i_sb, "corrupted inode: i_dno == %08x, fnode -> dnode == %08x", hpfs_inode->i_dno, fno->u.external[0].disk_secno); | 93 | hpfs_error(inode->i_sb, "corrupted inode: i_dno == %08x, fnode -> dnode == %08x", hpfs_inode->i_dno, le32_to_cpu(fno->u.external[0].disk_secno)); |
94 | } | 94 | } |
95 | brelse(bh); | 95 | brelse(bh); |
96 | if (e) { | 96 | if (e) { |
@@ -156,7 +156,7 @@ static int hpfs_readdir(struct file *filp, void *dirent, filldir_t filldir) | |||
156 | goto again; | 156 | goto again; |
157 | } | 157 | } |
158 | tempname = hpfs_translate_name(inode->i_sb, de->name, de->namelen, lc, de->not_8x3); | 158 | tempname = hpfs_translate_name(inode->i_sb, de->name, de->namelen, lc, de->not_8x3); |
159 | if (filldir(dirent, tempname, de->namelen, old_pos, de->fnode, DT_UNKNOWN) < 0) { | 159 | if (filldir(dirent, tempname, de->namelen, old_pos, le32_to_cpu(de->fnode), DT_UNKNOWN) < 0) { |
160 | filp->f_pos = old_pos; | 160 | filp->f_pos = old_pos; |
161 | if (tempname != de->name) kfree(tempname); | 161 | if (tempname != de->name) kfree(tempname); |
162 | hpfs_brelse4(&qbh); | 162 | hpfs_brelse4(&qbh); |
@@ -221,7 +221,7 @@ struct dentry *hpfs_lookup(struct inode *dir, struct dentry *dentry, struct name | |||
221 | * Get inode number, what we're after. | 221 | * Get inode number, what we're after. |
222 | */ | 222 | */ |
223 | 223 | ||
224 | ino = de->fnode; | 224 | ino = le32_to_cpu(de->fnode); |
225 | 225 | ||
226 | /* | 226 | /* |
227 | * Go find or make an inode. | 227 | * Go find or make an inode. |
@@ -236,7 +236,7 @@ struct dentry *hpfs_lookup(struct inode *dir, struct dentry *dentry, struct name | |||
236 | hpfs_init_inode(result); | 236 | hpfs_init_inode(result); |
237 | if (de->directory) | 237 | if (de->directory) |
238 | hpfs_read_inode(result); | 238 | hpfs_read_inode(result); |
239 | else if (de->ea_size && hpfs_sb(dir->i_sb)->sb_eas) | 239 | else if (le32_to_cpu(de->ea_size) && hpfs_sb(dir->i_sb)->sb_eas) |
240 | hpfs_read_inode(result); | 240 | hpfs_read_inode(result); |
241 | else { | 241 | else { |
242 | result->i_mode |= S_IFREG; | 242 | result->i_mode |= S_IFREG; |
@@ -261,19 +261,19 @@ struct dentry *hpfs_lookup(struct inode *dir, struct dentry *dentry, struct name | |||
261 | */ | 261 | */ |
262 | 262 | ||
263 | if (!result->i_ctime.tv_sec) { | 263 | if (!result->i_ctime.tv_sec) { |
264 | if (!(result->i_ctime.tv_sec = local_to_gmt(dir->i_sb, de->creation_date))) | 264 | if (!(result->i_ctime.tv_sec = local_to_gmt(dir->i_sb, le32_to_cpu(de->creation_date)))) |
265 | result->i_ctime.tv_sec = 1; | 265 | result->i_ctime.tv_sec = 1; |
266 | result->i_ctime.tv_nsec = 0; | 266 | result->i_ctime.tv_nsec = 0; |
267 | result->i_mtime.tv_sec = local_to_gmt(dir->i_sb, de->write_date); | 267 | result->i_mtime.tv_sec = local_to_gmt(dir->i_sb, le32_to_cpu(de->write_date)); |
268 | result->i_mtime.tv_nsec = 0; | 268 | result->i_mtime.tv_nsec = 0; |
269 | result->i_atime.tv_sec = local_to_gmt(dir->i_sb, de->read_date); | 269 | result->i_atime.tv_sec = local_to_gmt(dir->i_sb, le32_to_cpu(de->read_date)); |
270 | result->i_atime.tv_nsec = 0; | 270 | result->i_atime.tv_nsec = 0; |
271 | hpfs_result->i_ea_size = de->ea_size; | 271 | hpfs_result->i_ea_size = le32_to_cpu(de->ea_size); |
272 | if (!hpfs_result->i_ea_mode && de->read_only) | 272 | if (!hpfs_result->i_ea_mode && de->read_only) |
273 | result->i_mode &= ~0222; | 273 | result->i_mode &= ~0222; |
274 | if (!de->directory) { | 274 | if (!de->directory) { |
275 | if (result->i_size == -1) { | 275 | if (result->i_size == -1) { |
276 | result->i_size = de->file_size; | 276 | result->i_size = le32_to_cpu(de->file_size); |
277 | result->i_data.a_ops = &hpfs_aops; | 277 | result->i_data.a_ops = &hpfs_aops; |
278 | hpfs_i(result)->mmu_private = result->i_size; | 278 | hpfs_i(result)->mmu_private = result->i_size; |
279 | /* | 279 | /* |