Commit 7fa393a1 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] rock: manual tidies

Fix stuff which Lindent got wrong, rework a few deeply-nested blocks.
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 1d372116
...@@ -90,17 +90,17 @@ int get_rock_ridge_filename(struct iso_directory_record *de, ...@@ -90,17 +90,17 @@ int get_rock_ridge_filename(struct iso_directory_record *de,
int len; int len;
unsigned char *chr; unsigned char *chr;
CONTINUE_DECLS; CONTINUE_DECLS;
int retnamlen = 0, truncate = 0; struct rock_ridge *rr;
int sig;
int retnamlen = 0;
int truncate = 0;
if (!ISOFS_SB(inode->i_sb)->s_rock) if (!ISOFS_SB(inode->i_sb)->s_rock)
return 0; return 0;
*retname = 0; *retname = 0;
SETUP_ROCK_RIDGE(de, chr, len); SETUP_ROCK_RIDGE(de, chr, len);
repeat: repeat:
{
struct rock_ridge *rr;
int sig;
while (len > 2) { /* There may be one byte for padding somewhere */ while (len > 2) { /* There may be one byte for padding somewhere */
rr = (struct rock_ridge *)chr; rr = (struct rock_ridge *)chr;
...@@ -135,13 +135,11 @@ int get_rock_ridge_filename(struct iso_directory_record *de, ...@@ -135,13 +135,11 @@ int get_rock_ridge_filename(struct iso_directory_record *de,
* care anyways, since we can just use the non-RR * care anyways, since we can just use the non-RR
* name. * name.
*/ */
if (rr->u.NM.flags & 6) { if (rr->u.NM.flags & 6)
break; break;
}
if (rr->u.NM.flags & ~1) { if (rr->u.NM.flags & ~1) {
printk printk("Unsupported NM flag settings (%d)\n",
("Unsupported NM flag settings (%d)\n",
rr->u.NM.flags); rr->u.NM.flags);
break; break;
} }
...@@ -160,12 +158,10 @@ int get_rock_ridge_filename(struct iso_directory_record *de, ...@@ -160,12 +158,10 @@ int get_rock_ridge_filename(struct iso_directory_record *de,
break; break;
} }
} }
}
MAYBE_CONTINUE(repeat, inode); MAYBE_CONTINUE(repeat, inode);
if (buffer)
kfree(buffer); kfree(buffer);
return retnamlen; /* If 0, this file did not have a NM field */ return retnamlen; /* If 0, this file did not have a NM field */
out: out:
if (buffer) if (buffer)
kfree(buffer); kfree(buffer);
return 0; return 0;
...@@ -178,6 +174,11 @@ parse_rock_ridge_inode_internal(struct iso_directory_record *de, ...@@ -178,6 +174,11 @@ parse_rock_ridge_inode_internal(struct iso_directory_record *de,
int len; int len;
unsigned char *chr; unsigned char *chr;
int symlink_len = 0; int symlink_len = 0;
int cnt, sig;
struct inode *reloc;
struct rock_ridge *rr;
int rootflag;
CONTINUE_DECLS; CONTINUE_DECLS;
if (!ISOFS_SB(inode->i_sb)->s_rock) if (!ISOFS_SB(inode->i_sb)->s_rock)
...@@ -191,13 +192,7 @@ parse_rock_ridge_inode_internal(struct iso_directory_record *de, ...@@ -191,13 +192,7 @@ parse_rock_ridge_inode_internal(struct iso_directory_record *de,
len = 0; len = 0;
} }
repeat: repeat:
{
int cnt, sig;
struct inode *reloc;
struct rock_ridge *rr;
int rootflag;
while (len > 2) { /* There may be one byte for padding somewhere */ while (len > 2) { /* There may be one byte for padding somewhere */
rr = (struct rock_ridge *)chr; rr = (struct rock_ridge *)chr;
if (rr->len < 3) if (rr->len < 3)
...@@ -244,10 +239,13 @@ parse_rock_ridge_inode_internal(struct iso_directory_record *de, ...@@ -244,10 +239,13 @@ parse_rock_ridge_inode_internal(struct iso_directory_record *de,
high = isonum_733(rr->u.PN.dev_high); high = isonum_733(rr->u.PN.dev_high);
low = isonum_733(rr->u.PN.dev_low); low = isonum_733(rr->u.PN.dev_low);
/* /*
* The Rock Ridge standard specifies that if sizeof(dev_t) <= 4, * The Rock Ridge standard specifies that if
* then the high field is unused, and the device number is completely * sizeof(dev_t) <= 4, then the high field is
* stored in the low field. Some writers may ignore this subtlety, * unused, and the device number is completely
* and as a result we test to see if the entire device number is * stored in the low field. Some writers may
* ignore this subtlety,
* and as a result we test to see if the entire
* device number is
* stored in the low field, and use that. * stored in the low field, and use that.
*/ */
if ((low & ~0xff) && high == 0) { if ((low & ~0xff) && high == 0) {
...@@ -260,9 +258,13 @@ parse_rock_ridge_inode_internal(struct iso_directory_record *de, ...@@ -260,9 +258,13 @@ parse_rock_ridge_inode_internal(struct iso_directory_record *de,
} }
break; break;
case SIG('T', 'F'): case SIG('T', 'F'):
/* Some RRIP writers incorrectly place ctime in the TF_CREATE field. /*
Try to handle this correctly for either case. */ * Some RRIP writers incorrectly place ctime in the
cnt = 0; /* Rock ridge never appears on a High Sierra disk */ * TF_CREATE field. Try to handle this correctly for
* either case.
*/
/* Rock ridge never appears on a High Sierra disk */
cnt = 0;
if (rr->u.TF.flags & TF_CREATE) { if (rr->u.TF.flags & TF_CREATE) {
inode->i_ctime.tv_sec = inode->i_ctime.tv_sec =
iso_date(rr->u.TF.times[cnt++].time, iso_date(rr->u.TF.times[cnt++].time,
...@@ -314,15 +316,13 @@ parse_rock_ridge_inode_internal(struct iso_directory_record *de, ...@@ -314,15 +316,13 @@ parse_rock_ridge_inode_internal(struct iso_directory_record *de,
inode->i_size += 1; inode->i_size += 1;
break; break;
default: default:
printk printk("Symlink component flag "
("Symlink component flag not implemented\n"); "not implemented\n");
} }
slen -= slp->len + 2; slen -= slp->len + 2;
oldslp = slp; oldslp = slp;
slp = slp = (struct SL_component *)
(struct SL_component (((char *)slp) + slp->len + 2);
*)(((char *)slp) +
slp->len + 2);
if (slen < 2) { if (slen < 2) {
if (((rr->u.SL. if (((rr->u.SL.
...@@ -336,7 +336,8 @@ parse_rock_ridge_inode_internal(struct iso_directory_record *de, ...@@ -336,7 +336,8 @@ parse_rock_ridge_inode_internal(struct iso_directory_record *de,
} }
/* /*
* If this component record isn't continued, then append a '/'. * If this component record isn't
* continued, then append a '/'.
*/ */
if (!rootflag if (!rootflag
&& (oldslp->flags & 1) == 0) && (oldslp->flags & 1) == 0)
...@@ -346,8 +347,8 @@ parse_rock_ridge_inode_internal(struct iso_directory_record *de, ...@@ -346,8 +347,8 @@ parse_rock_ridge_inode_internal(struct iso_directory_record *de,
symlink_len = inode->i_size; symlink_len = inode->i_size;
break; break;
case SIG('R', 'E'): case SIG('R', 'E'):
printk(KERN_WARNING printk(KERN_WARNING "Attempt to read inode for "
"Attempt to read inode for relocated directory\n"); "relocated directory\n");
goto out; goto out;
case SIG('C', 'L'): case SIG('C', 'L'):
ISOFS_I(inode)->i_first_extent = ISOFS_I(inode)->i_first_extent =
...@@ -371,58 +372,57 @@ parse_rock_ridge_inode_internal(struct iso_directory_record *de, ...@@ -371,58 +372,57 @@ parse_rock_ridge_inode_internal(struct iso_directory_record *de,
iput(reloc); iput(reloc);
break; break;
#ifdef CONFIG_ZISOFS #ifdef CONFIG_ZISOFS
case SIG('Z', 'F'): case SIG('Z', 'F'): {
if (!ISOFS_SB(inode->i_sb)->s_nocompress) {
int algo; int algo;
if (ISOFS_SB(inode->i_sb)->s_nocompress)
break;
algo = isonum_721(rr->u.ZF.algorithm); algo = isonum_721(rr->u.ZF.algorithm);
if (algo == SIG('p', 'z')) { if (algo == SIG('p', 'z')) {
int block_shift = int block_shift =
isonum_711(&rr->u.ZF. isonum_711(&rr->u.ZF.parms[1]);
parms[1]); if (block_shift < PAGE_CACHE_SHIFT
if (block_shift <
PAGE_CACHE_SHIFT
|| block_shift > 17) { || block_shift > 17) {
printk(KERN_WARNING printk(KERN_WARNING "isofs: "
"isofs: Can't handle ZF block size of 2^%d\n", "Can't handle ZF block "
"size of 2^%d\n",
block_shift); block_shift);
} else { } else {
/* Note: we don't change i_blocks here */ /*
ISOFS_I(inode)-> * Note: we don't change
i_file_format = * i_blocks here
*/
ISOFS_I(inode)->i_file_format =
isofs_file_compressed; isofs_file_compressed;
/* Parameters to compression algorithm (header size, block size) */ /*
ISOFS_I(inode)-> * Parameters to compression
i_format_parm[0] = * algorithm (header size,
isonum_711(&rr->u. * block size)
ZF. */
parms ISOFS_I(inode)->i_format_parm[0] =
[0]); isonum_711(&rr->u.ZF.parms[0]);
ISOFS_I(inode)-> ISOFS_I(inode)->i_format_parm[1] =
i_format_parm[1] = isonum_711(&rr->u.ZF.parms[1]);
isonum_711(&rr->u.
ZF.
parms
[1]);
inode->i_size = inode->i_size =
isonum_733(rr->u.ZF. isonum_733(rr->u.ZF.
real_size); real_size);
} }
} else { } else {
printk(KERN_WARNING printk(KERN_WARNING
"isofs: Unknown ZF compression algorithm: %c%c\n", "isofs: Unknown ZF compression "
"algorithm: %c%c\n",
rr->u.ZF.algorithm[0], rr->u.ZF.algorithm[0],
rr->u.ZF.algorithm[1]); rr->u.ZF.algorithm[1]);
} }
}
break; break;
}
#endif #endif
default: default:
break; break;
} }
} }
}
MAYBE_CONTINUE(repeat, inode); MAYBE_CONTINUE(repeat, inode);
out: out:
if (buffer) if (buffer)
kfree(buffer); kfree(buffer);
return 0; return 0;
...@@ -553,7 +553,7 @@ static int rock_ridge_symlink_readpage(struct file *file, struct page *page) ...@@ -553,7 +553,7 @@ static int rock_ridge_symlink_readpage(struct file *file, struct page *page)
SETUP_ROCK_RIDGE(raw_inode, chr, len); SETUP_ROCK_RIDGE(raw_inode, chr, len);
repeat: repeat:
while (len > 2) { /* There may be one byte for padding somewhere */ while (len > 2) { /* There may be one byte for padding somewhere */
rr = (struct rock_ridge *)chr; rr = (struct rock_ridge *)chr;
if (rr->len < 3) if (rr->len < 3)
...@@ -586,7 +586,6 @@ static int rock_ridge_symlink_readpage(struct file *file, struct page *page) ...@@ -586,7 +586,6 @@ static int rock_ridge_symlink_readpage(struct file *file, struct page *page)
} }
} }
MAYBE_CONTINUE(repeat, inode); MAYBE_CONTINUE(repeat, inode);
if (buffer)
kfree(buffer); kfree(buffer);
if (rpnt == link) if (rpnt == link)
...@@ -600,19 +599,19 @@ static int rock_ridge_symlink_readpage(struct file *file, struct page *page) ...@@ -600,19 +599,19 @@ static int rock_ridge_symlink_readpage(struct file *file, struct page *page)
return 0; return 0;
/* error exit from macro */ /* error exit from macro */
out: out:
if (buffer) if (buffer)
kfree(buffer); kfree(buffer);
goto fail; goto fail;
out_noread: out_noread:
printk("unable to read i-node block"); printk("unable to read i-node block");
goto fail; goto fail;
out_bad_span: out_bad_span:
printk("symlink spans iso9660 blocks\n"); printk("symlink spans iso9660 blocks\n");
fail: fail:
brelse(bh); brelse(bh);
unlock_kernel(); unlock_kernel();
error: error:
SetPageError(page); SetPageError(page);
kunmap(page); kunmap(page);
unlock_page(page); unlock_page(page);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment