Tom Rini | 10e4779 | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0+ */ |
wdenk | 012771d | 2002-03-08 21:31:05 +0000 | [diff] [blame] | 2 | /* |
| 3 | * (C) Copyright 2001 |
| 4 | * Denis Peter, MPL AG Switzerland, d.peter@mpl.ch. |
wdenk | 012771d | 2002-03-08 21:31:05 +0000 | [diff] [blame] | 5 | */ |
| 6 | #ifndef _PART_CD_H |
| 7 | #define _PART_CD_H |
| 8 | |
| 9 | #define BRVD 0x11 |
| 10 | #define PVD_OFFSET 0x10 |
| 11 | |
wdenk | 012771d | 2002-03-08 21:31:05 +0000 | [diff] [blame] | 12 | typedef struct iso_boot_rec { |
| 13 | unsigned char desctype; /* type of Volume descriptor: 0 = boot record, 1 = primary, 2 = Supplement, 3 = volume part 0xff trminator */ |
| 14 | unsigned char stand_ident[5]; /* "CD001" */ |
| 15 | unsigned char vers; /* Version */ |
| 16 | char ident_str[0x20]; /* Ident String "EL TORITO SPECIFICATION" */ |
| 17 | unsigned char unused[0x20]; /* unused */ |
| 18 | unsigned char pointer[4]; /* absolute pointer to Boot Catalog */ |
| 19 | } iso_boot_rec_t; |
| 20 | |
wdenk | 012771d | 2002-03-08 21:31:05 +0000 | [diff] [blame] | 21 | typedef struct iso_pri_rec { |
| 22 | unsigned char desctype; /* type of Volume descriptor: 0 = boot record, 1 = primary, 2 = Supplement, 3 = volume part 0xff trminator */ |
| 23 | unsigned char stand_ident[5]; /* "CD001" */ |
| 24 | unsigned char vers; /* Version */ |
Wolfgang Denk | a1be476 | 2008-05-20 16:00:29 +0200 | [diff] [blame] | 25 | unsigned char unused; |
| 26 | char sysid[32]; /* system Identifier */ |
wdenk | 012771d | 2002-03-08 21:31:05 +0000 | [diff] [blame] | 27 | char volid[32]; /* volume Identifier */ |
| 28 | unsigned char zeros1[8]; /* unused */ |
Alexander Graf | 168c1e8 | 2016-04-11 16:16:14 +0200 | [diff] [blame] | 29 | unsigned int volsiz_LE; /* volume size Little Endian */ |
| 30 | unsigned int volsiz_BE; /* volume size Big Endian */ |
wdenk | 012771d | 2002-03-08 21:31:05 +0000 | [diff] [blame] | 31 | unsigned char zeros2[32]; /* unused */ |
| 32 | unsigned short setsize_LE; /* volume set size LE */ |
| 33 | unsigned short setsize_BE; /* volume set size BE */ |
| 34 | unsigned short seqnum_LE; /* volume sequence number LE */ |
| 35 | unsigned short seqnum_BE; /* volume sequence number BE */ |
| 36 | unsigned short secsize_LE; /* sector size LE */ |
| 37 | unsigned short secsize_BE; /* sector size BE */ |
Alexander Graf | 168c1e8 | 2016-04-11 16:16:14 +0200 | [diff] [blame] | 38 | unsigned int pathtablen_LE;/* Path Table size LE */ |
| 39 | unsigned int pathtablen_BE;/* Path Table size BE */ |
| 40 | unsigned int firstsek_LEpathtab1_LE; /* location of first occurrence of little endian type path table */ |
| 41 | unsigned int firstsek_LEpathtab2_LE; /* location of optional occurrence of little endian type path table */ |
| 42 | unsigned int firstsek_BEpathtab1_BE; /* location of first occurrence of big endian type path table */ |
| 43 | unsigned int firstsek_BEpathtab2_BE; /* location of optional occurrence of big endian type path table */ |
Wolfgang Denk | a1be476 | 2008-05-20 16:00:29 +0200 | [diff] [blame] | 44 | unsigned char rootdir[34]; /* directory record for root dir */ |
| 45 | char volsetid[128];/* Volume set identifier */ |
| 46 | char pubid[128]; /* Publisher identifier */ |
| 47 | char dataprepid[128]; /* data preparer identifier */ |
| 48 | char appid[128]; /* application identifier */ |
| 49 | char copyr[37]; /* copyright string */ |
| 50 | char abstractfileid[37]; /* abstract file identifier */ |
| 51 | char bibliofileid[37]; /* bibliographic file identifier */ |
| 52 | unsigned char creationdate[17]; /* creation date */ |
| 53 | unsigned char modify[17]; /* modification date */ |
| 54 | unsigned char expire[17]; /* expiring date */ |
| 55 | unsigned char effective[17];/* effective date */ |
| 56 | unsigned char filestruc_ver; /* file structur version */ |
wdenk | 012771d | 2002-03-08 21:31:05 +0000 | [diff] [blame] | 57 | } iso_pri_rec_t; |
| 58 | |
| 59 | typedef struct iso_sup_rec { |
| 60 | unsigned char desctype; /* type of Volume descriptor: 0 = boot record, 1 = primary, 2 = Supplement, 3 = volume part 0xff trminator */ |
| 61 | unsigned char stand_ident[5]; /* "CD001" */ |
| 62 | unsigned char vers; /* Version */ |
Wolfgang Denk | a1be476 | 2008-05-20 16:00:29 +0200 | [diff] [blame] | 63 | unsigned char volumeflags; /* if bit 0 = 0 => all escape sequences are according ISO 2375 */ |
| 64 | char sysid[32]; /* system Identifier */ |
wdenk | 012771d | 2002-03-08 21:31:05 +0000 | [diff] [blame] | 65 | char volid[32]; /* volume Identifier */ |
| 66 | unsigned char zeros1[8]; /* unused */ |
Alexander Graf | 168c1e8 | 2016-04-11 16:16:14 +0200 | [diff] [blame] | 67 | unsigned int volsiz_LE; /* volume size Little Endian */ |
| 68 | unsigned int volsiz_BE; /* volume size Big Endian */ |
Wolfgang Denk | a1be476 | 2008-05-20 16:00:29 +0200 | [diff] [blame] | 69 | unsigned char escapeseq[32];/* Escape sequences */ |
wdenk | 012771d | 2002-03-08 21:31:05 +0000 | [diff] [blame] | 70 | unsigned short setsize_LE; /* volume set size LE */ |
Wolfgang Denk | a1be476 | 2008-05-20 16:00:29 +0200 | [diff] [blame] | 71 | unsigned short setsize_BE; /* volume set size BE */ |
| 72 | unsigned short seqnum_LE; /* volume sequence number LE */ |
| 73 | unsigned short seqnum_BE; /* volume sequence number BE */ |
| 74 | unsigned short secsize_LE; /* sector size LE */ |
| 75 | unsigned short secsize_BE; /* sector size BE */ |
Alexander Graf | 168c1e8 | 2016-04-11 16:16:14 +0200 | [diff] [blame] | 76 | unsigned int pathtablen_LE;/* Path Table size LE */ |
| 77 | unsigned int pathtablen_BE;/* Path Table size BE */ |
| 78 | unsigned int firstsek_LEpathtab1_LE; /* location of first occurrence of little endian type path table */ |
| 79 | unsigned int firstsek_LEpathtab2_LE; /* location of optional occurrence of little endian type path table */ |
| 80 | unsigned int firstsek_BEpathtab1_BE; /* location of first occurrence of big endian type path table */ |
| 81 | unsigned int firstsek_BEpathtab2_BE; /* location of optional occurrence of big endian type path table */ |
Wolfgang Denk | a1be476 | 2008-05-20 16:00:29 +0200 | [diff] [blame] | 82 | unsigned char rootdir[34]; /* directory record for root dir */ |
| 83 | char volsetid[128];/* Volume set identifier */ |
| 84 | char pubid[128]; /* Publisher identifier */ |
| 85 | char dataprepid[128]; /* data preparer identifier */ |
| 86 | char appid[128]; /* application identifier */ |
| 87 | char copyr[37]; /* copyright string */ |
| 88 | char abstractfileid[37]; /* abstract file identifier */ |
| 89 | char bibliofileid[37]; /* bibliographic file identifier */ |
| 90 | unsigned char creationdate[17]; /* creation date */ |
| 91 | unsigned char modify[17]; /* modification date */ |
| 92 | unsigned char expire[17]; /* expiring date */ |
| 93 | unsigned char effective[17];/* effective date */ |
| 94 | unsigned char filestruc_ver; /* file structur version */ |
wdenk | 012771d | 2002-03-08 21:31:05 +0000 | [diff] [blame] | 95 | }iso_sup_rec_t; |
| 96 | |
| 97 | typedef struct iso_part_rec { |
| 98 | unsigned char desctype; /* type of Volume descriptor: 0 = boot record, 1 = primary, 2 = Supplement, 3 = volume part 0xff trminator */ |
| 99 | unsigned char stand_ident[5]; /* "CD001" */ |
| 100 | unsigned char vers; /* Version */ |
Wolfgang Denk | a1be476 | 2008-05-20 16:00:29 +0200 | [diff] [blame] | 101 | unsigned char unused; |
| 102 | char sysid[32]; /* system Identifier */ |
| 103 | char volid[32]; /* volume partition Identifier */ |
Alexander Graf | 168c1e8 | 2016-04-11 16:16:14 +0200 | [diff] [blame] | 104 | unsigned int partloc_LE; /* volume partition location LE */ |
| 105 | unsigned int partloc_BE; /* volume partition location BE */ |
| 106 | unsigned int partsiz_LE; /* volume partition size LE */ |
| 107 | unsigned int partsiz_BE; /* volume partition size BE */ |
wdenk | 012771d | 2002-03-08 21:31:05 +0000 | [diff] [blame] | 108 | }iso_part_rec_t; |
| 109 | |
wdenk | 012771d | 2002-03-08 21:31:05 +0000 | [diff] [blame] | 110 | typedef struct iso_val_entry { |
| 111 | unsigned char header_id; /* Header ID must be 0x01 */ |
| 112 | unsigned char platform; /* Platform: 0=x86, 1=PowerPC, 2=MAC */ |
| 113 | unsigned char res[2]; /* reserved */ |
Wolfgang Denk | a1be476 | 2008-05-20 16:00:29 +0200 | [diff] [blame] | 114 | char manu_str[0x18]; /* Ident String of manufacturer/developer */ |
| 115 | unsigned char chk_sum[2]; /* Check sum (all words must be zero) */ |
wdenk | 012771d | 2002-03-08 21:31:05 +0000 | [diff] [blame] | 116 | unsigned char key[2]; /* key[0]=55, key[1]=0xAA */ |
| 117 | } iso_val_entry_t; |
| 118 | |
| 119 | typedef struct iso_header_entry { |
| 120 | unsigned char header_id; /* Header ID must be 0x90 or 0x91 */ |
| 121 | unsigned char platform; /* Platform: 0=x86, 1=PowerPC, 2=MAC */ |
| 122 | unsigned char numentry[2]; /* number of entries */ |
Wolfgang Denk | a1be476 | 2008-05-20 16:00:29 +0200 | [diff] [blame] | 123 | char id_str[0x1C]; /* Ident String of sectionr */ |
wdenk | 012771d | 2002-03-08 21:31:05 +0000 | [diff] [blame] | 124 | } iso_header_entry_t; |
| 125 | |
wdenk | 012771d | 2002-03-08 21:31:05 +0000 | [diff] [blame] | 126 | typedef struct iso_init_def_entry { |
| 127 | unsigned char boot_ind; /* Boot indicator 0x88=bootable 0=not bootable */ |
| 128 | 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) */ |
| 129 | unsigned char ld_seg[2]; /* Load segment (flat model=addr/10) */ |
Wolfgang Denk | a1be476 | 2008-05-20 16:00:29 +0200 | [diff] [blame] | 130 | unsigned char systype; /* System Type copy of byte5 of part table */ |
wdenk | 012771d | 2002-03-08 21:31:05 +0000 | [diff] [blame] | 131 | unsigned char res; /* reserved */ |
| 132 | unsigned char sec_cnt[2]; /* sector count in VIRTUAL Blocks (0x200) */ |
| 133 | unsigned char rel_block_addr[4]; /* relative Block address */ |
| 134 | } iso_init_def_entry_t; |
| 135 | |
wdenk | 012771d | 2002-03-08 21:31:05 +0000 | [diff] [blame] | 136 | void print_partition_cd(int dev); |
| 137 | |
wdenk | 012771d | 2002-03-08 21:31:05 +0000 | [diff] [blame] | 138 | #endif /* _PART_CD_H */ |