diff options
author | Dave Jones <davej@redhat.com> | 2007-07-16 02:40:03 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-07-16 12:05:42 -0400 |
commit | c3ed85a36ff5b01f340db67ac5ae6e699d3b8a2b (patch) | |
tree | e033938ac13204719ada8e27a185eeb03af3dc8d /fs/isofs | |
parent | 1b28f22a87a5a2f0ab39f2549441bbe5eb2e369f (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')
-rw-r--r-- | fs/isofs/dir.c | 87 | ||||
-rw-r--r-- | fs/isofs/inode.c | 415 | ||||
-rw-r--r-- | fs/isofs/joliet.c | 10 | ||||
-rw-r--r-- | fs/isofs/namei.c | 26 |
4 files changed, 277 insertions, 261 deletions
diff --git a/fs/isofs/dir.c b/fs/isofs/dir.c index 0e94c31cad9b..1ba407c64df1 100644 --- a/fs/isofs/dir.c +++ b/fs/isofs/dir.c | |||
@@ -7,34 +7,18 @@ | |||
7 | * | 7 | * |
8 | * Steve Beynon : Missing last directory entries fixed | 8 | * Steve Beynon : Missing last directory entries fixed |
9 | * (stephen@askone.demon.co.uk) : 21st June 1996 | 9 | * (stephen@askone.demon.co.uk) : 21st June 1996 |
10 | * | 10 | * |
11 | * isofs directory handling functions | 11 | * isofs directory handling functions |
12 | */ | 12 | */ |
13 | #include <linux/smp_lock.h> | 13 | #include <linux/smp_lock.h> |
14 | #include "isofs.h" | 14 | #include "isofs.h" |
15 | 15 | ||
16 | static int isofs_readdir(struct file *, void *, filldir_t); | ||
17 | |||
18 | const struct file_operations isofs_dir_operations = | ||
19 | { | ||
20 | .read = generic_read_dir, | ||
21 | .readdir = isofs_readdir, | ||
22 | }; | ||
23 | |||
24 | /* | ||
25 | * directories can handle most operations... | ||
26 | */ | ||
27 | const struct inode_operations isofs_dir_inode_operations = | ||
28 | { | ||
29 | .lookup = isofs_lookup, | ||
30 | }; | ||
31 | |||
32 | int isofs_name_translate(struct iso_directory_record *de, char *new, struct inode *inode) | 16 | int isofs_name_translate(struct iso_directory_record *de, char *new, struct inode *inode) |
33 | { | 17 | { |
34 | char * old = de->name; | 18 | char * old = de->name; |
35 | int len = de->name_len[0]; | 19 | int len = de->name_len[0]; |
36 | int i; | 20 | int i; |
37 | 21 | ||
38 | for (i = 0; i < len; i++) { | 22 | for (i = 0; i < len; i++) { |
39 | unsigned char c = old[i]; | 23 | unsigned char c = old[i]; |
40 | if (!c) | 24 | if (!c) |
@@ -62,22 +46,27 @@ int isofs_name_translate(struct iso_directory_record *de, char *new, struct inod | |||
62 | } | 46 | } |
63 | 47 | ||
64 | /* Acorn extensions written by Matthew Wilcox <willy@bofh.ai> 1998 */ | 48 | /* Acorn extensions written by Matthew Wilcox <willy@bofh.ai> 1998 */ |
65 | int get_acorn_filename(struct iso_directory_record * de, | 49 | int get_acorn_filename(struct iso_directory_record *de, |
66 | char * retname, struct inode * inode) | 50 | char *retname, struct inode *inode) |
67 | { | 51 | { |
68 | int std; | 52 | int std; |
69 | unsigned char * chr; | 53 | unsigned char *chr; |
70 | int retnamlen = isofs_name_translate(de, retname, inode); | 54 | int retnamlen = isofs_name_translate(de, retname, inode); |
71 | if (retnamlen == 0) return 0; | 55 | |
56 | if (retnamlen == 0) | ||
57 | return 0; | ||
72 | std = sizeof(struct iso_directory_record) + de->name_len[0]; | 58 | std = sizeof(struct iso_directory_record) + de->name_len[0]; |
73 | if (std & 1) std++; | 59 | if (std & 1) |
74 | if ((*((unsigned char *) de) - std) != 32) return retnamlen; | 60 | std++; |
61 | if ((*((unsigned char *) de) - std) != 32) | ||
62 | return retnamlen; | ||
75 | chr = ((unsigned char *) de) + std; | 63 | chr = ((unsigned char *) de) + std; |
76 | if (strncmp(chr, "ARCHIMEDES", 10)) return retnamlen; | 64 | if (strncmp(chr, "ARCHIMEDES", 10)) |
77 | if ((*retname == '_') && ((chr[19] & 1) == 1)) *retname = '!'; | 65 | return retnamlen; |
66 | if ((*retname == '_') && ((chr[19] & 1) == 1)) | ||
67 | *retname = '!'; | ||
78 | if (((de->flags[0] & 2) == 0) && (chr[13] == 0xff) | 68 | if (((de->flags[0] & 2) == 0) && (chr[13] == 0xff) |
79 | && ((chr[12] & 0xf0) == 0xf0)) | 69 | && ((chr[12] & 0xf0) == 0xf0)) { |
80 | { | ||
81 | retname[retnamlen] = ','; | 70 | retname[retnamlen] = ','; |
82 | sprintf(retname+retnamlen+1, "%3.3x", | 71 | sprintf(retname+retnamlen+1, "%3.3x", |
83 | ((chr[12] & 0xf) << 8) | chr[11]); | 72 | ((chr[12] & 0xf) << 8) | chr[11]); |
@@ -91,7 +80,7 @@ int get_acorn_filename(struct iso_directory_record * de, | |||
91 | */ | 80 | */ |
92 | static int do_isofs_readdir(struct inode *inode, struct file *filp, | 81 | static int do_isofs_readdir(struct inode *inode, struct file *filp, |
93 | void *dirent, filldir_t filldir, | 82 | void *dirent, filldir_t filldir, |
94 | char * tmpname, struct iso_directory_record * tmpde) | 83 | char *tmpname, struct iso_directory_record *tmpde) |
95 | { | 84 | { |
96 | unsigned long bufsize = ISOFS_BUFFER_SIZE(inode); | 85 | unsigned long bufsize = ISOFS_BUFFER_SIZE(inode); |
97 | unsigned char bufbits = ISOFS_BUFFER_BITS(inode); | 86 | unsigned char bufbits = ISOFS_BUFFER_BITS(inode); |
@@ -121,9 +110,11 @@ static int do_isofs_readdir(struct inode *inode, struct file *filp, | |||
121 | 110 | ||
122 | de_len = *(unsigned char *) de; | 111 | de_len = *(unsigned char *) de; |
123 | 112 | ||
124 | /* If the length byte is zero, we should move on to the next | 113 | /* |
125 | CDROM sector. If we are at the end of the directory, we | 114 | * If the length byte is zero, we should move on to the next |
126 | kick out of the while loop. */ | 115 | * CDROM sector. If we are at the end of the directory, we |
116 | * kick out of the while loop. | ||
117 | */ | ||
127 | 118 | ||
128 | if (de_len == 0) { | 119 | if (de_len == 0) { |
129 | brelse(bh); | 120 | brelse(bh); |
@@ -157,11 +148,10 @@ static int do_isofs_readdir(struct inode *inode, struct file *filp, | |||
157 | 148 | ||
158 | if (first_de) { | 149 | if (first_de) { |
159 | isofs_normalize_block_and_offset(de, | 150 | isofs_normalize_block_and_offset(de, |
160 | &block_saved, | 151 | &block_saved, |
161 | &offset_saved); | 152 | &offset_saved); |
162 | inode_number = isofs_get_ino(block_saved, | 153 | inode_number = isofs_get_ino(block_saved, |
163 | offset_saved, | 154 | offset_saved, bufbits); |
164 | bufbits); | ||
165 | } | 155 | } |
166 | 156 | ||
167 | if (de->flags[-sbi->s_high_sierra] & 0x80) { | 157 | if (de->flags[-sbi->s_high_sierra] & 0x80) { |
@@ -199,7 +189,7 @@ static int do_isofs_readdir(struct inode *inode, struct file *filp, | |||
199 | */ | 189 | */ |
200 | if ((sbi->s_hide == 'y' && | 190 | if ((sbi->s_hide == 'y' && |
201 | (de->flags[-sbi->s_high_sierra] & 1)) || | 191 | (de->flags[-sbi->s_high_sierra] & 1)) || |
202 | (sbi->s_showassoc =='n' && | 192 | (sbi->s_showassoc =='n' && |
203 | (de->flags[-sbi->s_high_sierra] & 4))) { | 193 | (de->flags[-sbi->s_high_sierra] & 4))) { |
204 | filp->f_pos += de_len; | 194 | filp->f_pos += de_len; |
205 | continue; | 195 | continue; |
@@ -240,7 +230,8 @@ static int do_isofs_readdir(struct inode *inode, struct file *filp, | |||
240 | 230 | ||
241 | continue; | 231 | continue; |
242 | } | 232 | } |
243 | if (bh) brelse(bh); | 233 | if (bh) |
234 | brelse(bh); | ||
244 | return 0; | 235 | return 0; |
245 | } | 236 | } |
246 | 237 | ||
@@ -253,8 +244,8 @@ static int isofs_readdir(struct file *filp, | |||
253 | void *dirent, filldir_t filldir) | 244 | void *dirent, filldir_t filldir) |
254 | { | 245 | { |
255 | int result; | 246 | int result; |
256 | char * tmpname; | 247 | char *tmpname; |
257 | struct iso_directory_record * tmpde; | 248 | struct iso_directory_record *tmpde; |
258 | struct inode *inode = filp->f_path.dentry->d_inode; | 249 | struct inode *inode = filp->f_path.dentry->d_inode; |
259 | 250 | ||
260 | tmpname = (char *)__get_free_page(GFP_KERNEL); | 251 | tmpname = (char *)__get_free_page(GFP_KERNEL); |
@@ -270,3 +261,19 @@ static int isofs_readdir(struct file *filp, | |||
270 | unlock_kernel(); | 261 | unlock_kernel(); |
271 | return result; | 262 | return result; |
272 | } | 263 | } |
264 | |||
265 | const struct file_operations isofs_dir_operations = | ||
266 | { | ||
267 | .read = generic_read_dir, | ||
268 | .readdir = isofs_readdir, | ||
269 | }; | ||
270 | |||
271 | /* | ||
272 | * directories can handle most operations... | ||
273 | */ | ||
274 | const struct inode_operations isofs_dir_inode_operations = | ||
275 | { | ||
276 | .lookup = isofs_lookup, | ||
277 | }; | ||
278 | |||
279 | |||
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 | ||
76 | static void init_once(void *foo, struct kmem_cache * cachep, unsigned long flags) | 76 | static 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 | ||
83 | static int init_inodecache(void) | 83 | static 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 | */ |
539 | static int isofs_fill_super(struct super_block *s, void *data, int silent) | 541 | static 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) | |||
657 | root_found: | 660 | root_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 | */ |
860 | out_bad_root: | 868 | out_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; |
863 | out_no_root: | 871 | out_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__); |
865 | out_iput: | 873 | out_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; |
872 | out_no_read: | 880 | out_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; |
877 | out_bad_zone_size: | 884 | out_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; |
881 | out_bad_size: | 888 | out_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; |
885 | out_unknown_format: | 892 | out_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 | ||
889 | out_freebh: | 896 | out_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 | ||
1165 | out_toomany: | 1173 | out_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 | ||
1356 | static int isofs_iget5_set(struct inode *ino, void *data) | 1367 | static 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 | ||
1404 | static struct file_system_type iso9660_fs_type = { | 1415 | static struct file_system_type iso9660_fs_type = { |
diff --git a/fs/isofs/joliet.c b/fs/isofs/joliet.c index fb8fe7a9ddc6..92c14b850e9c 100644 --- a/fs/isofs/joliet.c +++ b/fs/isofs/joliet.c | |||
@@ -80,22 +80,20 @@ get_joliet_filename(struct iso_directory_record * de, unsigned char *outname, st | |||
80 | 80 | ||
81 | if (utf8) { | 81 | if (utf8) { |
82 | len = wcsntombs_be(outname, de->name, | 82 | len = wcsntombs_be(outname, de->name, |
83 | de->name_len[0] >> 1, PAGE_SIZE); | 83 | de->name_len[0] >> 1, PAGE_SIZE); |
84 | } else { | 84 | } else { |
85 | len = uni16_to_x8(outname, (__be16 *) de->name, | 85 | len = uni16_to_x8(outname, (__be16 *) de->name, |
86 | de->name_len[0] >> 1, nls); | 86 | de->name_len[0] >> 1, nls); |
87 | } | 87 | } |
88 | if ((len > 2) && (outname[len-2] == ';') && (outname[len-1] == '1')) { | 88 | if ((len > 2) && (outname[len-2] == ';') && (outname[len-1] == '1')) |
89 | len -= 2; | 89 | len -= 2; |
90 | } | ||
91 | 90 | ||
92 | /* | 91 | /* |
93 | * Windows doesn't like periods at the end of a name, | 92 | * Windows doesn't like periods at the end of a name, |
94 | * so neither do we | 93 | * so neither do we |
95 | */ | 94 | */ |
96 | while (len >= 2 && (outname[len-1] == '.')) { | 95 | while (len >= 2 && (outname[len-1] == '.')) |
97 | len--; | 96 | len--; |
98 | } | ||
99 | 97 | ||
100 | return len; | 98 | return len; |
101 | } | 99 | } |
diff --git a/fs/isofs/namei.c b/fs/isofs/namei.c index c04b3a14a3e9..c8c7e5138a01 100644 --- a/fs/isofs/namei.c +++ b/fs/isofs/namei.c | |||
@@ -15,7 +15,7 @@ | |||
15 | * some sanity tests. | 15 | * some sanity tests. |
16 | */ | 16 | */ |
17 | static int | 17 | static int |
18 | isofs_cmp(struct dentry * dentry, const char * compare, int dlen) | 18 | isofs_cmp(struct dentry *dentry, const char *compare, int dlen) |
19 | { | 19 | { |
20 | struct qstr qstr; | 20 | struct qstr qstr; |
21 | 21 | ||
@@ -48,24 +48,24 @@ isofs_cmp(struct dentry * dentry, const char * compare, int dlen) | |||
48 | */ | 48 | */ |
49 | static unsigned long | 49 | static unsigned long |
50 | isofs_find_entry(struct inode *dir, struct dentry *dentry, | 50 | isofs_find_entry(struct inode *dir, struct dentry *dentry, |
51 | unsigned long *block_rv, unsigned long* offset_rv, | 51 | unsigned long *block_rv, unsigned long *offset_rv, |
52 | char * tmpname, struct iso_directory_record * tmpde) | 52 | char *tmpname, struct iso_directory_record *tmpde) |
53 | { | 53 | { |
54 | unsigned long bufsize = ISOFS_BUFFER_SIZE(dir); | 54 | unsigned long bufsize = ISOFS_BUFFER_SIZE(dir); |
55 | unsigned char bufbits = ISOFS_BUFFER_BITS(dir); | 55 | unsigned char bufbits = ISOFS_BUFFER_BITS(dir); |
56 | unsigned long block, f_pos, offset, block_saved, offset_saved; | 56 | unsigned long block, f_pos, offset, block_saved, offset_saved; |
57 | struct buffer_head * bh = NULL; | 57 | struct buffer_head *bh = NULL; |
58 | struct isofs_sb_info *sbi = ISOFS_SB(dir->i_sb); | 58 | struct isofs_sb_info *sbi = ISOFS_SB(dir->i_sb); |
59 | 59 | ||
60 | if (!ISOFS_I(dir)->i_first_extent) | 60 | if (!ISOFS_I(dir)->i_first_extent) |
61 | return 0; | 61 | return 0; |
62 | 62 | ||
63 | f_pos = 0; | 63 | f_pos = 0; |
64 | offset = 0; | 64 | offset = 0; |
65 | block = 0; | 65 | block = 0; |
66 | 66 | ||
67 | while (f_pos < dir->i_size) { | 67 | while (f_pos < dir->i_size) { |
68 | struct iso_directory_record * de; | 68 | struct iso_directory_record *de; |
69 | int de_len, match, i, dlen; | 69 | int de_len, match, i, dlen; |
70 | char *dpnt; | 70 | char *dpnt; |
71 | 71 | ||
@@ -114,7 +114,7 @@ isofs_find_entry(struct inode *dir, struct dentry *dentry, | |||
114 | 114 | ||
115 | if (sbi->s_rock && | 115 | if (sbi->s_rock && |
116 | ((i = get_rock_ridge_filename(de, tmpname, dir)))) { | 116 | ((i = get_rock_ridge_filename(de, tmpname, dir)))) { |
117 | dlen = i; /* possibly -1 */ | 117 | dlen = i; /* possibly -1 */ |
118 | dpnt = tmpname; | 118 | dpnt = tmpname; |
119 | #ifdef CONFIG_JOLIET | 119 | #ifdef CONFIG_JOLIET |
120 | } else if (sbi->s_joliet_level) { | 120 | } else if (sbi->s_joliet_level) { |
@@ -145,8 +145,8 @@ isofs_find_entry(struct inode *dir, struct dentry *dentry, | |||
145 | isofs_normalize_block_and_offset(de, | 145 | isofs_normalize_block_and_offset(de, |
146 | &block_saved, | 146 | &block_saved, |
147 | &offset_saved); | 147 | &offset_saved); |
148 | *block_rv = block_saved; | 148 | *block_rv = block_saved; |
149 | *offset_rv = offset_saved; | 149 | *offset_rv = offset_saved; |
150 | brelse(bh); | 150 | brelse(bh); |
151 | return 1; | 151 | return 1; |
152 | } | 152 | } |
@@ -155,7 +155,7 @@ isofs_find_entry(struct inode *dir, struct dentry *dentry, | |||
155 | return 0; | 155 | return 0; |
156 | } | 156 | } |
157 | 157 | ||
158 | struct dentry *isofs_lookup(struct inode * dir, struct dentry * dentry, struct nameidata *nd) | 158 | struct dentry *isofs_lookup(struct inode *dir, struct dentry *dentry, struct nameidata *nd) |
159 | { | 159 | { |
160 | int found; | 160 | int found; |
161 | unsigned long block, offset; | 161 | unsigned long block, offset; |
@@ -170,9 +170,9 @@ struct dentry *isofs_lookup(struct inode * dir, struct dentry * dentry, struct n | |||
170 | 170 | ||
171 | lock_kernel(); | 171 | lock_kernel(); |
172 | found = isofs_find_entry(dir, dentry, | 172 | found = isofs_find_entry(dir, dentry, |
173 | &block, &offset, | 173 | &block, &offset, |
174 | page_address(page), | 174 | page_address(page), |
175 | 1024 + page_address(page)); | 175 | 1024 + page_address(page)); |
176 | __free_page(page); | 176 | __free_page(page); |
177 | 177 | ||
178 | inode = NULL; | 178 | inode = NULL; |