mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
synced 2025-01-08 15:04:45 +00:00
[PATCH] rock: lindent it
Trying to turn rock.c into something which humans can read so we can fix some bugs. Start out by feeding it through scripts/Lindent. Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This commit is contained in:
parent
8a96619145
commit
1d37211638
635
fs/isofs/rock.c
635
fs/isofs/rock.c
@ -20,8 +20,7 @@
|
|||||||
* returns a symbolic link name, and a fourth one returns the extent number
|
* returns a symbolic link name, and a fourth one returns the extent number
|
||||||
* for the file. */
|
* for the file. */
|
||||||
|
|
||||||
#define SIG(A,B) ((A) | ((B) << 8)) /* isonum_721() */
|
#define SIG(A,B) ((A) | ((B) << 8)) /* isonum_721() */
|
||||||
|
|
||||||
|
|
||||||
/* This is a way of ensuring that we have something in the system
|
/* This is a way of ensuring that we have something in the system
|
||||||
use fields that is compatible with Rock Ridge */
|
use fields that is compatible with Rock Ridge */
|
||||||
@ -54,7 +53,7 @@
|
|||||||
CHR+=ISOFS_SB(inode->i_sb)->s_rock_offset; \
|
CHR+=ISOFS_SB(inode->i_sb)->s_rock_offset; \
|
||||||
if (LEN<0) LEN=0; \
|
if (LEN<0) LEN=0; \
|
||||||
} \
|
} \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define MAYBE_CONTINUE(LABEL,DEV) \
|
#define MAYBE_CONTINUE(LABEL,DEV) \
|
||||||
{if (buffer) { kfree(buffer); buffer = NULL; } \
|
{if (buffer) { kfree(buffer); buffer = NULL; } \
|
||||||
@ -85,280 +84,348 @@
|
|||||||
}}
|
}}
|
||||||
|
|
||||||
/* return length of name field; 0: not found, -1: to be ignored */
|
/* return length of name field; 0: not found, -1: to be ignored */
|
||||||
int get_rock_ridge_filename(struct iso_directory_record * de,
|
int get_rock_ridge_filename(struct iso_directory_record *de,
|
||||||
char * retname, struct inode * inode)
|
char *retname, struct inode *inode)
|
||||||
{
|
{
|
||||||
int len;
|
int len;
|
||||||
unsigned char * chr;
|
unsigned char *chr;
|
||||||
CONTINUE_DECLS;
|
CONTINUE_DECLS;
|
||||||
int retnamlen = 0, truncate=0;
|
int retnamlen = 0, truncate = 0;
|
||||||
|
|
||||||
if (!ISOFS_SB(inode->i_sb)->s_rock) return 0;
|
|
||||||
*retname = 0;
|
|
||||||
|
|
||||||
SETUP_ROCK_RIDGE(de, chr, len);
|
if (!ISOFS_SB(inode->i_sb)->s_rock)
|
||||||
repeat:
|
return 0;
|
||||||
{
|
*retname = 0;
|
||||||
struct rock_ridge * rr;
|
|
||||||
int sig;
|
|
||||||
|
|
||||||
while (len > 2){ /* There may be one byte for padding somewhere */
|
|
||||||
rr = (struct rock_ridge *) chr;
|
|
||||||
if (rr->len < 3) goto out; /* Something got screwed up here */
|
|
||||||
sig = isonum_721(chr);
|
|
||||||
chr += rr->len;
|
|
||||||
len -= rr->len;
|
|
||||||
if (len < 0) goto out; /* corrupted isofs */
|
|
||||||
|
|
||||||
switch(sig){
|
SETUP_ROCK_RIDGE(de, chr, len);
|
||||||
case SIG('R','R'):
|
repeat:
|
||||||
if((rr->u.RR.flags[0] & RR_NM) == 0) goto out;
|
{
|
||||||
break;
|
struct rock_ridge *rr;
|
||||||
case SIG('S','P'):
|
int sig;
|
||||||
CHECK_SP(goto out);
|
|
||||||
break;
|
|
||||||
case SIG('C','E'):
|
|
||||||
CHECK_CE;
|
|
||||||
break;
|
|
||||||
case SIG('N','M'):
|
|
||||||
if (truncate) break;
|
|
||||||
if (rr->len < 5) break;
|
|
||||||
/*
|
|
||||||
* If the flags are 2 or 4, this indicates '.' or '..'.
|
|
||||||
* We don't want to do anything with this, because it
|
|
||||||
* screws up the code that calls us. We don't really
|
|
||||||
* care anyways, since we can just use the non-RR
|
|
||||||
* name.
|
|
||||||
*/
|
|
||||||
if (rr->u.NM.flags & 6) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (rr->u.NM.flags & ~1) {
|
while (len > 2) { /* There may be one byte for padding somewhere */
|
||||||
printk("Unsupported NM flag settings (%d)\n",rr->u.NM.flags);
|
rr = (struct rock_ridge *)chr;
|
||||||
break;
|
if (rr->len < 3)
|
||||||
|
goto out; /* Something got screwed up here */
|
||||||
|
sig = isonum_721(chr);
|
||||||
|
chr += rr->len;
|
||||||
|
len -= rr->len;
|
||||||
|
if (len < 0)
|
||||||
|
goto out; /* corrupted isofs */
|
||||||
|
|
||||||
|
switch (sig) {
|
||||||
|
case SIG('R', 'R'):
|
||||||
|
if ((rr->u.RR.flags[0] & RR_NM) == 0)
|
||||||
|
goto out;
|
||||||
|
break;
|
||||||
|
case SIG('S', 'P'):
|
||||||
|
CHECK_SP(goto out);
|
||||||
|
break;
|
||||||
|
case SIG('C', 'E'):
|
||||||
|
CHECK_CE;
|
||||||
|
break;
|
||||||
|
case SIG('N', 'M'):
|
||||||
|
if (truncate)
|
||||||
|
break;
|
||||||
|
if (rr->len < 5)
|
||||||
|
break;
|
||||||
|
/*
|
||||||
|
* If the flags are 2 or 4, this indicates '.' or '..'.
|
||||||
|
* We don't want to do anything with this, because it
|
||||||
|
* screws up the code that calls us. We don't really
|
||||||
|
* care anyways, since we can just use the non-RR
|
||||||
|
* name.
|
||||||
|
*/
|
||||||
|
if (rr->u.NM.flags & 6) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (rr->u.NM.flags & ~1) {
|
||||||
|
printk
|
||||||
|
("Unsupported NM flag settings (%d)\n",
|
||||||
|
rr->u.NM.flags);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if ((strlen(retname) + rr->len - 5) >= 254) {
|
||||||
|
truncate = 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
strncat(retname, rr->u.NM.name, rr->len - 5);
|
||||||
|
retnamlen += rr->len - 5;
|
||||||
|
break;
|
||||||
|
case SIG('R', 'E'):
|
||||||
|
if (buffer)
|
||||||
|
kfree(buffer);
|
||||||
|
return -1;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if((strlen(retname) + rr->len - 5) >= 254) {
|
MAYBE_CONTINUE(repeat, inode);
|
||||||
truncate = 1;
|
if (buffer)
|
||||||
break;
|
kfree(buffer);
|
||||||
}
|
return retnamlen; /* If 0, this file did not have a NM field */
|
||||||
strncat(retname, rr->u.NM.name, rr->len - 5);
|
out:
|
||||||
retnamlen += rr->len - 5;
|
if (buffer)
|
||||||
break;
|
kfree(buffer);
|
||||||
case SIG('R','E'):
|
return 0;
|
||||||
if (buffer) kfree(buffer);
|
|
||||||
return -1;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
MAYBE_CONTINUE(repeat,inode);
|
|
||||||
if (buffer) kfree(buffer);
|
|
||||||
return retnamlen; /* If 0, this file did not have a NM field */
|
|
||||||
out:
|
|
||||||
if(buffer) kfree(buffer);
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
parse_rock_ridge_inode_internal(struct iso_directory_record *de,
|
parse_rock_ridge_inode_internal(struct iso_directory_record *de,
|
||||||
struct inode *inode, int regard_xa)
|
struct inode *inode, int regard_xa)
|
||||||
{
|
{
|
||||||
int len;
|
int len;
|
||||||
unsigned char * chr;
|
unsigned char *chr;
|
||||||
int symlink_len = 0;
|
int symlink_len = 0;
|
||||||
CONTINUE_DECLS;
|
CONTINUE_DECLS;
|
||||||
|
|
||||||
if (!ISOFS_SB(inode->i_sb)->s_rock) return 0;
|
if (!ISOFS_SB(inode->i_sb)->s_rock)
|
||||||
|
return 0;
|
||||||
|
|
||||||
SETUP_ROCK_RIDGE(de, chr, len);
|
SETUP_ROCK_RIDGE(de, chr, len);
|
||||||
if (regard_xa)
|
if (regard_xa) {
|
||||||
{
|
chr += 14;
|
||||||
chr+=14;
|
len -= 14;
|
||||||
len-=14;
|
if (len < 0)
|
||||||
if (len<0) len=0;
|
len = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
repeat:
|
repeat:
|
||||||
{
|
{
|
||||||
int cnt, sig;
|
int cnt, sig;
|
||||||
struct inode * reloc;
|
struct inode *reloc;
|
||||||
struct rock_ridge * rr;
|
struct rock_ridge *rr;
|
||||||
int rootflag;
|
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) goto out; /* Something got screwed up here */
|
if (rr->len < 3)
|
||||||
sig = isonum_721(chr);
|
goto out; /* Something got screwed up here */
|
||||||
chr += rr->len;
|
sig = isonum_721(chr);
|
||||||
len -= rr->len;
|
chr += rr->len;
|
||||||
if (len < 0) goto out; /* corrupted isofs */
|
len -= rr->len;
|
||||||
|
if (len < 0)
|
||||||
switch(sig){
|
goto out; /* corrupted isofs */
|
||||||
|
|
||||||
|
switch (sig) {
|
||||||
#ifndef CONFIG_ZISOFS /* No flag for SF or ZF */
|
#ifndef CONFIG_ZISOFS /* No flag for SF or ZF */
|
||||||
case SIG('R','R'):
|
case SIG('R', 'R'):
|
||||||
if((rr->u.RR.flags[0] &
|
if ((rr->u.RR.flags[0] &
|
||||||
(RR_PX | RR_TF | RR_SL | RR_CL)) == 0) goto out;
|
(RR_PX | RR_TF | RR_SL | RR_CL)) == 0)
|
||||||
break;
|
goto out;
|
||||||
|
break;
|
||||||
#endif
|
#endif
|
||||||
case SIG('S','P'):
|
case SIG('S', 'P'):
|
||||||
CHECK_SP(goto out);
|
CHECK_SP(goto out);
|
||||||
break;
|
break;
|
||||||
case SIG('C','E'):
|
case SIG('C', 'E'):
|
||||||
CHECK_CE;
|
CHECK_CE;
|
||||||
break;
|
break;
|
||||||
case SIG('E','R'):
|
case SIG('E', 'R'):
|
||||||
ISOFS_SB(inode->i_sb)->s_rock = 1;
|
ISOFS_SB(inode->i_sb)->s_rock = 1;
|
||||||
printk(KERN_DEBUG "ISO 9660 Extensions: ");
|
printk(KERN_DEBUG "ISO 9660 Extensions: ");
|
||||||
{ int p;
|
{
|
||||||
for(p=0;p<rr->u.ER.len_id;p++) printk("%c",rr->u.ER.data[p]);
|
int p;
|
||||||
}
|
for (p = 0; p < rr->u.ER.len_id; p++)
|
||||||
printk("\n");
|
printk("%c", rr->u.ER.data[p]);
|
||||||
break;
|
}
|
||||||
case SIG('P','X'):
|
printk("\n");
|
||||||
inode->i_mode = isonum_733(rr->u.PX.mode);
|
break;
|
||||||
inode->i_nlink = isonum_733(rr->u.PX.n_links);
|
case SIG('P', 'X'):
|
||||||
inode->i_uid = isonum_733(rr->u.PX.uid);
|
inode->i_mode = isonum_733(rr->u.PX.mode);
|
||||||
inode->i_gid = isonum_733(rr->u.PX.gid);
|
inode->i_nlink = isonum_733(rr->u.PX.n_links);
|
||||||
break;
|
inode->i_uid = isonum_733(rr->u.PX.uid);
|
||||||
case SIG('P','N'):
|
inode->i_gid = isonum_733(rr->u.PX.gid);
|
||||||
{ int high, low;
|
break;
|
||||||
high = isonum_733(rr->u.PN.dev_high);
|
case SIG('P', 'N'):
|
||||||
low = isonum_733(rr->u.PN.dev_low);
|
{
|
||||||
/*
|
int high, low;
|
||||||
* The Rock Ridge standard specifies that if sizeof(dev_t) <= 4,
|
high = isonum_733(rr->u.PN.dev_high);
|
||||||
* then the high field is unused, and the device number is completely
|
low = isonum_733(rr->u.PN.dev_low);
|
||||||
* 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
|
* The Rock Ridge standard specifies that if sizeof(dev_t) <= 4,
|
||||||
* stored in the low field, and use that.
|
* then the high field is unused, and the device number is completely
|
||||||
*/
|
* stored in the low field. Some writers may ignore this subtlety,
|
||||||
if((low & ~0xff) && high == 0) {
|
* and as a result we test to see if the entire device number is
|
||||||
inode->i_rdev = MKDEV(low >> 8, low & 0xff);
|
* stored in the low field, and use that.
|
||||||
} else {
|
*/
|
||||||
inode->i_rdev = MKDEV(high, low);
|
if ((low & ~0xff) && high == 0) {
|
||||||
}
|
inode->i_rdev =
|
||||||
}
|
MKDEV(low >> 8, low & 0xff);
|
||||||
break;
|
} else {
|
||||||
case SIG('T','F'):
|
inode->i_rdev =
|
||||||
/* Some RRIP writers incorrectly place ctime in the TF_CREATE field.
|
MKDEV(high, low);
|
||||||
Try to handle this correctly for either case. */
|
}
|
||||||
cnt = 0; /* Rock ridge never appears on a High Sierra disk */
|
}
|
||||||
if(rr->u.TF.flags & TF_CREATE) {
|
break;
|
||||||
inode->i_ctime.tv_sec = iso_date(rr->u.TF.times[cnt++].time, 0);
|
case SIG('T', 'F'):
|
||||||
inode->i_ctime.tv_nsec = 0;
|
/* Some RRIP writers incorrectly place ctime in the TF_CREATE field.
|
||||||
}
|
Try to handle this correctly for either case. */
|
||||||
if(rr->u.TF.flags & TF_MODIFY) {
|
cnt = 0; /* Rock ridge never appears on a High Sierra disk */
|
||||||
inode->i_mtime.tv_sec = iso_date(rr->u.TF.times[cnt++].time, 0);
|
if (rr->u.TF.flags & TF_CREATE) {
|
||||||
inode->i_mtime.tv_nsec = 0;
|
inode->i_ctime.tv_sec =
|
||||||
}
|
iso_date(rr->u.TF.times[cnt++].time,
|
||||||
if(rr->u.TF.flags & TF_ACCESS) {
|
0);
|
||||||
inode->i_atime.tv_sec = iso_date(rr->u.TF.times[cnt++].time, 0);
|
inode->i_ctime.tv_nsec = 0;
|
||||||
inode->i_atime.tv_nsec = 0;
|
}
|
||||||
}
|
if (rr->u.TF.flags & TF_MODIFY) {
|
||||||
if(rr->u.TF.flags & TF_ATTRIBUTES) {
|
inode->i_mtime.tv_sec =
|
||||||
inode->i_ctime.tv_sec = iso_date(rr->u.TF.times[cnt++].time, 0);
|
iso_date(rr->u.TF.times[cnt++].time,
|
||||||
inode->i_ctime.tv_nsec = 0;
|
0);
|
||||||
}
|
inode->i_mtime.tv_nsec = 0;
|
||||||
break;
|
}
|
||||||
case SIG('S','L'):
|
if (rr->u.TF.flags & TF_ACCESS) {
|
||||||
{int slen;
|
inode->i_atime.tv_sec =
|
||||||
struct SL_component * slp;
|
iso_date(rr->u.TF.times[cnt++].time,
|
||||||
struct SL_component * oldslp;
|
0);
|
||||||
slen = rr->len - 5;
|
inode->i_atime.tv_nsec = 0;
|
||||||
slp = &rr->u.SL.link;
|
}
|
||||||
inode->i_size = symlink_len;
|
if (rr->u.TF.flags & TF_ATTRIBUTES) {
|
||||||
while (slen > 1){
|
inode->i_ctime.tv_sec =
|
||||||
rootflag = 0;
|
iso_date(rr->u.TF.times[cnt++].time,
|
||||||
switch(slp->flags &~1){
|
0);
|
||||||
case 0:
|
inode->i_ctime.tv_nsec = 0;
|
||||||
inode->i_size += slp->len;
|
}
|
||||||
break;
|
break;
|
||||||
case 2:
|
case SIG('S', 'L'):
|
||||||
inode->i_size += 1;
|
{
|
||||||
break;
|
int slen;
|
||||||
case 4:
|
struct SL_component *slp;
|
||||||
inode->i_size += 2;
|
struct SL_component *oldslp;
|
||||||
break;
|
slen = rr->len - 5;
|
||||||
case 8:
|
slp = &rr->u.SL.link;
|
||||||
rootflag = 1;
|
inode->i_size = symlink_len;
|
||||||
inode->i_size += 1;
|
while (slen > 1) {
|
||||||
break;
|
rootflag = 0;
|
||||||
default:
|
switch (slp->flags & ~1) {
|
||||||
printk("Symlink component flag not implemented\n");
|
case 0:
|
||||||
}
|
inode->i_size +=
|
||||||
slen -= slp->len + 2;
|
slp->len;
|
||||||
oldslp = slp;
|
break;
|
||||||
slp = (struct SL_component *) (((char *) slp) + slp->len + 2);
|
case 2:
|
||||||
|
inode->i_size += 1;
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
inode->i_size += 2;
|
||||||
|
break;
|
||||||
|
case 8:
|
||||||
|
rootflag = 1;
|
||||||
|
inode->i_size += 1;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
printk
|
||||||
|
("Symlink component flag not implemented\n");
|
||||||
|
}
|
||||||
|
slen -= slp->len + 2;
|
||||||
|
oldslp = slp;
|
||||||
|
slp =
|
||||||
|
(struct SL_component
|
||||||
|
*)(((char *)slp) +
|
||||||
|
slp->len + 2);
|
||||||
|
|
||||||
if(slen < 2) {
|
if (slen < 2) {
|
||||||
if( ((rr->u.SL.flags & 1) != 0)
|
if (((rr->u.SL.
|
||||||
&& ((oldslp->flags & 1) == 0) ) inode->i_size += 1;
|
flags & 1) != 0)
|
||||||
break;
|
&&
|
||||||
}
|
((oldslp->
|
||||||
|
flags & 1) == 0))
|
||||||
|
inode->i_size +=
|
||||||
|
1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If this component record isn't continued, then append a '/'.
|
* If this component record isn't continued, then append a '/'.
|
||||||
*/
|
*/
|
||||||
if (!rootflag && (oldslp->flags & 1) == 0)
|
if (!rootflag
|
||||||
inode->i_size += 1;
|
&& (oldslp->flags & 1) == 0)
|
||||||
}
|
inode->i_size += 1;
|
||||||
}
|
}
|
||||||
symlink_len = inode->i_size;
|
}
|
||||||
break;
|
symlink_len = inode->i_size;
|
||||||
case SIG('R','E'):
|
break;
|
||||||
printk(KERN_WARNING "Attempt to read inode for relocated directory\n");
|
case SIG('R', 'E'):
|
||||||
goto out;
|
printk(KERN_WARNING
|
||||||
case SIG('C','L'):
|
"Attempt to read inode for relocated directory\n");
|
||||||
ISOFS_I(inode)->i_first_extent = isonum_733(rr->u.CL.location);
|
goto out;
|
||||||
reloc = isofs_iget(inode->i_sb, ISOFS_I(inode)->i_first_extent, 0);
|
case SIG('C', 'L'):
|
||||||
if (!reloc)
|
ISOFS_I(inode)->i_first_extent =
|
||||||
goto out;
|
isonum_733(rr->u.CL.location);
|
||||||
inode->i_mode = reloc->i_mode;
|
reloc =
|
||||||
inode->i_nlink = reloc->i_nlink;
|
isofs_iget(inode->i_sb,
|
||||||
inode->i_uid = reloc->i_uid;
|
ISOFS_I(inode)->i_first_extent,
|
||||||
inode->i_gid = reloc->i_gid;
|
0);
|
||||||
inode->i_rdev = reloc->i_rdev;
|
if (!reloc)
|
||||||
inode->i_size = reloc->i_size;
|
goto out;
|
||||||
inode->i_blocks = reloc->i_blocks;
|
inode->i_mode = reloc->i_mode;
|
||||||
inode->i_atime = reloc->i_atime;
|
inode->i_nlink = reloc->i_nlink;
|
||||||
inode->i_ctime = reloc->i_ctime;
|
inode->i_uid = reloc->i_uid;
|
||||||
inode->i_mtime = reloc->i_mtime;
|
inode->i_gid = reloc->i_gid;
|
||||||
iput(reloc);
|
inode->i_rdev = reloc->i_rdev;
|
||||||
break;
|
inode->i_size = reloc->i_size;
|
||||||
|
inode->i_blocks = reloc->i_blocks;
|
||||||
|
inode->i_atime = reloc->i_atime;
|
||||||
|
inode->i_ctime = reloc->i_ctime;
|
||||||
|
inode->i_mtime = reloc->i_mtime;
|
||||||
|
iput(reloc);
|
||||||
|
break;
|
||||||
#ifdef CONFIG_ZISOFS
|
#ifdef CONFIG_ZISOFS
|
||||||
case SIG('Z','F'):
|
case SIG('Z', 'F'):
|
||||||
if ( !ISOFS_SB(inode->i_sb)->s_nocompress ) {
|
if (!ISOFS_SB(inode->i_sb)->s_nocompress) {
|
||||||
int algo;
|
int algo;
|
||||||
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 = isonum_711(&rr->u.ZF.parms[1]);
|
int block_shift =
|
||||||
if ( block_shift < PAGE_CACHE_SHIFT || block_shift > 17 ) {
|
isonum_711(&rr->u.ZF.
|
||||||
printk(KERN_WARNING "isofs: Can't handle ZF block size of 2^%d\n", block_shift);
|
parms[1]);
|
||||||
} else {
|
if (block_shift <
|
||||||
/* Note: we don't change i_blocks here */
|
PAGE_CACHE_SHIFT
|
||||||
ISOFS_I(inode)->i_file_format = isofs_file_compressed;
|
|| block_shift > 17) {
|
||||||
/* Parameters to compression algorithm (header size, block size) */
|
printk(KERN_WARNING
|
||||||
ISOFS_I(inode)->i_format_parm[0] = isonum_711(&rr->u.ZF.parms[0]);
|
"isofs: Can't handle ZF block size of 2^%d\n",
|
||||||
ISOFS_I(inode)->i_format_parm[1] = isonum_711(&rr->u.ZF.parms[1]);
|
block_shift);
|
||||||
inode->i_size = isonum_733(rr->u.ZF.real_size);
|
} else {
|
||||||
}
|
/* Note: we don't change i_blocks here */
|
||||||
} else {
|
ISOFS_I(inode)->
|
||||||
printk(KERN_WARNING "isofs: Unknown ZF compression algorithm: %c%c\n",
|
i_file_format =
|
||||||
rr->u.ZF.algorithm[0], rr->u.ZF.algorithm[1]);
|
isofs_file_compressed;
|
||||||
}
|
/* Parameters to compression algorithm (header size, block size) */
|
||||||
}
|
ISOFS_I(inode)->
|
||||||
break;
|
i_format_parm[0] =
|
||||||
|
isonum_711(&rr->u.
|
||||||
|
ZF.
|
||||||
|
parms
|
||||||
|
[0]);
|
||||||
|
ISOFS_I(inode)->
|
||||||
|
i_format_parm[1] =
|
||||||
|
isonum_711(&rr->u.
|
||||||
|
ZF.
|
||||||
|
parms
|
||||||
|
[1]);
|
||||||
|
inode->i_size =
|
||||||
|
isonum_733(rr->u.ZF.
|
||||||
|
real_size);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
printk(KERN_WARNING
|
||||||
|
"isofs: Unknown ZF compression algorithm: %c%c\n",
|
||||||
|
rr->u.ZF.algorithm[0],
|
||||||
|
rr->u.ZF.algorithm[1]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
#endif
|
#endif
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
MAYBE_CONTINUE(repeat,inode);
|
MAYBE_CONTINUE(repeat, inode);
|
||||||
out:
|
out:
|
||||||
if(buffer) kfree(buffer);
|
if (buffer)
|
||||||
return 0;
|
kfree(buffer);
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *get_symlink_chunk(char *rpnt, struct rock_ridge *rr, char *plimit)
|
static char *get_symlink_chunk(char *rpnt, struct rock_ridge *rr, char *plimit)
|
||||||
@ -376,32 +443,32 @@ static char *get_symlink_chunk(char *rpnt, struct rock_ridge *rr, char *plimit)
|
|||||||
if (slp->len > plimit - rpnt)
|
if (slp->len > plimit - rpnt)
|
||||||
return NULL;
|
return NULL;
|
||||||
memcpy(rpnt, slp->text, slp->len);
|
memcpy(rpnt, slp->text, slp->len);
|
||||||
rpnt+=slp->len;
|
rpnt += slp->len;
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
if (rpnt >= plimit)
|
if (rpnt >= plimit)
|
||||||
return NULL;
|
return NULL;
|
||||||
*rpnt++='.';
|
*rpnt++ = '.';
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
if (2 > plimit - rpnt)
|
if (2 > plimit - rpnt)
|
||||||
return NULL;
|
return NULL;
|
||||||
*rpnt++='.';
|
*rpnt++ = '.';
|
||||||
*rpnt++='.';
|
*rpnt++ = '.';
|
||||||
break;
|
break;
|
||||||
case 8:
|
case 8:
|
||||||
if (rpnt >= plimit)
|
if (rpnt >= plimit)
|
||||||
return NULL;
|
return NULL;
|
||||||
rootflag = 1;
|
rootflag = 1;
|
||||||
*rpnt++='/';
|
*rpnt++ = '/';
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
printk("Symlink component flag not implemented (%d)\n",
|
printk("Symlink component flag not implemented (%d)\n",
|
||||||
slp->flags);
|
slp->flags);
|
||||||
}
|
}
|
||||||
slen -= slp->len + 2;
|
slen -= slp->len + 2;
|
||||||
oldslp = slp;
|
oldslp = slp;
|
||||||
slp = (struct SL_component *) ((char *) slp + slp->len + 2);
|
slp = (struct SL_component *)((char *)slp + slp->len + 2);
|
||||||
|
|
||||||
if (slen < 2) {
|
if (slen < 2) {
|
||||||
/*
|
/*
|
||||||
@ -412,7 +479,7 @@ static char *get_symlink_chunk(char *rpnt, struct rock_ridge *rr, char *plimit)
|
|||||||
!(oldslp->flags & 1)) {
|
!(oldslp->flags & 1)) {
|
||||||
if (rpnt >= plimit)
|
if (rpnt >= plimit)
|
||||||
return NULL;
|
return NULL;
|
||||||
*rpnt++='/';
|
*rpnt++ = '/';
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -423,24 +490,22 @@ static char *get_symlink_chunk(char *rpnt, struct rock_ridge *rr, char *plimit)
|
|||||||
if (!rootflag && !(oldslp->flags & 1)) {
|
if (!rootflag && !(oldslp->flags & 1)) {
|
||||||
if (rpnt >= plimit)
|
if (rpnt >= plimit)
|
||||||
return NULL;
|
return NULL;
|
||||||
*rpnt++='/';
|
*rpnt++ = '/';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return rpnt;
|
return rpnt;
|
||||||
}
|
}
|
||||||
|
|
||||||
int parse_rock_ridge_inode(struct iso_directory_record * de,
|
int parse_rock_ridge_inode(struct iso_directory_record *de, struct inode *inode)
|
||||||
struct inode * inode)
|
|
||||||
{
|
{
|
||||||
int result=parse_rock_ridge_inode_internal(de,inode,0);
|
int result = parse_rock_ridge_inode_internal(de, inode, 0);
|
||||||
/* if rockridge flag was reset and we didn't look for attributes
|
/* if rockridge flag was reset and we didn't look for attributes
|
||||||
* behind eventual XA attributes, have a look there */
|
* behind eventual XA attributes, have a look there */
|
||||||
if ((ISOFS_SB(inode->i_sb)->s_rock_offset==-1)
|
if ((ISOFS_SB(inode->i_sb)->s_rock_offset == -1)
|
||||||
&&(ISOFS_SB(inode->i_sb)->s_rock==2))
|
&& (ISOFS_SB(inode->i_sb)->s_rock == 2)) {
|
||||||
{
|
result = parse_rock_ridge_inode_internal(de, inode, 14);
|
||||||
result=parse_rock_ridge_inode_internal(de,inode,14);
|
}
|
||||||
}
|
return result;
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* readpage() for symlinks: reads symlink contents into the page and either
|
/* readpage() for symlinks: reads symlink contents into the page and either
|
||||||
@ -449,7 +514,7 @@ int parse_rock_ridge_inode(struct iso_directory_record * de,
|
|||||||
static int rock_ridge_symlink_readpage(struct file *file, struct page *page)
|
static int rock_ridge_symlink_readpage(struct file *file, struct page *page)
|
||||||
{
|
{
|
||||||
struct inode *inode = page->mapping->host;
|
struct inode *inode = page->mapping->host;
|
||||||
struct iso_inode_info *ei = ISOFS_I(inode);
|
struct iso_inode_info *ei = ISOFS_I(inode);
|
||||||
char *link = kmap(page);
|
char *link = kmap(page);
|
||||||
unsigned long bufsize = ISOFS_BUFFER_SIZE(inode);
|
unsigned long bufsize = ISOFS_BUFFER_SIZE(inode);
|
||||||
struct buffer_head *bh;
|
struct buffer_head *bh;
|
||||||
@ -472,10 +537,10 @@ static int rock_ridge_symlink_readpage(struct file *file, struct page *page)
|
|||||||
if (!bh)
|
if (!bh)
|
||||||
goto out_noread;
|
goto out_noread;
|
||||||
|
|
||||||
offset = ei->i_iget5_offset;
|
offset = ei->i_iget5_offset;
|
||||||
pnt = (unsigned char *) bh->b_data + offset;
|
pnt = (unsigned char *)bh->b_data + offset;
|
||||||
|
|
||||||
raw_inode = (struct iso_directory_record *) pnt;
|
raw_inode = (struct iso_directory_record *)pnt;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If we go past the end of the buffer, there is some sort of error.
|
* If we go past the end of the buffer, there is some sort of error.
|
||||||
@ -489,8 +554,8 @@ 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)
|
||||||
goto out; /* Something got screwed up here */
|
goto out; /* Something got screwed up here */
|
||||||
sig = isonum_721(chr);
|
sig = isonum_721(chr);
|
||||||
@ -555,5 +620,5 @@ static int rock_ridge_symlink_readpage(struct file *file, struct page *page)
|
|||||||
}
|
}
|
||||||
|
|
||||||
struct address_space_operations isofs_symlink_aops = {
|
struct address_space_operations isofs_symlink_aops = {
|
||||||
.readpage = rock_ridge_symlink_readpage
|
.readpage = rock_ridge_symlink_readpage
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user