summaryrefslogtreecommitdiff
path: root/disk
diff options
context:
space:
mode:
Diffstat (limited to 'disk')
-rw-r--r--disk/part.c92
-rw-r--r--disk/part_iso.c6
-rw-r--r--disk/part_iso.h102
3 files changed, 104 insertions, 96 deletions
diff --git a/disk/part.c b/disk/part.c
index 3c71208a1..316e25473 100644
--- a/disk/part.c
+++ b/disk/part.c
@@ -109,44 +109,45 @@ void dev_print (block_dev_desc_t *dev_desc)
lbaint_t lba512;
#endif
- if (dev_desc->type==DEV_TYPE_UNKNOWN) {
- puts ("not available\n");
- return;
- }
- if (dev_desc->if_type==IF_TYPE_SCSI) {
- printf ("(%d:%d) ", dev_desc->target,dev_desc->lun);
- }
- if (dev_desc->if_type==IF_TYPE_IDE) {
- printf ("Model: %s Firm: %s Ser#: %s\n",
+ switch (dev_desc->type) {
+ case IF_TYPE_SCSI:
+ printf ("(%d:%d) Vendor: %s Prod.: %s Rev: %s\n",
+ dev_desc->target,dev_desc->lun,
dev_desc->vendor,
- dev_desc->revision,
- dev_desc->product);
- }
- if (dev_desc->if_type==IF_TYPE_SATA) {
+ dev_desc->product,
+ dev_desc->revision);
+ break;
+ case IF_TYPE_IDE:
+ case IF_TYPE_SATA:
printf ("Model: %s Firm: %s Ser#: %s\n",
dev_desc->vendor,
dev_desc->revision,
dev_desc->product);
- } else {
- printf ("Vendor: %s Prod.: %s Rev: %s\n",
- dev_desc->vendor,
- dev_desc->product,
- dev_desc->revision);
+ break;
+ case DEV_TYPE_UNKNOWN:
+ default:
+ puts ("not available\n");
+ return;
}
puts (" Type: ");
if (dev_desc->removable)
puts ("Removable ");
switch (dev_desc->type & 0x1F) {
- case DEV_TYPE_HARDDISK: puts ("Hard Disk");
- break;
- case DEV_TYPE_CDROM: puts ("CD ROM");
- break;
- case DEV_TYPE_OPDISK: puts ("Optical Device");
- break;
- case DEV_TYPE_TAPE: puts ("Tape");
- break;
- default: printf ("# %02X #", dev_desc->type & 0x1F);
- break;
+ case DEV_TYPE_HARDDISK:
+ puts ("Hard Disk");
+ break;
+ case DEV_TYPE_CDROM:
+ puts ("CD ROM");
+ break;
+ case DEV_TYPE_OPDISK:
+ puts ("Optical Device");
+ break;
+ case DEV_TYPE_TAPE:
+ puts ("Tape");
+ break;
+ default:
+ printf ("# %02X #", dev_desc->type & 0x1F);
+ break;
}
puts ("\n");
if ((dev_desc->lba * dev_desc->blksz)>0L) {
@@ -281,20 +282,27 @@ static void print_part_header (const char *type, block_dev_desc_t * dev_desc)
{
puts ("\nPartition Map for ");
switch (dev_desc->if_type) {
- case IF_TYPE_IDE: puts ("IDE");
- break;
- case IF_TYPE_SATA: puts ("SATA");
- break;
- case IF_TYPE_SCSI: puts ("SCSI");
- break;
- case IF_TYPE_ATAPI: puts ("ATAPI");
- break;
- case IF_TYPE_USB: puts ("USB");
- break;
- case IF_TYPE_DOC: puts ("DOC");
- break;
- default: puts ("UNKNOWN");
- break;
+ case IF_TYPE_IDE:
+ puts ("IDE");
+ break;
+ case IF_TYPE_SATA:
+ puts ("SATA");
+ break;
+ case IF_TYPE_SCSI:
+ puts ("SCSI");
+ break;
+ case IF_TYPE_ATAPI:
+ puts ("ATAPI");
+ break;
+ case IF_TYPE_USB:
+ puts ("USB");
+ break;
+ case IF_TYPE_DOC:
+ puts ("DOC");
+ break;
+ default:
+ puts ("UNKNOWN");
+ break;
}
printf (" device %d -- Partition Type: %s\n\n",
dev_desc->dev, type);
diff --git a/disk/part_iso.c b/disk/part_iso.c
index 489463079..72ff8689d 100644
--- a/disk/part_iso.c
+++ b/disk/part_iso.c
@@ -81,7 +81,7 @@ int get_partition_info_iso_verb(block_dev_desc_t * dev_desc, int part_num, disk_
/* the first sector (sector 0x10) must be a primary volume desc */
blkaddr=PVD_OFFSET;
if (dev_desc->block_read (dev_desc->dev, PVD_OFFSET, 1, (ulong *) tmpbuf) != 1)
- return (-1);
+ return (-1);
if(ppr->desctype!=0x01) {
if(verb)
printf ("** First descriptor is NOT a primary desc on %d:%d **\n",
@@ -103,7 +103,7 @@ int get_partition_info_iso_verb(block_dev_desc_t * dev_desc, int part_num, disk_
for(i=blkaddr;i<lastsect;i++) {
PRINTF("Reading block %d\n", i);
if (dev_desc->block_read (dev_desc->dev, i, 1, (ulong *) tmpbuf) != 1)
- return (-1);
+ return (-1);
if(ppr->desctype==0x00)
break; /* boot entry found */
if(ppr->desctype==0xff) {
@@ -113,7 +113,7 @@ int get_partition_info_iso_verb(block_dev_desc_t * dev_desc, int part_num, disk_
return (-1);
}
}
- /* boot entry found */
+ /* boot entry found */
if(strncmp(pbr->ident_str,"EL TORITO SPECIFICATION",23)!=0) {
if(verb)
printf ("** Wrong El Torito ident: %s on %d:%d **\n",
diff --git a/disk/part_iso.h b/disk/part_iso.h
index 2663578bf..c139d4b63 100644
--- a/disk/part_iso.h
+++ b/disk/part_iso.h
@@ -41,8 +41,8 @@ typedef struct iso_pri_rec {
unsigned char desctype; /* type of Volume descriptor: 0 = boot record, 1 = primary, 2 = Supplement, 3 = volume part 0xff trminator */
unsigned char stand_ident[5]; /* "CD001" */
unsigned char vers; /* Version */
- unsigned char unused;
- char sysid[32]; /* system Identifier */
+ unsigned char unused;
+ char sysid[32]; /* system Identifier */
char volid[32]; /* volume Identifier */
unsigned char zeros1[8]; /* unused */
unsigned long volsiz_LE; /* volume size Little Endian */
@@ -57,69 +57,69 @@ typedef struct iso_pri_rec {
unsigned long pathtablen_LE;/* Path Table size LE */
unsigned long pathtablen_BE;/* Path Table size BE */
unsigned long 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 long 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 char rootdir[34]; /* directory record for root dir */
- char volsetid[128];/* Volume set identifier */
- char pubid[128]; /* Publisher identifier */
- char dataprepid[128]; /* data preparer identifier */
- char appid[128]; /* application identifier */
- char copyr[37]; /* copyright string */
- char abstractfileid[37]; /* abstract file identifier */
- char bibliofileid[37]; /* bibliographic file identifier */
- unsigned char creationdate[17]; /* creation date */
- unsigned char modify[17]; /* modification date */
- unsigned char expire[17]; /* expiring date */
- unsigned char effective[17];/* effective date */
- unsigned char filestruc_ver; /* file structur version */
+ unsigned long 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 long firstsek_BEpathtab2_BE; /* location of optional occurrence of big endian type path table */
+ unsigned char rootdir[34]; /* directory record for root dir */
+ char volsetid[128];/* Volume set identifier */
+ char pubid[128]; /* Publisher identifier */
+ char dataprepid[128]; /* data preparer identifier */
+ char appid[128]; /* application identifier */
+ char copyr[37]; /* copyright string */
+ char abstractfileid[37]; /* abstract file identifier */
+ char bibliofileid[37]; /* bibliographic file identifier */
+ unsigned char creationdate[17]; /* creation date */
+ unsigned char modify[17]; /* modification date */
+ unsigned char expire[17]; /* expiring date */
+ unsigned char effective[17];/* effective date */
+ unsigned char filestruc_ver; /* file structur version */
} iso_pri_rec_t;
typedef struct iso_sup_rec {
unsigned char desctype; /* type of Volume descriptor: 0 = boot record, 1 = primary, 2 = Supplement, 3 = volume part 0xff trminator */
unsigned char stand_ident[5]; /* "CD001" */
unsigned char vers; /* Version */
- unsigned char volumeflags; /* if bit 0 = 0 => all escape sequences are according ISO 2375 */
- char sysid[32]; /* system Identifier */
+ unsigned char volumeflags; /* if bit 0 = 0 => all escape sequences are according ISO 2375 */
+ char sysid[32]; /* system Identifier */
char volid[32]; /* volume Identifier */
unsigned char zeros1[8]; /* unused */
- unsigned long volsiz_LE; /* volume size Little Endian */
- unsigned long volsiz_BE; /* volume size Big Endian */
- unsigned char escapeseq[32];/* Escape sequences */
+ unsigned long volsiz_LE; /* volume size Little Endian */
+ unsigned long volsiz_BE; /* volume size Big Endian */
+ unsigned char escapeseq[32];/* Escape sequences */
unsigned short setsize_LE; /* volume set size LE */
- unsigned short setsize_BE; /* volume set size BE */
- unsigned short seqnum_LE; /* volume sequence number LE */
- unsigned short seqnum_BE; /* volume sequence number BE */
- unsigned short secsize_LE; /* sector size LE */
- unsigned short secsize_BE; /* sector size BE */
+ unsigned short setsize_BE; /* volume set size BE */
+ unsigned short seqnum_LE; /* volume sequence number LE */
+ unsigned short seqnum_BE; /* volume sequence number BE */
+ unsigned short secsize_LE; /* sector size LE */
+ unsigned short secsize_BE; /* sector size BE */
unsigned long pathtablen_LE;/* Path Table size LE */
unsigned long pathtablen_BE;/* Path Table size BE */
unsigned long 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 long 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 char rootdir[34]; /* directory record for root dir */
- char volsetid[128];/* Volume set identifier */
- char pubid[128]; /* Publisher identifier */
- char dataprepid[128]; /* data preparer identifier */
- char appid[128]; /* application identifier */
- char copyr[37]; /* copyright string */
- char abstractfileid[37]; /* abstract file identifier */
- char bibliofileid[37]; /* bibliographic file identifier */
- unsigned char creationdate[17]; /* creation date */
- unsigned char modify[17]; /* modification date */
- unsigned char expire[17]; /* expiring date */
- unsigned char effective[17];/* effective date */
- unsigned char filestruc_ver; /* file structur version */
+ unsigned long 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 long firstsek_BEpathtab2_BE; /* location of optional occurrence of big endian type path table */
+ unsigned char rootdir[34]; /* directory record for root dir */
+ char volsetid[128];/* Volume set identifier */
+ char pubid[128]; /* Publisher identifier */
+ char dataprepid[128]; /* data preparer identifier */
+ char appid[128]; /* application identifier */
+ char copyr[37]; /* copyright string */
+ char abstractfileid[37]; /* abstract file identifier */
+ char bibliofileid[37]; /* bibliographic file identifier */
+ unsigned char creationdate[17]; /* creation date */
+ unsigned char modify[17]; /* modification date */
+ unsigned char expire[17]; /* expiring date */
+ unsigned char effective[17];/* effective date */
+ unsigned char filestruc_ver; /* file structur version */
}iso_sup_rec_t;
typedef struct iso_part_rec {
unsigned char desctype; /* type of Volume descriptor: 0 = boot record, 1 = primary, 2 = Supplement, 3 = volume part 0xff trminator */
unsigned char stand_ident[5]; /* "CD001" */
unsigned char vers; /* Version */
- unsigned char unused;
- char sysid[32]; /* system Identifier */
- char volid[32]; /* volume partition Identifier */
+ unsigned char unused;
+ char sysid[32]; /* system Identifier */
+ char volid[32]; /* volume partition Identifier */
unsigned long partloc_LE; /* volume partition location LE */
unsigned long partloc_BE; /* volume partition location BE */
unsigned long partsiz_LE; /* volume partition size LE */
@@ -131,8 +131,8 @@ typedef struct iso_val_entry {
unsigned char header_id; /* Header ID must be 0x01 */
unsigned char platform; /* Platform: 0=x86, 1=PowerPC, 2=MAC */
unsigned char res[2]; /* reserved */
- char manu_str[0x18]; /* Ident String of manufacturer/developer */
- unsigned char chk_sum[2]; /* Check sum (all words must be zero) */
+ char manu_str[0x18]; /* Ident String of manufacturer/developer */
+ unsigned char chk_sum[2]; /* Check sum (all words must be zero) */
unsigned char key[2]; /* key[0]=55, key[1]=0xAA */
} iso_val_entry_t;
@@ -140,7 +140,7 @@ typedef struct iso_header_entry {
unsigned char header_id; /* Header ID must be 0x90 or 0x91 */
unsigned char platform; /* Platform: 0=x86, 1=PowerPC, 2=MAC */
unsigned char numentry[2]; /* number of entries */
- char id_str[0x1C]; /* Ident String of sectionr */
+ char id_str[0x1C]; /* Ident String of sectionr */
} iso_header_entry_t;
@@ -148,7 +148,7 @@ typedef struct iso_init_def_entry {
unsigned char boot_ind; /* Boot indicator 0x88=bootable 0=not bootable */
unsigned char boot_media; /* boot Media Type: 0=no Emulation, 1=1.2MB floppy, 2=1.44MB floppy, 3=2.88MB floppy 4=hd (0x80) */
unsigned char ld_seg[2]; /* Load segment (flat model=addr/10) */
- unsigned char systype; /* System Type copy of byte5 of part table */
+ unsigned char systype; /* System Type copy of byte5 of part table */
unsigned char res; /* reserved */
unsigned char sec_cnt[2]; /* sector count in VIRTUAL Blocks (0x200) */
unsigned char rel_block_addr[4]; /* relative Block address */