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