~ubuntu-branches/ubuntu/hoary/cdrtools/hoary

« back to all changes in this revision

Viewing changes to mkisofs/mac_label.h

  • Committer: Bazaar Package Importer
  • Author(s): Eduard Bloch
  • Date: 2002-04-09 10:03:06 UTC
  • Revision ID: james.westby@ubuntu.com-20020409100306-t4hagiv7gm0fhggv
Tags: upstream-1.10
ImportĀ upstreamĀ versionĀ 1.10

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* @(#)mac_label.h      1.1 00/03/18 joerg, Copyright 1997, 1998, 1999, 2000 James Pearson */
 
2
/*
 
3
 *      Copyright (c) 1997, 1998, 1999, 2000 James Pearson
 
4
 *
 
5
 * This program is free software; you can redistribute it and/or modify
 
6
 * it under the terms of the GNU General Public License as published by
 
7
 * the Free Software Foundation; either version 2, or (at your option)
 
8
 * any later version.
 
9
 *
 
10
 * This program is distributed in the hope that it will be useful,
 
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
13
 * GNU General Public License for more details.
 
14
 *
 
15
 * You should have received a copy of the GNU General Public License
 
16
 * along with this program; see the file COPYING.  If not, write to
 
17
 * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
 
18
 */
 
19
 
 
20
/*
 
21
 *      mac_label.h: defines Macintosh partition maps and label
 
22
 *
 
23
 *      Taken from "mkisofs 1.05 PLUS" by Andy Polyakov <appro@fy.chalmers.se>
 
24
 *      (see http://fy.chalmers.se/~appro/mkisofs_plus.html for details)
 
25
 *
 
26
 *      Much of this is already defined in the libhfs code, but to keep
 
27
 *      things simple we stick with these.
 
28
 */
 
29
 
 
30
#ifndef _MAC_LABEL_H
 
31
#define _MAC_LABEL_H
 
32
 
 
33
#ifdef __cplusplus
 
34
extern "C" {
 
35
#endif
 
36
 
 
37
#ifdef PREP_BOOT
 
38
struct fdiskPartition {
 
39
#define prepPartType 0x41
 
40
        unsigned char   boot;           /* bootable flag; not used */
 
41
        unsigned char   CHSstart[3];    /* start CHS; not used */
 
42
        unsigned char   type;           /* Partition type, = 0x41 (PReP bootable) */
 
43
        unsigned char   CHSend[3];      /* end CHS; not used */
 
44
        unsigned char   startSect[4];   /* start sector (really start of boot image on CD */
 
45
        unsigned char   size[4];        /* size of partition (or boot image ;) ) */
 
46
};
 
47
typedef struct fdiskPartition fdiskPartition;
 
48
#endif
 
49
 
 
50
/* Driver Descriptor Map */
 
51
#define sbSigMagic      "ER"
 
52
struct MacLabel {
 
53
        unsigned char   sbSig[2];       /* unique value for SCSI block 0 */
 
54
        unsigned char   sbBlkSize[2];   /* block size of device */
 
55
        unsigned char   sbBlkCount[4];  /* number of blocks on device */
 
56
        unsigned char   sbDevType[2];   /* device type */
 
57
        unsigned char   sbDevId[2];     /* device id */
 
58
        unsigned char   sbData[4];      /* not used */
 
59
        unsigned char   sbDrvrCount[2]; /* driver descriptor count */
 
60
        unsigned char   ddBlock[4];     /* 1st driver's starting block */
 
61
        unsigned char   ddSize[2];      /* size of 1st driver (512-byte blks) */
 
62
        unsigned char   ddType[2];      /* system type (1 for Mac+) */
 
63
#ifndef PREP_BOOT
 
64
        unsigned char   ddPad[486];     /* ARRAY[0..242] OF INTEGER; not used */
 
65
#else
 
66
#define fdiskMagic0 0x55
 
67
#define fdiskMagic1 0xAA
 
68
        unsigned char   pad1[420];      /* not used */
 
69
        fdiskPartition  image[4];       /* heh heh heh, we can have up to 4
 
70
                                           different boot images */
 
71
        unsigned char   fdiskMagic[2];  /* PReP uses fdisk partition map */
 
72
#endif /* PREP_BOOT */
 
73
};
 
74
typedef struct MacLabel MacLabel;
 
75
 
 
76
#define IS_MAC_LABEL(d)         (((MacLabel*)(d))->sbSig[0]=='E'&&((MacLabel*)(d))->sbSig[1]=='R')
 
77
 
 
78
/* Partition Map Entry */
 
79
#define pmSigMagic      "PM"
 
80
 
 
81
#define pmPartType_1    "Apple_partition_map"
 
82
#define pmPartName_11   "Apple"
 
83
 
 
84
#define pmPartType_2    "Apple_Driver"
 
85
#define pmPartType_21   "Apple_Driver43"
 
86
 
 
87
#define pmPartType_3    "Apple_UNIX_SVR2"
 
88
#define pmPartName_31   "A/UX Root"
 
89
#define pmPartName_32   "A/UX Usr"
 
90
#define pmPartName_33   "Random A/UX fs"
 
91
#define pmPartName_34   "Swap"
 
92
 
 
93
#define pmPartType_4    "Apple_HFS"
 
94
#define pmPartName_41   "MacOS"
 
95
 
 
96
#define pmPartType_5    "Apple_Free"
 
97
#define pmPartName_51   "Extra"
 
98
 
 
99
#define PM2     2
 
100
#define PM4     4
 
101
 
 
102
struct MacPart {
 
103
        unsigned char   pmSig[2];       /* unique value for map entry blk */
 
104
        unsigned char   pmSigPad[2];    /* currently unused */
 
105
        unsigned char   pmMapBlkCnt[4]; /* # of blks in partition map */
 
106
        unsigned char   pmPyPartStart[4];/* physical start blk of partition */
 
107
        unsigned char   pmPartBlkCnt[4];/* # of blks in this partition */
 
108
        unsigned char   pmPartName[32]; /* ASCII partition name */
 
109
        unsigned char   pmPartType[32]; /* ASCII partition type */
 
110
        unsigned char   pmLgDataStart[4];/* log. # of partition's 1st data blk */
 
111
        unsigned char   pmDataCnt[4];   /* # of blks in partition's data area */
 
112
        unsigned char   pmPartStatus[4];/* bit field for partition status */
 
113
        unsigned char   pmLgBootStart[4];/* log. blk of partition's boot code */
 
114
        unsigned char   pmBootSize[4];  /* number of bytes in boot code */
 
115
        unsigned char   pmBootAddr[4];  /* memory load address of boot code */
 
116
        unsigned char   pmBootAddr2[4]; /* currently unused */
 
117
        unsigned char   pmBootEntry[4]; /* entry point of boot code */
 
118
        unsigned char   pmBootEntry2[4];/* currently unused */
 
119
        unsigned char   pmBootCksum[4]; /* checksum of boot code */
 
120
        unsigned char   pmProcessor[16];/* ASCII for the processor type */
 
121
        unsigned char   pmPad[376];     /* ARRAY[0..187] OF INTEGER; not used */
 
122
};
 
123
typedef struct MacPart MacPart;
 
124
 
 
125
#define IS_MAC_PART(d)          (((MacPart*)(d))->pmSig[0]=='P'&&((MacPart*)(d))->pmSig[1]=='M')
 
126
 
 
127
#define PM_STAT_VALID           0x01    /* Set if a valid partition map entry */
 
128
#define PM_STAT_ALLOC           0x02    /* Set if partition is already allocated; clear if available */
 
129
#define PM_STAT_INUSE           0x04    /* Set if partition is in use; may be cleared after a system reset */
 
130
#define PM_STAT_BOOTABLE        0x08    /* Set if partition contains valid boot information */
 
131
#define PM_STAT_READABLE        0x10    /* Set if partition allows reading */
 
132
#define PM_STAT_WRITABLE        0x20    /* Set if partition allows writing */
 
133
#define PM_STAT_BOOT_PIC        0x40    /* Set if boot code is position-independent */
 
134
#define PM_STAT_UNUSED          0x80    /* Unused */
 
135
#define PM_STAT_DEFAULT         PM_STAT_VALID|PM_STAT_ALLOC|PM_STAT_READABLE|PM_STAT_WRITABLE
 
136
 
 
137
typedef struct {
 
138
        char *name;                     /* Partition name */
 
139
        char *type;                     /* Partition type */
 
140
        int   ntype;                    /* Partition type (numeric) */
 
141
        int   start;                    /* start extent (SECTOR_SIZE blocks) */
 
142
        int   size;                     /* extents (SECTOR_SIZE blocks) */
 
143
} mac_partition_table;
 
144
 
 
145
/* from libhfs */
 
146
#define HFS_BB_SIGWORD          0x4c4b
 
147
 
 
148
typedef struct deferred_write defer;
 
149
 
 
150
#ifdef __cplusplus
 
151
}
 
152
#endif
 
153
 
 
154
#endif /* _MAC_LABEL_H */