aboutsummaryrefslogtreecommitdiffstats
path: root/fs/isofs/inode.c
diff options
context:
space:
mode:
authorDave Jones <davej@redhat.com>2007-07-16 02:40:03 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-07-16 12:05:42 -0400
commitc3ed85a36ff5b01f340db67ac5ae6e699d3b8a2b (patch)
treee033938ac13204719ada8e27a185eeb03af3dc8d /fs/isofs/inode.c
parent1b28f22a87a5a2f0ab39f2549441bbe5eb2e369f (diff)
isofs: fix up CodingStyle
fs/isofs/* had a bunch of CodingStyle issues. * Indentation was a mix of spaces and tabs * "int * foo" instead of "int *foo" * "while ( foo )" instead of "while (foo)" * if (foo) blah; on one line instead of two * Missing printk KERN_ levels * lots of trailing whitespace * lines >80 columns changed to wrap. * Unnecessary prototype removed by shuffling code order in C file. Should be no functional changes other than slight size increase due to printk changes. Further improvement possible, but this is a start.. Signed-off-by: Dave Jones <davej@redhat.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/isofs/inode.c')
-rw-r--r--fs/isofs/inode.c415
1 files changed, 213 insertions, 202 deletions
diff --git a/fs/isofs/inode.c b/fs/isofs/inode.c
index 5c3eecf7542e..15c866f1a1fd 100644
--- a/fs/isofs/inode.c
+++ b/fs/isofs/inode.c
@@ -73,20 +73,20 @@ static void isofs_destroy_inode(struct inode *inode)
73 kmem_cache_free(isofs_inode_cachep, ISOFS_I(inode)); 73 kmem_cache_free(isofs_inode_cachep, ISOFS_I(inode));
74} 74}
75 75
76static void init_once(void *foo, struct kmem_cache * cachep, unsigned long flags) 76static void init_once(void *foo, struct kmem_cache *cachep, unsigned long flags)
77{ 77{
78 struct iso_inode_info *ei = foo; 78 struct iso_inode_info *ei = foo;
79 79
80 inode_init_once(&ei->vfs_inode); 80 inode_init_once(&ei->vfs_inode);
81} 81}
82 82
83static int init_inodecache(void) 83static int init_inodecache(void)
84{ 84{
85 isofs_inode_cachep = kmem_cache_create("isofs_inode_cache", 85 isofs_inode_cachep = kmem_cache_create("isofs_inode_cache",
86 sizeof(struct iso_inode_info), 86 sizeof(struct iso_inode_info),
87 0, (SLAB_RECLAIM_ACCOUNT| 87 0, (SLAB_RECLAIM_ACCOUNT|
88 SLAB_MEM_SPREAD), 88 SLAB_MEM_SPREAD),
89 init_once, NULL); 89 init_once, NULL);
90 if (isofs_inode_cachep == NULL) 90 if (isofs_inode_cachep == NULL)
91 return -ENOMEM; 91 return -ENOMEM;
92 return 0; 92 return 0;
@@ -150,9 +150,9 @@ struct iso9660_options{
150 uid_t uid; 150 uid_t uid;
151 char *iocharset; 151 char *iocharset;
152 unsigned char utf8; 152 unsigned char utf8;
153 /* LVE */ 153 /* LVE */
154 s32 session; 154 s32 session;
155 s32 sbsector; 155 s32 sbsector;
156}; 156};
157 157
158/* 158/*
@@ -360,10 +360,12 @@ static int parse_options(char *options, struct iso9660_options *popt)
360 popt->check = 'u'; /* unset */ 360 popt->check = 'u'; /* unset */
361 popt->nocompress = 0; 361 popt->nocompress = 0;
362 popt->blocksize = 1024; 362 popt->blocksize = 1024;
363 popt->mode = S_IRUGO | S_IXUGO; /* r-x for all. The disc could 363 popt->mode = S_IRUGO | S_IXUGO; /*
364 be shared with DOS machines so 364 * r-x for all. The disc could
365 virtually anything could be 365 * be shared with DOS machines so
366 a valid executable. */ 366 * virtually anything could be
367 * a valid executable.
368 */
367 popt->gid = 0; 369 popt->gid = 0;
368 popt->uid = 0; 370 popt->uid = 0;
369 popt->iocharset = NULL; 371 popt->iocharset = NULL;
@@ -503,30 +505,30 @@ static unsigned int isofs_get_last_session(struct super_block *sb, s32 session)
503 Te.cdte_format=CDROM_LBA; 505 Te.cdte_format=CDROM_LBA;
504 i = ioctl_by_bdev(bdev, CDROMREADTOCENTRY, (unsigned long) &Te); 506 i = ioctl_by_bdev(bdev, CDROMREADTOCENTRY, (unsigned long) &Te);
505 if (!i) { 507 if (!i) {
506 printk(KERN_DEBUG "Session %d start %d type %d\n", 508 printk(KERN_DEBUG "ISOFS: Session %d start %d type %d\n",
507 session, Te.cdte_addr.lba, 509 session, Te.cdte_addr.lba,
508 Te.cdte_ctrl&CDROM_DATA_TRACK); 510 Te.cdte_ctrl&CDROM_DATA_TRACK);
509 if ((Te.cdte_ctrl&CDROM_DATA_TRACK) == 4) 511 if ((Te.cdte_ctrl&CDROM_DATA_TRACK) == 4)
510 return Te.cdte_addr.lba; 512 return Te.cdte_addr.lba;
511 } 513 }
512 514
513 printk(KERN_ERR "Invalid session number or type of track\n"); 515 printk(KERN_ERR "ISOFS: Invalid session number or type of track\n");
514 } 516 }
515 i = ioctl_by_bdev(bdev, CDROMMULTISESSION, (unsigned long) &ms_info); 517 i = ioctl_by_bdev(bdev, CDROMMULTISESSION, (unsigned long) &ms_info);
516 if (session > 0) 518 if (session > 0)
517 printk(KERN_ERR "Invalid session number\n"); 519 printk(KERN_ERR "ISOFS: Invalid session number\n");
518#if 0 520#if 0
519 printk("isofs.inode: CDROMMULTISESSION: rc=%d\n",i); 521 printk(KERN_DEBUG "isofs.inode: CDROMMULTISESSION: rc=%d\n",i);
520 if (i==0) { 522 if (i==0) {
521 printk("isofs.inode: XA disk: %s\n",ms_info.xa_flag?"yes":"no"); 523 printk(KERN_DEBUG "isofs.inode: XA disk: %s\n",ms_info.xa_flag?"yes":"no");
522 printk("isofs.inode: vol_desc_start = %d\n", ms_info.addr.lba); 524 printk(KERN_DEBUG "isofs.inode: vol_desc_start = %d\n", ms_info.addr.lba);
523 } 525 }
524#endif 526#endif
525 if (i==0) 527 if (i==0)
526#if WE_OBEY_THE_WRITTEN_STANDARDS 528#if WE_OBEY_THE_WRITTEN_STANDARDS
527 if (ms_info.xa_flag) /* necessary for a valid ms_info.addr */ 529 if (ms_info.xa_flag) /* necessary for a valid ms_info.addr */
528#endif 530#endif
529 vol_desc_start=ms_info.addr.lba; 531 vol_desc_start=ms_info.addr.lba;
530 return vol_desc_start; 532 return vol_desc_start;
531} 533}
532 534
@@ -538,20 +540,20 @@ static unsigned int isofs_get_last_session(struct super_block *sb, s32 session)
538 */ 540 */
539static int isofs_fill_super(struct super_block *s, void *data, int silent) 541static int isofs_fill_super(struct super_block *s, void *data, int silent)
540{ 542{
541 struct buffer_head * bh = NULL, *pri_bh = NULL; 543 struct buffer_head *bh = NULL, *pri_bh = NULL;
542 struct hs_primary_descriptor * h_pri = NULL; 544 struct hs_primary_descriptor *h_pri = NULL;
543 struct iso_primary_descriptor * pri = NULL; 545 struct iso_primary_descriptor *pri = NULL;
544 struct iso_supplementary_descriptor *sec = NULL; 546 struct iso_supplementary_descriptor *sec = NULL;
545 struct iso_directory_record * rootp; 547 struct iso_directory_record *rootp;
546 int joliet_level = 0; 548 struct inode *inode;
547 int iso_blknum, block; 549 struct iso9660_options opt;
548 int orig_zonesize; 550 struct isofs_sb_info *sbi;
549 int table; 551 unsigned long first_data_zone;
550 unsigned int vol_desc_start; 552 int joliet_level = 0;
551 unsigned long first_data_zone; 553 int iso_blknum, block;
552 struct inode * inode; 554 int orig_zonesize;
553 struct iso9660_options opt; 555 int table;
554 struct isofs_sb_info * sbi; 556 unsigned int vol_desc_start;
555 557
556 sbi = kzalloc(sizeof(*sbi), GFP_KERNEL); 558 sbi = kzalloc(sizeof(*sbi), GFP_KERNEL);
557 if (!sbi) 559 if (!sbi)
@@ -577,72 +579,73 @@ static int isofs_fill_super(struct super_block *s, void *data, int silent)
577 vol_desc_start = (opt.sbsector != -1) ? 579 vol_desc_start = (opt.sbsector != -1) ?
578 opt.sbsector : isofs_get_last_session(s,opt.session); 580 opt.sbsector : isofs_get_last_session(s,opt.session);
579 581
580 for (iso_blknum = vol_desc_start+16; 582 for (iso_blknum = vol_desc_start+16;
581 iso_blknum < vol_desc_start+100; iso_blknum++) 583 iso_blknum < vol_desc_start+100; iso_blknum++) {
582 { 584 struct hs_volume_descriptor *hdp;
583 struct hs_volume_descriptor * hdp; 585 struct iso_volume_descriptor *vdp;
584 struct iso_volume_descriptor * vdp; 586
585 587 block = iso_blknum << (ISOFS_BLOCK_BITS - s->s_blocksize_bits);
586 block = iso_blknum << (ISOFS_BLOCK_BITS - s->s_blocksize_bits); 588 if (!(bh = sb_bread(s, block)))
587 if (!(bh = sb_bread(s, block))) 589 goto out_no_read;
588 goto out_no_read; 590
589 591 vdp = (struct iso_volume_descriptor *)bh->b_data;
590 vdp = (struct iso_volume_descriptor *)bh->b_data; 592 hdp = (struct hs_volume_descriptor *)bh->b_data;
591 hdp = (struct hs_volume_descriptor *)bh->b_data; 593
592 594 /*
593 /* Due to the overlapping physical location of the descriptors, 595 * Due to the overlapping physical location of the descriptors,
594 * ISO CDs can match hdp->id==HS_STANDARD_ID as well. To ensure 596 * ISO CDs can match hdp->id==HS_STANDARD_ID as well. To ensure
595 * proper identification in this case, we first check for ISO. 597 * proper identification in this case, we first check for ISO.
596 */ 598 */
597 if (strncmp (vdp->id, ISO_STANDARD_ID, sizeof vdp->id) == 0) { 599 if (strncmp (vdp->id, ISO_STANDARD_ID, sizeof vdp->id) == 0) {
598 if (isonum_711 (vdp->type) == ISO_VD_END) 600 if (isonum_711(vdp->type) == ISO_VD_END)
599 break; 601 break;
600 if (isonum_711 (vdp->type) == ISO_VD_PRIMARY) { 602 if (isonum_711(vdp->type) == ISO_VD_PRIMARY) {
601 if (pri == NULL) { 603 if (pri == NULL) {
602 pri = (struct iso_primary_descriptor *)vdp; 604 pri = (struct iso_primary_descriptor *)vdp;
603 /* Save the buffer in case we need it ... */ 605 /* Save the buffer in case we need it ... */
604 pri_bh = bh; 606 pri_bh = bh;
605 bh = NULL; 607 bh = NULL;
606 } 608 }
607 } 609 }
608#ifdef CONFIG_JOLIET 610#ifdef CONFIG_JOLIET
609 else if (isonum_711 (vdp->type) == ISO_VD_SUPPLEMENTARY) { 611 else if (isonum_711(vdp->type) == ISO_VD_SUPPLEMENTARY) {
610 sec = (struct iso_supplementary_descriptor *)vdp; 612 sec = (struct iso_supplementary_descriptor *)vdp;
611 if (sec->escape[0] == 0x25 && sec->escape[1] == 0x2f) { 613 if (sec->escape[0] == 0x25 && sec->escape[1] == 0x2f) {
612 if (opt.joliet == 'y') { 614 if (opt.joliet == 'y') {
613 if (sec->escape[2] == 0x40) { 615 if (sec->escape[2] == 0x40)
614 joliet_level = 1; 616 joliet_level = 1;
615 } else if (sec->escape[2] == 0x43) { 617 else if (sec->escape[2] == 0x43)
616 joliet_level = 2; 618 joliet_level = 2;
617 } else if (sec->escape[2] == 0x45) { 619 else if (sec->escape[2] == 0x45)
618 joliet_level = 3; 620 joliet_level = 3;
619 } 621
620 printk(KERN_DEBUG"ISO 9660 Extensions: Microsoft Joliet Level %d\n", 622 printk(KERN_DEBUG "ISO 9660 Extensions: "
621 joliet_level); 623 "Microsoft Joliet Level %d\n",
624 joliet_level);
625 }
626 goto root_found;
627 } else {
628 /* Unknown supplementary volume descriptor */
629 sec = NULL;
630 }
622 } 631 }
623 goto root_found;
624 } else {
625 /* Unknown supplementary volume descriptor */
626 sec = NULL;
627 }
628 }
629#endif 632#endif
630 } else { 633 } else {
631 if (strncmp (hdp->id, HS_STANDARD_ID, sizeof hdp->id) == 0) { 634 if (strncmp (hdp->id, HS_STANDARD_ID, sizeof hdp->id) == 0) {
632 if (isonum_711 (hdp->type) != ISO_VD_PRIMARY) 635 if (isonum_711(hdp->type) != ISO_VD_PRIMARY)
633 goto out_freebh; 636 goto out_freebh;
634 637
635 sbi->s_high_sierra = 1; 638 sbi->s_high_sierra = 1;
636 opt.rock = 'n'; 639 opt.rock = 'n';
637 h_pri = (struct hs_primary_descriptor *)vdp; 640 h_pri = (struct hs_primary_descriptor *)vdp;
638 goto root_found; 641 goto root_found;
642 }
639 } 643 }
640 }
641 644
642 /* Just skip any volume descriptors we don't recognize */ 645 /* Just skip any volume descriptors we don't recognize */
643 646
644 brelse(bh); 647 brelse(bh);
645 bh = NULL; 648 bh = NULL;
646 } 649 }
647 /* 650 /*
648 * If we fall through, either no volume descriptor was found, 651 * If we fall through, either no volume descriptor was found,
@@ -657,24 +660,24 @@ static int isofs_fill_super(struct super_block *s, void *data, int silent)
657root_found: 660root_found:
658 661
659 if (joliet_level && (pri == NULL || opt.rock == 'n')) { 662 if (joliet_level && (pri == NULL || opt.rock == 'n')) {
660 /* This is the case of Joliet with the norock mount flag. 663 /* This is the case of Joliet with the norock mount flag.
661 * A disc with both Joliet and Rock Ridge is handled later 664 * A disc with both Joliet and Rock Ridge is handled later
662 */ 665 */
663 pri = (struct iso_primary_descriptor *) sec; 666 pri = (struct iso_primary_descriptor *) sec;
664 } 667 }
665 668
666 if(sbi->s_high_sierra){ 669 if(sbi->s_high_sierra){
667 rootp = (struct iso_directory_record *) h_pri->root_directory_record; 670 rootp = (struct iso_directory_record *) h_pri->root_directory_record;
668 sbi->s_nzones = isonum_733 (h_pri->volume_space_size); 671 sbi->s_nzones = isonum_733(h_pri->volume_space_size);
669 sbi->s_log_zone_size = isonum_723 (h_pri->logical_block_size); 672 sbi->s_log_zone_size = isonum_723(h_pri->logical_block_size);
670 sbi->s_max_size = isonum_733(h_pri->volume_space_size); 673 sbi->s_max_size = isonum_733(h_pri->volume_space_size);
671 } else { 674 } else {
672 if (!pri) 675 if (!pri)
673 goto out_freebh; 676 goto out_freebh;
674 rootp = (struct iso_directory_record *) pri->root_directory_record; 677 rootp = (struct iso_directory_record *) pri->root_directory_record;
675 sbi->s_nzones = isonum_733 (pri->volume_space_size); 678 sbi->s_nzones = isonum_733(pri->volume_space_size);
676 sbi->s_log_zone_size = isonum_723 (pri->logical_block_size); 679 sbi->s_log_zone_size = isonum_723(pri->logical_block_size);
677 sbi->s_max_size = isonum_733(pri->volume_space_size); 680 sbi->s_max_size = isonum_733(pri->volume_space_size);
678 } 681 }
679 682
680 sbi->s_ninodes = 0; /* No way to figure this out easily */ 683 sbi->s_ninodes = 0; /* No way to figure this out easily */
@@ -687,42 +690,43 @@ root_found:
687 * blocks that were 512 bytes (which should only very rarely 690 * blocks that were 512 bytes (which should only very rarely
688 * happen.) 691 * happen.)
689 */ 692 */
690 if(orig_zonesize < opt.blocksize) 693 if (orig_zonesize < opt.blocksize)
691 goto out_bad_size; 694 goto out_bad_size;
692 695
693 /* RDE: convert log zone size to bit shift */ 696 /* RDE: convert log zone size to bit shift */
694 switch (sbi->s_log_zone_size) 697 switch (sbi->s_log_zone_size) {
695 { case 512: sbi->s_log_zone_size = 9; break; 698 case 512: sbi->s_log_zone_size = 9; break;
696 case 1024: sbi->s_log_zone_size = 10; break; 699 case 1024: sbi->s_log_zone_size = 10; break;
697 case 2048: sbi->s_log_zone_size = 11; break; 700 case 2048: sbi->s_log_zone_size = 11; break;
698 701
699 default: 702 default:
700 goto out_bad_zone_size; 703 goto out_bad_zone_size;
701 } 704 }
702 705
703 s->s_magic = ISOFS_SUPER_MAGIC; 706 s->s_magic = ISOFS_SUPER_MAGIC;
704 s->s_maxbytes = 0xffffffff; /* We can handle files up to 4 GB */ 707 s->s_maxbytes = 0xffffffff; /* We can handle files up to 4 GB */
705 708
706 /* The CDROM is read-only, has no nodes (devices) on it, and since 709 /*
707 all of the files appear to be owned by root, we really do not want 710 * The CDROM is read-only, has no nodes (devices) on it, and since
708 to allow suid. (suid or devices will not show up unless we have 711 * all of the files appear to be owned by root, we really do not want
709 Rock Ridge extensions) */ 712 * to allow suid. (suid or devices will not show up unless we have
713 * Rock Ridge extensions)
714 */
710 715
711 s->s_flags |= MS_RDONLY /* | MS_NODEV | MS_NOSUID */; 716 s->s_flags |= MS_RDONLY /* | MS_NODEV | MS_NOSUID */;
712 717
713 /* Set this for reference. Its not currently used except on write 718 /* Set this for reference. Its not currently used except on write
714 which we don't have .. */ 719 which we don't have .. */
715 720
716 first_data_zone = isonum_733 (rootp->extent) + 721 first_data_zone = isonum_733(rootp->extent) +
717 isonum_711 (rootp->ext_attr_length); 722 isonum_711(rootp->ext_attr_length);
718 sbi->s_firstdatazone = first_data_zone; 723 sbi->s_firstdatazone = first_data_zone;
719#ifndef BEQUIET 724#ifndef BEQUIET
720 printk(KERN_DEBUG "Max size:%ld Log zone size:%ld\n", 725 printk(KERN_DEBUG "ISOFS: Max size:%ld Log zone size:%ld\n",
721 sbi->s_max_size, 726 sbi->s_max_size, 1UL << sbi->s_log_zone_size);
722 1UL << sbi->s_log_zone_size); 727 printk(KERN_DEBUG "ISOFS: First datazone:%ld\n", sbi->s_firstdatazone);
723 printk(KERN_DEBUG "First datazone:%ld\n", sbi->s_firstdatazone);
724 if(sbi->s_high_sierra) 728 if(sbi->s_high_sierra)
725 printk(KERN_DEBUG "Disc in High Sierra format.\n"); 729 printk(KERN_DEBUG "ISOFS: Disc in High Sierra format.\n");
726#endif 730#endif
727 731
728 /* 732 /*
@@ -737,8 +741,8 @@ root_found:
737 pri = (struct iso_primary_descriptor *) sec; 741 pri = (struct iso_primary_descriptor *) sec;
738 rootp = (struct iso_directory_record *) 742 rootp = (struct iso_directory_record *)
739 pri->root_directory_record; 743 pri->root_directory_record;
740 first_data_zone = isonum_733 (rootp->extent) + 744 first_data_zone = isonum_733(rootp->extent) +
741 isonum_711 (rootp->ext_attr_length); 745 isonum_711(rootp->ext_attr_length);
742 } 746 }
743 747
744 /* 748 /*
@@ -771,7 +775,7 @@ root_found:
771 775
772#ifdef CONFIG_JOLIET 776#ifdef CONFIG_JOLIET
773 if (joliet_level && opt.utf8 == 0) { 777 if (joliet_level && opt.utf8 == 0) {
774 char * p = opt.iocharset ? opt.iocharset : CONFIG_NLS_DEFAULT; 778 char *p = opt.iocharset ? opt.iocharset : CONFIG_NLS_DEFAULT;
775 sbi->s_nls_iocharset = load_nls(p); 779 sbi->s_nls_iocharset = load_nls(p);
776 if (! sbi->s_nls_iocharset) { 780 if (! sbi->s_nls_iocharset) {
777 /* Fail only if explicit charset specified */ 781 /* Fail only if explicit charset specified */
@@ -821,7 +825,7 @@ root_found:
821 sbi->s_rock = 0; 825 sbi->s_rock = 0;
822 if (sbi->s_firstdatazone != first_data_zone) { 826 if (sbi->s_firstdatazone != first_data_zone) {
823 sbi->s_firstdatazone = first_data_zone; 827 sbi->s_firstdatazone = first_data_zone;
824 printk(KERN_DEBUG 828 printk(KERN_DEBUG
825 "ISOFS: changing to secondary root\n"); 829 "ISOFS: changing to secondary root\n");
826 iput(inode); 830 iput(inode);
827 inode = isofs_iget(s, sbi->s_firstdatazone, 0); 831 inode = isofs_iget(s, sbi->s_firstdatazone, 0);
@@ -830,8 +834,10 @@ root_found:
830 834
831 if (opt.check == 'u') { 835 if (opt.check == 'u') {
832 /* Only Joliet is case insensitive by default */ 836 /* Only Joliet is case insensitive by default */
833 if (joliet_level) opt.check = 'r'; 837 if (joliet_level)
834 else opt.check = 's'; 838 opt.check = 'r';
839 else
840 opt.check = 's';
835 } 841 }
836 sbi->s_joliet_level = joliet_level; 842 sbi->s_joliet_level = joliet_level;
837 843
@@ -846,8 +852,10 @@ root_found:
846 goto out_no_root; 852 goto out_no_root;
847 853
848 table = 0; 854 table = 0;
849 if (joliet_level) table += 2; 855 if (joliet_level)
850 if (opt.check == 'r') table++; 856 table += 2;
857 if (opt.check == 'r')
858 table++;
851 s->s_root->d_op = &isofs_dentry_ops[table]; 859 s->s_root->d_op = &isofs_dentry_ops[table];
852 860
853 kfree(opt.iocharset); 861 kfree(opt.iocharset);
@@ -858,10 +866,10 @@ root_found:
858 * Display error messages and free resources. 866 * Display error messages and free resources.
859 */ 867 */
860out_bad_root: 868out_bad_root:
861 printk(KERN_WARNING "isofs_fill_super: root inode not initialized\n"); 869 printk(KERN_WARNING "%s: root inode not initialized\n", __func__);
862 goto out_iput; 870 goto out_iput;
863out_no_root: 871out_no_root:
864 printk(KERN_WARNING "isofs_fill_super: get root inode failed\n"); 872 printk(KERN_WARNING "%s: get root inode failed\n", __func__);
865out_iput: 873out_iput:
866 iput(inode); 874 iput(inode);
867#ifdef CONFIG_JOLIET 875#ifdef CONFIG_JOLIET
@@ -870,21 +878,20 @@ out_iput:
870#endif 878#endif
871 goto out_freesbi; 879 goto out_freesbi;
872out_no_read: 880out_no_read:
873 printk(KERN_WARNING "isofs_fill_super: " 881 printk(KERN_WARNING "%s: bread failed, dev=%s, iso_blknum=%d, block=%d\n",
874 "bread failed, dev=%s, iso_blknum=%d, block=%d\n", 882 __func__, s->s_id, iso_blknum, block);
875 s->s_id, iso_blknum, block);
876 goto out_freesbi; 883 goto out_freesbi;
877out_bad_zone_size: 884out_bad_zone_size:
878 printk(KERN_WARNING "Bad logical zone size %ld\n", 885 printk(KERN_WARNING "ISOFS: Bad logical zone size %ld\n",
879 sbi->s_log_zone_size); 886 sbi->s_log_zone_size);
880 goto out_freebh; 887 goto out_freebh;
881out_bad_size: 888out_bad_size:
882 printk(KERN_WARNING "Logical zone size(%d) < hardware blocksize(%u)\n", 889 printk(KERN_WARNING "ISOFS: Logical zone size(%d) < hardware blocksize(%u)\n",
883 orig_zonesize, opt.blocksize); 890 orig_zonesize, opt.blocksize);
884 goto out_freebh; 891 goto out_freebh;
885out_unknown_format: 892out_unknown_format:
886 if (!silent) 893 if (!silent)
887 printk(KERN_WARNING "Unable to identify CD-ROM format.\n"); 894 printk(KERN_WARNING "ISOFS: Unable to identify CD-ROM format.\n");
888 895
889out_freebh: 896out_freebh:
890 brelse(bh); 897 brelse(bh);
@@ -902,7 +909,7 @@ static int isofs_statfs (struct dentry *dentry, struct kstatfs *buf)
902 buf->f_type = ISOFS_SUPER_MAGIC; 909 buf->f_type = ISOFS_SUPER_MAGIC;
903 buf->f_bsize = sb->s_blocksize; 910 buf->f_bsize = sb->s_blocksize;
904 buf->f_blocks = (ISOFS_SB(sb)->s_nzones 911 buf->f_blocks = (ISOFS_SB(sb)->s_nzones
905 << (ISOFS_SB(sb)->s_log_zone_size - sb->s_blocksize_bits)); 912 << (ISOFS_SB(sb)->s_log_zone_size - sb->s_blocksize_bits));
906 buf->f_bfree = 0; 913 buf->f_bfree = 0;
907 buf->f_bavail = 0; 914 buf->f_bavail = 0;
908 buf->f_files = ISOFS_SB(sb)->s_ninodes; 915 buf->f_files = ISOFS_SB(sb)->s_ninodes;
@@ -931,20 +938,20 @@ int isofs_get_blocks(struct inode *inode, sector_t iblock_s,
931 938
932 rv = 0; 939 rv = 0;
933 if (iblock < 0 || iblock != iblock_s) { 940 if (iblock < 0 || iblock != iblock_s) {
934 printk("isofs_get_blocks: block number too large\n"); 941 printk(KERN_DEBUG "%s: block number too large\n", __func__);
935 goto abort; 942 goto abort;
936 } 943 }
937 944
938 b_off = iblock; 945 b_off = iblock;
939 946
940 offset = 0; 947 offset = 0;
941 firstext = ei->i_first_extent; 948 firstext = ei->i_first_extent;
942 sect_size = ei->i_section_size >> ISOFS_BUFFER_BITS(inode); 949 sect_size = ei->i_section_size >> ISOFS_BUFFER_BITS(inode);
943 nextblk = ei->i_next_section_block; 950 nextblk = ei->i_next_section_block;
944 nextoff = ei->i_next_section_offset; 951 nextoff = ei->i_next_section_offset;
945 section = 0; 952 section = 0;
946 953
947 while ( nblocks ) { 954 while (nblocks) {
948 /* If we are *way* beyond the end of the file, print a message. 955 /* If we are *way* beyond the end of the file, print a message.
949 * Access beyond the end of the file up to the next page boundary 956 * Access beyond the end of the file up to the next page boundary
950 * is normal, however because of the way the page cache works. 957 * is normal, however because of the way the page cache works.
@@ -953,11 +960,11 @@ int isofs_get_blocks(struct inode *inode, sector_t iblock_s,
953 * I/O errors. 960 * I/O errors.
954 */ 961 */
955 if (b_off > ((inode->i_size + PAGE_CACHE_SIZE - 1) >> ISOFS_BUFFER_BITS(inode))) { 962 if (b_off > ((inode->i_size + PAGE_CACHE_SIZE - 1) >> ISOFS_BUFFER_BITS(inode))) {
956 printk("isofs_get_blocks: block >= EOF (%ld, %ld)\n", 963 printk(KERN_DEBUG "%s: block >= EOF (%ld, %ld)\n",
957 iblock, (unsigned long) inode->i_size); 964 __func__, iblock, (unsigned long) inode->i_size);
958 goto abort; 965 goto abort;
959 } 966 }
960 967
961 /* On the last section, nextblk == 0, section size is likely to 968 /* On the last section, nextblk == 0, section size is likely to
962 * exceed sect_size by a partial block, and access beyond the 969 * exceed sect_size by a partial block, and access beyond the
963 * end of the file will reach beyond the section size, too. 970 * end of the file will reach beyond the section size, too.
@@ -976,20 +983,21 @@ int isofs_get_blocks(struct inode *inode, sector_t iblock_s,
976 iput(ninode); 983 iput(ninode);
977 984
978 if (++section > 100) { 985 if (++section > 100) {
979 printk("isofs_get_blocks: More than 100 file sections ?!?, aborting...\n"); 986 printk(KERN_DEBUG "%s: More than 100 file sections ?!?"
980 printk("isofs_get_blocks: block=%ld firstext=%u sect_size=%u " 987 " aborting...\n", __func__);
981 "nextblk=%lu nextoff=%lu\n", 988 printk(KERN_DEBUG "%s: block=%ld firstext=%u sect_size=%u "
982 iblock, firstext, (unsigned) sect_size, 989 "nextblk=%lu nextoff=%lu\n", __func__,
983 nextblk, nextoff); 990 iblock, firstext, (unsigned) sect_size,
991 nextblk, nextoff);
984 goto abort; 992 goto abort;
985 } 993 }
986 } 994 }
987 995
988 if ( *bh ) { 996 if (*bh) {
989 map_bh(*bh, inode->i_sb, firstext + b_off - offset); 997 map_bh(*bh, inode->i_sb, firstext + b_off - offset);
990 } else { 998 } else {
991 *bh = sb_getblk(inode->i_sb, firstext+b_off-offset); 999 *bh = sb_getblk(inode->i_sb, firstext+b_off-offset);
992 if ( !*bh ) 1000 if (!*bh)
993 goto abort; 1001 goto abort;
994 } 1002 }
995 bh++; /* Next buffer head */ 1003 bh++; /* Next buffer head */
@@ -1010,7 +1018,7 @@ static int isofs_get_block(struct inode *inode, sector_t iblock,
1010 struct buffer_head *bh_result, int create) 1018 struct buffer_head *bh_result, int create)
1011{ 1019{
1012 if (create) { 1020 if (create) {
1013 printk("isofs_get_block: Kernel tries to allocate a block\n"); 1021 printk(KERN_DEBUG "%s: Kernel tries to allocate a block\n", __func__);
1014 return -EROFS; 1022 return -EROFS;
1015 } 1023 }
1016 1024
@@ -1070,11 +1078,11 @@ static int isofs_read_level3_size(struct inode *inode)
1070{ 1078{
1071 unsigned long bufsize = ISOFS_BUFFER_SIZE(inode); 1079 unsigned long bufsize = ISOFS_BUFFER_SIZE(inode);
1072 int high_sierra = ISOFS_SB(inode->i_sb)->s_high_sierra; 1080 int high_sierra = ISOFS_SB(inode->i_sb)->s_high_sierra;
1073 struct buffer_head * bh = NULL; 1081 struct buffer_head *bh = NULL;
1074 unsigned long block, offset, block_saved, offset_saved; 1082 unsigned long block, offset, block_saved, offset_saved;
1075 int i = 0; 1083 int i = 0;
1076 int more_entries = 0; 1084 int more_entries = 0;
1077 struct iso_directory_record * tmpde = NULL; 1085 struct iso_directory_record *tmpde = NULL;
1078 struct iso_inode_info *ei = ISOFS_I(inode); 1086 struct iso_inode_info *ei = ISOFS_I(inode);
1079 1087
1080 inode->i_size = 0; 1088 inode->i_size = 0;
@@ -1089,7 +1097,7 @@ static int isofs_read_level3_size(struct inode *inode)
1089 offset = ei->i_iget5_offset; 1097 offset = ei->i_iget5_offset;
1090 1098
1091 do { 1099 do {
1092 struct iso_directory_record * de; 1100 struct iso_directory_record *de;
1093 unsigned int de_len; 1101 unsigned int de_len;
1094 1102
1095 if (!bh) { 1103 if (!bh) {
@@ -1163,10 +1171,9 @@ out_noread:
1163 return -EIO; 1171 return -EIO;
1164 1172
1165out_toomany: 1173out_toomany:
1166 printk(KERN_INFO "isofs_read_level3_size: " 1174 printk(KERN_INFO "%s: More than 100 file sections ?!?, aborting...\n"
1167 "More than 100 file sections ?!?, aborting...\n" 1175 "isofs_read_level3_size: inode=%lu\n",
1168 "isofs_read_level3_size: inode=%lu\n", 1176 __func__, inode->i_ino);
1169 inode->i_ino);
1170 goto out; 1177 goto out;
1171} 1178}
1172 1179
@@ -1177,9 +1184,9 @@ static void isofs_read_inode(struct inode *inode)
1177 unsigned long bufsize = ISOFS_BUFFER_SIZE(inode); 1184 unsigned long bufsize = ISOFS_BUFFER_SIZE(inode);
1178 unsigned long block; 1185 unsigned long block;
1179 int high_sierra = sbi->s_high_sierra; 1186 int high_sierra = sbi->s_high_sierra;
1180 struct buffer_head * bh = NULL; 1187 struct buffer_head *bh = NULL;
1181 struct iso_directory_record * de; 1188 struct iso_directory_record *de;
1182 struct iso_directory_record * tmpde = NULL; 1189 struct iso_directory_record *tmpde = NULL;
1183 unsigned int de_len; 1190 unsigned int de_len;
1184 unsigned long offset; 1191 unsigned long offset;
1185 struct iso_inode_info *ei = ISOFS_I(inode); 1192 struct iso_inode_info *ei = ISOFS_I(inode);
@@ -1199,7 +1206,7 @@ static void isofs_read_inode(struct inode *inode)
1199 1206
1200 tmpde = kmalloc(de_len, GFP_KERNEL); 1207 tmpde = kmalloc(de_len, GFP_KERNEL);
1201 if (tmpde == NULL) { 1208 if (tmpde == NULL) {
1202 printk(KERN_INFO "isofs_read_inode: out of memory\n"); 1209 printk(KERN_INFO "%s: out of memory\n", __func__);
1203 goto fail; 1210 goto fail;
1204 } 1211 }
1205 memcpy(tmpde, bh->b_data + offset, frag1); 1212 memcpy(tmpde, bh->b_data + offset, frag1);
@@ -1212,24 +1219,26 @@ static void isofs_read_inode(struct inode *inode)
1212 } 1219 }
1213 1220
1214 inode->i_ino = isofs_get_ino(ei->i_iget5_block, 1221 inode->i_ino = isofs_get_ino(ei->i_iget5_block,
1215 ei->i_iget5_offset, 1222 ei->i_iget5_offset,
1216 ISOFS_BUFFER_BITS(inode)); 1223 ISOFS_BUFFER_BITS(inode));
1217 1224
1218 /* Assume it is a normal-format file unless told otherwise */ 1225 /* Assume it is a normal-format file unless told otherwise */
1219 ei->i_file_format = isofs_file_normal; 1226 ei->i_file_format = isofs_file_normal;
1220 1227
1221 if (de->flags[-high_sierra] & 2) { 1228 if (de->flags[-high_sierra] & 2) {
1222 inode->i_mode = S_IRUGO | S_IXUGO | S_IFDIR; 1229 inode->i_mode = S_IRUGO | S_IXUGO | S_IFDIR;
1223 inode->i_nlink = 1; /* Set to 1. We know there are 2, but 1230 inode->i_nlink = 1; /*
1224 the find utility tries to optimize 1231 * Set to 1. We know there are 2, but
1225 if it is 2, and it screws up. It is 1232 * the find utility tries to optimize
1226 easier to give 1 which tells find to 1233 * if it is 2, and it screws up. It is
1227 do it the hard way. */ 1234 * easier to give 1 which tells find to
1235 * do it the hard way.
1236 */
1228 } else { 1237 } else {
1229 /* Everybody gets to read the file. */ 1238 /* Everybody gets to read the file. */
1230 inode->i_mode = sbi->s_mode; 1239 inode->i_mode = sbi->s_mode;
1231 inode->i_nlink = 1; 1240 inode->i_nlink = 1;
1232 inode->i_mode |= S_IFREG; 1241 inode->i_mode |= S_IFREG;
1233 } 1242 }
1234 inode->i_uid = sbi->s_uid; 1243 inode->i_uid = sbi->s_uid;
1235 inode->i_gid = sbi->s_gid; 1244 inode->i_gid = sbi->s_gid;
@@ -1239,13 +1248,14 @@ static void isofs_read_inode(struct inode *inode)
1239 ei->i_format_parm[1] = 0; 1248 ei->i_format_parm[1] = 0;
1240 ei->i_format_parm[2] = 0; 1249 ei->i_format_parm[2] = 0;
1241 1250
1242 ei->i_section_size = isonum_733 (de->size); 1251 ei->i_section_size = isonum_733(de->size);
1243 if (de->flags[-high_sierra] & 0x80) { 1252 if (de->flags[-high_sierra] & 0x80) {
1244 if(isofs_read_level3_size(inode)) goto fail; 1253 if(isofs_read_level3_size(inode))
1254 goto fail;
1245 } else { 1255 } else {
1246 ei->i_next_section_block = 0; 1256 ei->i_next_section_block = 0;
1247 ei->i_next_section_offset = 0; 1257 ei->i_next_section_offset = 0;
1248 inode->i_size = isonum_733 (de->size); 1258 inode->i_size = isonum_733(de->size);
1249 } 1259 }
1250 1260
1251 /* 1261 /*
@@ -1258,23 +1268,24 @@ static void isofs_read_inode(struct inode *inode)
1258 inode->i_size &= 0x00ffffff; 1268 inode->i_size &= 0x00ffffff;
1259 1269
1260 if (de->interleave[0]) { 1270 if (de->interleave[0]) {
1261 printk("Interleaved files not (yet) supported.\n"); 1271 printk(KERN_DEBUG "ISOFS: Interleaved files not (yet) supported.\n");
1262 inode->i_size = 0; 1272 inode->i_size = 0;
1263 } 1273 }
1264 1274
1265 /* I have no idea what file_unit_size is used for, so 1275 /* I have no idea what file_unit_size is used for, so
1266 we will flag it for now */ 1276 we will flag it for now */
1267 if (de->file_unit_size[0] != 0) { 1277 if (de->file_unit_size[0] != 0) {
1268 printk("File unit size != 0 for ISO file (%ld).\n", 1278 printk(KERN_DEBUG "ISOFS: File unit size != 0 for ISO file (%ld).\n",
1269 inode->i_ino); 1279 inode->i_ino);
1270 } 1280 }
1271 1281
1272 /* I have no idea what other flag bits are used for, so 1282 /* I have no idea what other flag bits are used for, so
1273 we will flag it for now */ 1283 we will flag it for now */
1274#ifdef DEBUG 1284#ifdef DEBUG
1275 if((de->flags[-high_sierra] & ~2)!= 0){ 1285 if((de->flags[-high_sierra] & ~2)!= 0){
1276 printk("Unusual flag settings for ISO file (%ld %x).\n", 1286 printk(KERN_DEBUG "ISOFS: Unusual flag settings for ISO file "
1277 inode->i_ino, de->flags[-high_sierra]); 1287 "(%ld %x).\n",
1288 inode->i_ino, de->flags[-high_sierra]);
1278 } 1289 }
1279#endif 1290#endif
1280 1291
@@ -1285,11 +1296,11 @@ static void isofs_read_inode(struct inode *inode)
1285 inode->i_atime.tv_nsec = 1296 inode->i_atime.tv_nsec =
1286 inode->i_ctime.tv_nsec = 0; 1297 inode->i_ctime.tv_nsec = 0;
1287 1298
1288 ei->i_first_extent = (isonum_733 (de->extent) + 1299 ei->i_first_extent = (isonum_733(de->extent) +
1289 isonum_711 (de->ext_attr_length)); 1300 isonum_711(de->ext_attr_length));
1290 1301
1291 /* Set the number of blocks for stat() - should be done before RR */ 1302 /* Set the number of blocks for stat() - should be done before RR */
1292 inode->i_blocks = (inode->i_size + 511) >> 9; 1303 inode->i_blocks = (inode->i_size + 511) >> 9;
1293 1304
1294 /* 1305 /*
1295 * Now test for possible Rock Ridge extensions which will override 1306 * Now test for possible Rock Ridge extensions which will override
@@ -1306,7 +1317,7 @@ static void isofs_read_inode(struct inode *inode)
1306 /* Install the inode operations vector */ 1317 /* Install the inode operations vector */
1307 if (S_ISREG(inode->i_mode)) { 1318 if (S_ISREG(inode->i_mode)) {
1308 inode->i_fop = &generic_ro_fops; 1319 inode->i_fop = &generic_ro_fops;
1309 switch ( ei->i_file_format ) { 1320 switch (ei->i_file_format) {
1310#ifdef CONFIG_ZISOFS 1321#ifdef CONFIG_ZISOFS
1311 case isofs_file_compressed: 1322 case isofs_file_compressed:
1312 inode->i_data.a_ops = &zisofs_aops; 1323 inode->i_data.a_ops = &zisofs_aops;
@@ -1350,7 +1361,7 @@ static int isofs_iget5_test(struct inode *ino, void *data)
1350 struct isofs_iget5_callback_data *d = 1361 struct isofs_iget5_callback_data *d =
1351 (struct isofs_iget5_callback_data*)data; 1362 (struct isofs_iget5_callback_data*)data;
1352 return (i->i_iget5_block == d->block) 1363 return (i->i_iget5_block == d->block)
1353 && (i->i_iget5_offset == d->offset); 1364 && (i->i_iget5_offset == d->offset);
1354} 1365}
1355 1366
1356static int isofs_iget5_set(struct inode *ino, void *data) 1367static int isofs_iget5_set(struct inode *ino, void *data)
@@ -1384,7 +1395,7 @@ struct inode *isofs_iget(struct super_block *sb,
1384 hashval = (block << sb->s_blocksize_bits) | offset; 1395 hashval = (block << sb->s_blocksize_bits) | offset;
1385 1396
1386 inode = iget5_locked(sb, hashval, &isofs_iget5_test, 1397 inode = iget5_locked(sb, hashval, &isofs_iget5_test,
1387 &isofs_iget5_set, &data); 1398 &isofs_iget5_set, &data);
1388 1399
1389 if (inode && (inode->i_state & I_NEW)) { 1400 if (inode && (inode->i_state & I_NEW)) {
1390 sb->s_op->read_inode(inode); 1401 sb->s_op->read_inode(inode);
@@ -1398,7 +1409,7 @@ static int isofs_get_sb(struct file_system_type *fs_type,
1398 int flags, const char *dev_name, void *data, struct vfsmount *mnt) 1409 int flags, const char *dev_name, void *data, struct vfsmount *mnt)
1399{ 1410{
1400 return get_sb_bdev(fs_type, flags, dev_name, data, isofs_fill_super, 1411 return get_sb_bdev(fs_type, flags, dev_name, data, isofs_fill_super,
1401 mnt); 1412 mnt);
1402} 1413}
1403 1414
1404static struct file_system_type iso9660_fs_type = { 1415static struct file_system_type iso9660_fs_type = {