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