super.c (14da17f9c4a880e3418f7f04071df3cb2e8636e8) | super.c (a19189e5535ed8fd191d8989fc39da1637cfa224) |
---|---|
1/* 2 * linux/fs/hpfs/super.c 3 * 4 * Mikulas Patocka (mikulas@artax.karlin.mff.cuni.cz), 1998-1999 5 * 6 * mounting, unmounting, error handling 7 */ 8 --- 424 unchanged lines hidden (view full) --- 433 uid = sbi->sb_uid; gid = sbi->sb_gid; 434 umask = 0777 & ~sbi->sb_mode; 435 lowercase = sbi->sb_lowercase; 436 eas = sbi->sb_eas; chk = sbi->sb_chk; chkdsk = sbi->sb_chkdsk; 437 errs = sbi->sb_err; timeshift = sbi->sb_timeshift; 438 439 if (!(o = parse_opts(data, &uid, &gid, &umask, &lowercase, 440 &eas, &chk, &errs, &chkdsk, ×hift))) { | 1/* 2 * linux/fs/hpfs/super.c 3 * 4 * Mikulas Patocka (mikulas@artax.karlin.mff.cuni.cz), 1998-1999 5 * 6 * mounting, unmounting, error handling 7 */ 8 --- 424 unchanged lines hidden (view full) --- 433 uid = sbi->sb_uid; gid = sbi->sb_gid; 434 umask = 0777 & ~sbi->sb_mode; 435 lowercase = sbi->sb_lowercase; 436 eas = sbi->sb_eas; chk = sbi->sb_chk; chkdsk = sbi->sb_chkdsk; 437 errs = sbi->sb_err; timeshift = sbi->sb_timeshift; 438 439 if (!(o = parse_opts(data, &uid, &gid, &umask, &lowercase, 440 &eas, &chk, &errs, &chkdsk, ×hift))) { |
441 pr_warn("bad mount options.\n"); | 441 pr_err("bad mount options.\n"); |
442 goto out_err; 443 } 444 if (o == 2) { 445 hpfs_help(); 446 goto out_err; 447 } 448 if (timeshift != sbi->sb_timeshift) { | 442 goto out_err; 443 } 444 if (o == 2) { 445 hpfs_help(); 446 goto out_err; 447 } 448 if (timeshift != sbi->sb_timeshift) { |
449 pr_warn("timeshift can't be changed using remount.\n"); | 449 pr_err("timeshift can't be changed using remount.\n"); |
450 goto out_err; 451 } 452 453 unmark_dirty(s); 454 455 sbi->sb_uid = uid; sbi->sb_gid = gid; 456 sbi->sb_mode = 0777 & ~umask; 457 sbi->sb_lowercase = lowercase; --- 64 unchanged lines hidden (view full) --- 522 eas = 2; 523 chk = 1; 524 errs = 1; 525 chkdsk = 1; 526 timeshift = 0; 527 528 if (!(o = parse_opts(options, &uid, &gid, &umask, &lowercase, 529 &eas, &chk, &errs, &chkdsk, ×hift))) { | 450 goto out_err; 451 } 452 453 unmark_dirty(s); 454 455 sbi->sb_uid = uid; sbi->sb_gid = gid; 456 sbi->sb_mode = 0777 & ~umask; 457 sbi->sb_lowercase = lowercase; --- 64 unchanged lines hidden (view full) --- 522 eas = 2; 523 chk = 1; 524 errs = 1; 525 chkdsk = 1; 526 timeshift = 0; 527 528 if (!(o = parse_opts(options, &uid, &gid, &umask, &lowercase, 529 &eas, &chk, &errs, &chkdsk, ×hift))) { |
530 pr_warn("bad mount options.\n"); | 530 pr_err("bad mount options.\n"); |
531 goto bail0; 532 } 533 if (o==2) { 534 hpfs_help(); 535 goto bail0; 536 } 537 538 /*sbi->sb_mounting = 1;*/ 539 sb_set_blocksize(s, 512); 540 sbi->sb_fs_size = -1; 541 if (!(bootblock = hpfs_map_sector(s, 0, &bh0, 0))) goto bail1; 542 if (!(superblock = hpfs_map_sector(s, 16, &bh1, 1))) goto bail2; 543 if (!(spareblock = hpfs_map_sector(s, 17, &bh2, 0))) goto bail3; 544 545 /* Check magics */ 546 if (/*le16_to_cpu(bootblock->magic) != BB_MAGIC 547 ||*/ le32_to_cpu(superblock->magic) != SB_MAGIC 548 || le32_to_cpu(spareblock->magic) != SP_MAGIC) { 549 if (!silent) | 531 goto bail0; 532 } 533 if (o==2) { 534 hpfs_help(); 535 goto bail0; 536 } 537 538 /*sbi->sb_mounting = 1;*/ 539 sb_set_blocksize(s, 512); 540 sbi->sb_fs_size = -1; 541 if (!(bootblock = hpfs_map_sector(s, 0, &bh0, 0))) goto bail1; 542 if (!(superblock = hpfs_map_sector(s, 16, &bh1, 1))) goto bail2; 543 if (!(spareblock = hpfs_map_sector(s, 17, &bh2, 0))) goto bail3; 544 545 /* Check magics */ 546 if (/*le16_to_cpu(bootblock->magic) != BB_MAGIC 547 ||*/ le32_to_cpu(superblock->magic) != SB_MAGIC 548 || le32_to_cpu(spareblock->magic) != SP_MAGIC) { 549 if (!silent) |
550 pr_warn("Bad magic ... probably not HPFS\n"); | 550 pr_err("Bad magic ... probably not HPFS\n"); |
551 goto bail4; 552 } 553 554 /* Check version */ 555 if (!(s->s_flags & MS_RDONLY) && 556 superblock->funcversion != 2 && superblock->funcversion != 3) { | 551 goto bail4; 552 } 553 554 /* Check version */ 555 if (!(s->s_flags & MS_RDONLY) && 556 superblock->funcversion != 2 && superblock->funcversion != 3) { |
557 pr_warn("Bad version %d,%d. Mount readonly to go around\n", | 557 pr_err("Bad version %d,%d. Mount readonly to go around\n", |
558 (int)superblock->version, (int)superblock->funcversion); | 558 (int)superblock->version, (int)superblock->funcversion); |
559 pr_warn("please try recent version of HPFS driver at http://artax.karlin.mff.cuni.cz/~mikulas/vyplody/hpfs/index-e.cgi and if it still can't understand this format, contact author - mikulas@artax.karlin.mff.cuni.cz\n"); | 559 pr_err("please try recent version of HPFS driver at http://artax.karlin.mff.cuni.cz/~mikulas/vyplody/hpfs/index-e.cgi and if it still can't understand this format, contact author - mikulas@artax.karlin.mff.cuni.cz\n"); |
560 goto bail4; 561 } 562 563 s->s_flags |= MS_NOATIME; 564 565 /* Fill superblock stuff */ 566 s->s_magic = HPFS_SUPER_MAGIC; 567 s->s_op = &hpfs_sops; --- 29 unchanged lines hidden (view full) --- 597 598 /* Load bitmap directory */ 599 if (!(sbi->sb_bmp_dir = hpfs_load_bitmap_directory(s, le32_to_cpu(superblock->bitmaps)))) 600 goto bail4; 601 602 /* Check for general fs errors*/ 603 if (spareblock->dirty && !spareblock->old_wrote) { 604 if (errs == 2) { | 560 goto bail4; 561 } 562 563 s->s_flags |= MS_NOATIME; 564 565 /* Fill superblock stuff */ 566 s->s_magic = HPFS_SUPER_MAGIC; 567 s->s_op = &hpfs_sops; --- 29 unchanged lines hidden (view full) --- 597 598 /* Load bitmap directory */ 599 if (!(sbi->sb_bmp_dir = hpfs_load_bitmap_directory(s, le32_to_cpu(superblock->bitmaps)))) 600 goto bail4; 601 602 /* Check for general fs errors*/ 603 if (spareblock->dirty && !spareblock->old_wrote) { 604 if (errs == 2) { |
605 pr_warn("Improperly stopped, not mounted\n"); | 605 pr_err("Improperly stopped, not mounted\n"); |
606 goto bail4; 607 } 608 hpfs_error(s, "improperly stopped"); 609 } 610 611 if (!(s->s_flags & MS_RDONLY)) { 612 spareblock->dirty = 1; 613 spareblock->old_wrote = 0; 614 mark_buffer_dirty(bh2); 615 } 616 617 if (spareblock->hotfixes_used || spareblock->n_spares_used) { 618 if (errs >= 2) { | 606 goto bail4; 607 } 608 hpfs_error(s, "improperly stopped"); 609 } 610 611 if (!(s->s_flags & MS_RDONLY)) { 612 spareblock->dirty = 1; 613 spareblock->old_wrote = 0; 614 mark_buffer_dirty(bh2); 615 } 616 617 if (spareblock->hotfixes_used || spareblock->n_spares_used) { 618 if (errs >= 2) { |
619 pr_warn("Hotfixes not supported here, try chkdsk\n"); | 619 pr_err("Hotfixes not supported here, try chkdsk\n"); |
620 mark_dirty(s, 0); 621 goto bail4; 622 } 623 hpfs_error(s, "hotfixes not supported here, try chkdsk"); 624 if (errs == 0) | 620 mark_dirty(s, 0); 621 goto bail4; 622 } 623 hpfs_error(s, "hotfixes not supported here, try chkdsk"); 624 if (errs == 0) |
625 pr_warn("Proceeding, but your filesystem will be probably corrupted by this driver...\n"); | 625 pr_err("Proceeding, but your filesystem will be probably corrupted by this driver...\n"); |
626 else | 626 else |
627 pr_warn("This driver may read bad files or crash when operating on disk with hotfixes.\n"); | 627 pr_err("This driver may read bad files or crash when operating on disk with hotfixes.\n"); |
628 } 629 if (le32_to_cpu(spareblock->n_dnode_spares) != le32_to_cpu(spareblock->n_dnode_spares_free)) { 630 if (errs >= 2) { | 628 } 629 if (le32_to_cpu(spareblock->n_dnode_spares) != le32_to_cpu(spareblock->n_dnode_spares_free)) { 630 if (errs >= 2) { |
631 pr_warn("Spare dnodes used, try chkdsk\n"); | 631 pr_err("Spare dnodes used, try chkdsk\n"); |
632 mark_dirty(s, 0); 633 goto bail4; 634 } 635 hpfs_error(s, "warning: spare dnodes used, try chkdsk"); 636 if (errs == 0) | 632 mark_dirty(s, 0); 633 goto bail4; 634 } 635 hpfs_error(s, "warning: spare dnodes used, try chkdsk"); 636 if (errs == 0) |
637 pr_warn("Proceeding, but your filesystem could be corrupted if you delete files or directories\n"); | 637 pr_err("Proceeding, but your filesystem could be corrupted if you delete files or directories\n"); |
638 } 639 if (chk) { 640 unsigned a; 641 if (le32_to_cpu(superblock->dir_band_end) - le32_to_cpu(superblock->dir_band_start) + 1 != le32_to_cpu(superblock->n_dir_band) || 642 le32_to_cpu(superblock->dir_band_end) < le32_to_cpu(superblock->dir_band_start) || le32_to_cpu(superblock->n_dir_band) > 0x4000) { 643 hpfs_error(s, "dir band size mismatch: dir_band_start==%08x, dir_band_end==%08x, n_dir_band==%08x", 644 le32_to_cpu(superblock->dir_band_start), le32_to_cpu(superblock->dir_band_end), le32_to_cpu(superblock->n_dir_band)); 645 goto bail4; 646 } 647 a = sbi->sb_dirband_size; 648 sbi->sb_dirband_size = 0; 649 if (hpfs_chk_sectors(s, le32_to_cpu(superblock->dir_band_start), le32_to_cpu(superblock->n_dir_band), "dir_band") || 650 hpfs_chk_sectors(s, le32_to_cpu(superblock->dir_band_bitmap), 4, "dir_band_bitmap") || 651 hpfs_chk_sectors(s, le32_to_cpu(superblock->bitmaps), 4, "bitmaps")) { 652 mark_dirty(s, 0); 653 goto bail4; 654 } 655 sbi->sb_dirband_size = a; 656 } else | 638 } 639 if (chk) { 640 unsigned a; 641 if (le32_to_cpu(superblock->dir_band_end) - le32_to_cpu(superblock->dir_band_start) + 1 != le32_to_cpu(superblock->n_dir_band) || 642 le32_to_cpu(superblock->dir_band_end) < le32_to_cpu(superblock->dir_band_start) || le32_to_cpu(superblock->n_dir_band) > 0x4000) { 643 hpfs_error(s, "dir band size mismatch: dir_band_start==%08x, dir_band_end==%08x, n_dir_band==%08x", 644 le32_to_cpu(superblock->dir_band_start), le32_to_cpu(superblock->dir_band_end), le32_to_cpu(superblock->n_dir_band)); 645 goto bail4; 646 } 647 a = sbi->sb_dirband_size; 648 sbi->sb_dirband_size = 0; 649 if (hpfs_chk_sectors(s, le32_to_cpu(superblock->dir_band_start), le32_to_cpu(superblock->n_dir_band), "dir_band") || 650 hpfs_chk_sectors(s, le32_to_cpu(superblock->dir_band_bitmap), 4, "dir_band_bitmap") || 651 hpfs_chk_sectors(s, le32_to_cpu(superblock->bitmaps), 4, "bitmaps")) { 652 mark_dirty(s, 0); 653 goto bail4; 654 } 655 sbi->sb_dirband_size = a; 656 } else |
657 pr_warn("You really don't want any checks? You are crazy...\n"); | 657 pr_err("You really don't want any checks? You are crazy...\n"); |
658 659 /* Load code page table */ 660 if (le32_to_cpu(spareblock->n_code_pages)) 661 if (!(sbi->sb_cp_table = hpfs_load_code_page(s, le32_to_cpu(spareblock->code_page_dir)))) | 658 659 /* Load code page table */ 660 if (le32_to_cpu(spareblock->n_code_pages)) 661 if (!(sbi->sb_cp_table = hpfs_load_code_page(s, le32_to_cpu(spareblock->code_page_dir)))) |
662 pr_warn("code page support is disabled\n"); | 662 pr_err("code page support is disabled\n"); |
663 664 brelse(bh2); 665 brelse(bh1); 666 brelse(bh0); 667 668 root = iget_locked(s, sbi->sb_root); 669 if (!root) 670 goto bail0; --- 83 unchanged lines hidden --- | 663 664 brelse(bh2); 665 brelse(bh1); 666 brelse(bh0); 667 668 root = iget_locked(s, sbi->sb_root); 669 if (!root) 670 goto bail0; --- 83 unchanged lines hidden --- |