iso: Make little endian and 64bit safe
The iso partition table implementation has a few endian and 64bit problems. Clean it up a bit to become endian and bitness safe. Signed-off-by: Alexander Graf <agraf@suse.de>
This commit is contained in:
parent
c020d355c4
commit
ef9e6de540
|
@ -58,11 +58,9 @@ int part_get_info_iso_verb(struct blk_desc *dev_desc, int part_num,
|
||||||
ppr->stand_ident, dev_desc->devnum, part_num);
|
ppr->stand_ident, dev_desc->devnum, part_num);
|
||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
lastsect= ((ppr->firstsek_LEpathtab1_LE & 0x000000ff)<<24) +
|
lastsect = le32_to_cpu(ppr->firstsek_LEpathtab1_LE);
|
||||||
((ppr->firstsek_LEpathtab1_LE & 0x0000ff00)<< 8) +
|
/* assuming same block size for all entries */
|
||||||
((ppr->firstsek_LEpathtab1_LE & 0x00ff0000)>> 8) +
|
info->blksz = be16_to_cpu(ppr->secsize_BE);
|
||||||
((ppr->firstsek_LEpathtab1_LE & 0xff000000)>>24) ;
|
|
||||||
info->blksz=ppr->secsize_BE; /* assuming same block size for all entries */
|
|
||||||
PRINTF(" Lastsect:%08lx\n",lastsect);
|
PRINTF(" Lastsect:%08lx\n",lastsect);
|
||||||
for(i=blkaddr;i<lastsect;i++) {
|
for(i=blkaddr;i<lastsect;i++) {
|
||||||
PRINTF("Reading block %d\n", i);
|
PRINTF("Reading block %d\n", i);
|
||||||
|
@ -95,7 +93,7 @@ int part_get_info_iso_verb(struct blk_desc *dev_desc, int part_num,
|
||||||
chksum=0;
|
chksum=0;
|
||||||
chksumbuf = (unsigned short *)tmpbuf;
|
chksumbuf = (unsigned short *)tmpbuf;
|
||||||
for(i=0;i<0x10;i++)
|
for(i=0;i<0x10;i++)
|
||||||
chksum+=((chksumbuf[i] &0xff)<<8)+((chksumbuf[i] &0xff00)>>8);
|
chksum += le16_to_cpu(chksumbuf[i]);
|
||||||
if(chksum!=0) {
|
if(chksum!=0) {
|
||||||
if(verb)
|
if(verb)
|
||||||
printf("** Checksum Error in booting catalog validation entry on %d:%d **\n",
|
printf("** Checksum Error in booting catalog validation entry on %d:%d **\n",
|
||||||
|
|
|
@ -29,8 +29,8 @@ typedef struct iso_pri_rec {
|
||||||
char sysid[32]; /* system Identifier */
|
char sysid[32]; /* system Identifier */
|
||||||
char volid[32]; /* volume Identifier */
|
char volid[32]; /* volume Identifier */
|
||||||
unsigned char zeros1[8]; /* unused */
|
unsigned char zeros1[8]; /* unused */
|
||||||
unsigned long volsiz_LE; /* volume size Little Endian */
|
unsigned int volsiz_LE; /* volume size Little Endian */
|
||||||
unsigned long volsiz_BE; /* volume size Big Endian */
|
unsigned int volsiz_BE; /* volume size Big Endian */
|
||||||
unsigned char zeros2[32]; /* unused */
|
unsigned char zeros2[32]; /* unused */
|
||||||
unsigned short setsize_LE; /* volume set size LE */
|
unsigned short setsize_LE; /* volume set size LE */
|
||||||
unsigned short setsize_BE; /* volume set size BE */
|
unsigned short setsize_BE; /* volume set size BE */
|
||||||
|
@ -38,12 +38,12 @@ typedef struct iso_pri_rec {
|
||||||
unsigned short seqnum_BE; /* volume sequence number BE */
|
unsigned short seqnum_BE; /* volume sequence number BE */
|
||||||
unsigned short secsize_LE; /* sector size LE */
|
unsigned short secsize_LE; /* sector size LE */
|
||||||
unsigned short secsize_BE; /* sector size BE */
|
unsigned short secsize_BE; /* sector size BE */
|
||||||
unsigned long pathtablen_LE;/* Path Table size LE */
|
unsigned int pathtablen_LE;/* Path Table size LE */
|
||||||
unsigned long pathtablen_BE;/* Path Table size BE */
|
unsigned int pathtablen_BE;/* Path Table size BE */
|
||||||
unsigned long firstsek_LEpathtab1_LE; /* location of first occurrence of little endian type path table */
|
unsigned int firstsek_LEpathtab1_LE; /* location of first occurrence of little endian type path table */
|
||||||
unsigned long firstsek_LEpathtab2_LE; /* location of optional occurrence of little endian type path table */
|
unsigned int firstsek_LEpathtab2_LE; /* location of optional occurrence of little endian type path table */
|
||||||
unsigned long firstsek_BEpathtab1_BE; /* location of first occurrence of big endian type path table */
|
unsigned int firstsek_BEpathtab1_BE; /* location of first occurrence of big endian type path table */
|
||||||
unsigned long firstsek_BEpathtab2_BE; /* location of optional occurrence of big endian type path table */
|
unsigned int firstsek_BEpathtab2_BE; /* location of optional occurrence of big endian type path table */
|
||||||
unsigned char rootdir[34]; /* directory record for root dir */
|
unsigned char rootdir[34]; /* directory record for root dir */
|
||||||
char volsetid[128];/* Volume set identifier */
|
char volsetid[128];/* Volume set identifier */
|
||||||
char pubid[128]; /* Publisher identifier */
|
char pubid[128]; /* Publisher identifier */
|
||||||
|
@ -67,8 +67,8 @@ typedef struct iso_sup_rec {
|
||||||
char sysid[32]; /* system Identifier */
|
char sysid[32]; /* system Identifier */
|
||||||
char volid[32]; /* volume Identifier */
|
char volid[32]; /* volume Identifier */
|
||||||
unsigned char zeros1[8]; /* unused */
|
unsigned char zeros1[8]; /* unused */
|
||||||
unsigned long volsiz_LE; /* volume size Little Endian */
|
unsigned int volsiz_LE; /* volume size Little Endian */
|
||||||
unsigned long volsiz_BE; /* volume size Big Endian */
|
unsigned int volsiz_BE; /* volume size Big Endian */
|
||||||
unsigned char escapeseq[32];/* Escape sequences */
|
unsigned char escapeseq[32];/* Escape sequences */
|
||||||
unsigned short setsize_LE; /* volume set size LE */
|
unsigned short setsize_LE; /* volume set size LE */
|
||||||
unsigned short setsize_BE; /* volume set size BE */
|
unsigned short setsize_BE; /* volume set size BE */
|
||||||
|
@ -76,12 +76,12 @@ typedef struct iso_sup_rec {
|
||||||
unsigned short seqnum_BE; /* volume sequence number BE */
|
unsigned short seqnum_BE; /* volume sequence number BE */
|
||||||
unsigned short secsize_LE; /* sector size LE */
|
unsigned short secsize_LE; /* sector size LE */
|
||||||
unsigned short secsize_BE; /* sector size BE */
|
unsigned short secsize_BE; /* sector size BE */
|
||||||
unsigned long pathtablen_LE;/* Path Table size LE */
|
unsigned int pathtablen_LE;/* Path Table size LE */
|
||||||
unsigned long pathtablen_BE;/* Path Table size BE */
|
unsigned int pathtablen_BE;/* Path Table size BE */
|
||||||
unsigned long firstsek_LEpathtab1_LE; /* location of first occurrence of little endian type path table */
|
unsigned int firstsek_LEpathtab1_LE; /* location of first occurrence of little endian type path table */
|
||||||
unsigned long firstsek_LEpathtab2_LE; /* location of optional occurrence of little endian type path table */
|
unsigned int firstsek_LEpathtab2_LE; /* location of optional occurrence of little endian type path table */
|
||||||
unsigned long firstsek_BEpathtab1_BE; /* location of first occurrence of big endian type path table */
|
unsigned int firstsek_BEpathtab1_BE; /* location of first occurrence of big endian type path table */
|
||||||
unsigned long firstsek_BEpathtab2_BE; /* location of optional occurrence of big endian type path table */
|
unsigned int firstsek_BEpathtab2_BE; /* location of optional occurrence of big endian type path table */
|
||||||
unsigned char rootdir[34]; /* directory record for root dir */
|
unsigned char rootdir[34]; /* directory record for root dir */
|
||||||
char volsetid[128];/* Volume set identifier */
|
char volsetid[128];/* Volume set identifier */
|
||||||
char pubid[128]; /* Publisher identifier */
|
char pubid[128]; /* Publisher identifier */
|
||||||
|
@ -104,10 +104,10 @@ typedef struct iso_part_rec {
|
||||||
unsigned char unused;
|
unsigned char unused;
|
||||||
char sysid[32]; /* system Identifier */
|
char sysid[32]; /* system Identifier */
|
||||||
char volid[32]; /* volume partition Identifier */
|
char volid[32]; /* volume partition Identifier */
|
||||||
unsigned long partloc_LE; /* volume partition location LE */
|
unsigned int partloc_LE; /* volume partition location LE */
|
||||||
unsigned long partloc_BE; /* volume partition location BE */
|
unsigned int partloc_BE; /* volume partition location BE */
|
||||||
unsigned long partsiz_LE; /* volume partition size LE */
|
unsigned int partsiz_LE; /* volume partition size LE */
|
||||||
unsigned long partsiz_BE; /* volume partition size BE */
|
unsigned int partsiz_BE; /* volume partition size BE */
|
||||||
}iso_part_rec_t;
|
}iso_part_rec_t;
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue