aboutsummaryrefslogtreecommitdiffstats
path: root/fs/hpfs/super.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/hpfs/super.c')
-rw-r--r--fs/hpfs/super.c50
1 files changed, 25 insertions, 25 deletions
diff --git a/fs/hpfs/super.c b/fs/hpfs/super.c
index 4a7d0266342b..98580a3b5005 100644
--- a/fs/hpfs/super.c
+++ b/fs/hpfs/super.c
@@ -135,7 +135,7 @@ static unsigned count_bitmaps(struct super_block *s)
135 n_bands = (hpfs_sb(s)->sb_fs_size + 0x3fff) >> 14; 135 n_bands = (hpfs_sb(s)->sb_fs_size + 0x3fff) >> 14;
136 count = 0; 136 count = 0;
137 for (n = 0; n < n_bands; n++) 137 for (n = 0; n < n_bands; n++)
138 count += hpfs_count_one_bitmap(s, hpfs_sb(s)->sb_bmp_dir[n]); 138 count += hpfs_count_one_bitmap(s, le32_to_cpu(hpfs_sb(s)->sb_bmp_dir[n]));
139 return count; 139 return count;
140} 140}
141 141
@@ -509,9 +509,9 @@ static int hpfs_fill_super(struct super_block *s, void *options, int silent)
509 if (!(spareblock = hpfs_map_sector(s, 17, &bh2, 0))) goto bail3; 509 if (!(spareblock = hpfs_map_sector(s, 17, &bh2, 0))) goto bail3;
510 510
511 /* Check magics */ 511 /* Check magics */
512 if (/*bootblock->magic != BB_MAGIC 512 if (/*le16_to_cpu(bootblock->magic) != BB_MAGIC
513 ||*/ superblock->magic != SB_MAGIC 513 ||*/ le32_to_cpu(superblock->magic) != SB_MAGIC
514 || spareblock->magic != SP_MAGIC) { 514 || le32_to_cpu(spareblock->magic) != SP_MAGIC) {
515 if (!silent) printk("HPFS: Bad magic ... probably not HPFS\n"); 515 if (!silent) printk("HPFS: Bad magic ... probably not HPFS\n");
516 goto bail4; 516 goto bail4;
517 } 517 }
@@ -532,12 +532,12 @@ static int hpfs_fill_super(struct super_block *s, void *options, int silent)
532 s->s_op = &hpfs_sops; 532 s->s_op = &hpfs_sops;
533 s->s_d_op = &hpfs_dentry_operations; 533 s->s_d_op = &hpfs_dentry_operations;
534 534
535 sbi->sb_root = superblock->root; 535 sbi->sb_root = le32_to_cpu(superblock->root);
536 sbi->sb_fs_size = superblock->n_sectors; 536 sbi->sb_fs_size = le32_to_cpu(superblock->n_sectors);
537 sbi->sb_bitmaps = superblock->bitmaps; 537 sbi->sb_bitmaps = le32_to_cpu(superblock->bitmaps);
538 sbi->sb_dirband_start = superblock->dir_band_start; 538 sbi->sb_dirband_start = le32_to_cpu(superblock->dir_band_start);
539 sbi->sb_dirband_size = superblock->n_dir_band; 539 sbi->sb_dirband_size = le32_to_cpu(superblock->n_dir_band);
540 sbi->sb_dmap = superblock->dir_band_bitmap; 540 sbi->sb_dmap = le32_to_cpu(superblock->dir_band_bitmap);
541 sbi->sb_uid = uid; 541 sbi->sb_uid = uid;
542 sbi->sb_gid = gid; 542 sbi->sb_gid = gid;
543 sbi->sb_mode = 0777 & ~umask; 543 sbi->sb_mode = 0777 & ~umask;
@@ -555,7 +555,7 @@ static int hpfs_fill_super(struct super_block *s, void *options, int silent)
555 sbi->sb_max_fwd_alloc = 0xffffff; 555 sbi->sb_max_fwd_alloc = 0xffffff;
556 556
557 /* Load bitmap directory */ 557 /* Load bitmap directory */
558 if (!(sbi->sb_bmp_dir = hpfs_load_bitmap_directory(s, superblock->bitmaps))) 558 if (!(sbi->sb_bmp_dir = hpfs_load_bitmap_directory(s, le32_to_cpu(superblock->bitmaps))))
559 goto bail4; 559 goto bail4;
560 560
561 /* Check for general fs errors*/ 561 /* Check for general fs errors*/
@@ -573,7 +573,7 @@ static int hpfs_fill_super(struct super_block *s, void *options, int silent)
573 mark_buffer_dirty(bh2); 573 mark_buffer_dirty(bh2);
574 } 574 }
575 575
576 if (spareblock->hotfixes_used || spareblock->n_spares_used) { 576 if (le32_to_cpu(spareblock->hotfixes_used) || le32_to_cpu(spareblock->n_spares_used)) {
577 if (errs >= 2) { 577 if (errs >= 2) {
578 printk("HPFS: Hotfixes not supported here, try chkdsk\n"); 578 printk("HPFS: Hotfixes not supported here, try chkdsk\n");
579 mark_dirty(s, 0); 579 mark_dirty(s, 0);
@@ -583,7 +583,7 @@ static int hpfs_fill_super(struct super_block *s, void *options, int silent)
583 if (errs == 0) printk("HPFS: Proceeding, but your filesystem will be probably corrupted by this driver...\n"); 583 if (errs == 0) printk("HPFS: Proceeding, but your filesystem will be probably corrupted by this driver...\n");
584 else printk("HPFS: This driver may read bad files or crash when operating on disk with hotfixes.\n"); 584 else printk("HPFS: This driver may read bad files or crash when operating on disk with hotfixes.\n");
585 } 585 }
586 if (spareblock->n_dnode_spares != spareblock->n_dnode_spares_free) { 586 if (le32_to_cpu(spareblock->n_dnode_spares) != le32_to_cpu(spareblock->n_dnode_spares_free)) {
587 if (errs >= 2) { 587 if (errs >= 2) {
588 printk("HPFS: Spare dnodes used, try chkdsk\n"); 588 printk("HPFS: Spare dnodes used, try chkdsk\n");
589 mark_dirty(s, 0); 589 mark_dirty(s, 0);
@@ -594,17 +594,17 @@ static int hpfs_fill_super(struct super_block *s, void *options, int silent)
594 } 594 }
595 if (chk) { 595 if (chk) {
596 unsigned a; 596 unsigned a;
597 if (superblock->dir_band_end - superblock->dir_band_start + 1 != superblock->n_dir_band || 597 if (le32_to_cpu(superblock->dir_band_end) - le32_to_cpu(superblock->dir_band_start) + 1 != le32_to_cpu(superblock->n_dir_band) ||
598 superblock->dir_band_end < superblock->dir_band_start || superblock->n_dir_band > 0x4000) { 598 le32_to_cpu(superblock->dir_band_end) < le32_to_cpu(superblock->dir_band_start) || le32_to_cpu(superblock->n_dir_band) > 0x4000) {
599 hpfs_error(s, "dir band size mismatch: dir_band_start==%08x, dir_band_end==%08x, n_dir_band==%08x", 599 hpfs_error(s, "dir band size mismatch: dir_band_start==%08x, dir_band_end==%08x, n_dir_band==%08x",
600 superblock->dir_band_start, superblock->dir_band_end, superblock->n_dir_band); 600 le32_to_cpu(superblock->dir_band_start), le32_to_cpu(superblock->dir_band_end), le32_to_cpu(superblock->n_dir_band));
601 goto bail4; 601 goto bail4;
602 } 602 }
603 a = sbi->sb_dirband_size; 603 a = sbi->sb_dirband_size;
604 sbi->sb_dirband_size = 0; 604 sbi->sb_dirband_size = 0;
605 if (hpfs_chk_sectors(s, superblock->dir_band_start, superblock->n_dir_band, "dir_band") || 605 if (hpfs_chk_sectors(s, le32_to_cpu(superblock->dir_band_start), le32_to_cpu(superblock->n_dir_band), "dir_band") ||
606 hpfs_chk_sectors(s, superblock->dir_band_bitmap, 4, "dir_band_bitmap") || 606 hpfs_chk_sectors(s, le32_to_cpu(superblock->dir_band_bitmap), 4, "dir_band_bitmap") ||
607 hpfs_chk_sectors(s, superblock->bitmaps, 4, "bitmaps")) { 607 hpfs_chk_sectors(s, le32_to_cpu(superblock->bitmaps), 4, "bitmaps")) {
608 mark_dirty(s, 0); 608 mark_dirty(s, 0);
609 goto bail4; 609 goto bail4;
610 } 610 }
@@ -612,8 +612,8 @@ static int hpfs_fill_super(struct super_block *s, void *options, int silent)
612 } else printk("HPFS: You really don't want any checks? You are crazy...\n"); 612 } else printk("HPFS: You really don't want any checks? You are crazy...\n");
613 613
614 /* Load code page table */ 614 /* Load code page table */
615 if (spareblock->n_code_pages) 615 if (le32_to_cpu(spareblock->n_code_pages))
616 if (!(sbi->sb_cp_table = hpfs_load_code_page(s, spareblock->code_page_dir))) 616 if (!(sbi->sb_cp_table = hpfs_load_code_page(s, le32_to_cpu(spareblock->code_page_dir))))
617 printk("HPFS: Warning: code page support is disabled\n"); 617 printk("HPFS: Warning: code page support is disabled\n");
618 618
619 brelse(bh2); 619 brelse(bh2);
@@ -642,13 +642,13 @@ static int hpfs_fill_super(struct super_block *s, void *options, int silent)
642 if (!de) 642 if (!de)
643 hpfs_error(s, "unable to find root dir"); 643 hpfs_error(s, "unable to find root dir");
644 else { 644 else {
645 root->i_atime.tv_sec = local_to_gmt(s, de->read_date); 645 root->i_atime.tv_sec = local_to_gmt(s, le32_to_cpu(de->read_date));
646 root->i_atime.tv_nsec = 0; 646 root->i_atime.tv_nsec = 0;
647 root->i_mtime.tv_sec = local_to_gmt(s, de->write_date); 647 root->i_mtime.tv_sec = local_to_gmt(s, le32_to_cpu(de->write_date));
648 root->i_mtime.tv_nsec = 0; 648 root->i_mtime.tv_nsec = 0;
649 root->i_ctime.tv_sec = local_to_gmt(s, de->creation_date); 649 root->i_ctime.tv_sec = local_to_gmt(s, le32_to_cpu(de->creation_date));
650 root->i_ctime.tv_nsec = 0; 650 root->i_ctime.tv_nsec = 0;
651 hpfs_i(root)->i_ea_size = de->ea_size; 651 hpfs_i(root)->i_ea_size = le16_to_cpu(de->ea_size);
652 hpfs_i(root)->i_parent_dir = root->i_ino; 652 hpfs_i(root)->i_parent_dir = root->i_ino;
653 if (root->i_size == -1) 653 if (root->i_size == -1)
654 root->i_size = 2048; 654 root->i_size = 2048;