Sync usage with man page.
[netbsd-mini2440.git] / sys / arch / atari / stand / tostools / libtos / ahdi.h
blob42e7bdcb08d648dfa79ceeeec8d78a59dfd2385d
1 /*
2 * Copyright (c) 1995 Leo Weppelman.
3 * All rights reserved.
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
14 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
15 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
18 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 #ifndef AHDI_H
27 #define AHDI_H
29 #define AHDI_BSIZE 512 /* AHDI blocksize */
30 #define AHDI_BBLOCK 0 /* AHDI bootblock (root sector) */
33 * Various `well known' AHDI partition identifiers.
35 #define AHDI_MKPID(x,y,z) ( ((u_int32_t)(x) << 16) \
36 | ((u_int32_t)(y) << 8) \
37 | ((u_int32_t)(z)) \
39 #define AHDI_PID_XGM AHDI_MKPID('X','G','M')
40 #define AHDI_PID_GEM AHDI_MKPID('G','E','M')
41 #define AHDI_PID_BGM AHDI_MKPID('B','G','M')
42 #define AHDI_PID_RAW AHDI_MKPID('R','A','W')
43 #define AHDI_PID_SWP AHDI_MKPID('S','W','P')
44 #define AHDI_PID_NBD AHDI_MKPID('N','B','D')
45 #define AHDI_PID_NBR AHDI_MKPID('N','B','R')
46 #define AHDI_PID_NBS AHDI_MKPID('N','B','S')
47 #define AHDI_PID_NBU AHDI_MKPID('N','B','U')
50 * Format of AHDI boot block.
52 #define AHDI_MAXRPD 4 /* max. # of partition descriptors */
53 /* in an AHDI bootblock (aka root) */
54 #define AHDI_MAXARPD 2 /* max. # of partition descriptors */
57 * On-disk representation of the AHDI disklabel.
59 struct ahdi_part {
60 u_int8_t ap_flg; /* bit 0 is in-use flag */
61 u_int8_t ap_id[3]; /* id: GEM, BGM, XGM, UNX, MIX */
62 u_int32_t ap_st; /* block where partition starts */
63 u_int32_t ap_size; /* partition size in blocks */
66 struct ahdi_root {
67 u_int8_t ar_fill[0x1c2];/* filler, can be boot code */
68 u_int32_t ar_hdsize; /* size of entire volume in blocks */
69 struct ahdi_part ar_parts[AHDI_MAXRPD]; /* root partition table */
70 u_int32_t ar_bslst; /* start of bad-sector list */
71 u_int32_t ar_bslsize; /* # of blocks in bad-sector list */
72 u_int16_t ar_checksum;
76 * Partition table representation as generated by ahdi_getparts():
78 typedef struct {
79 char id[4];
80 u_int start;
81 u_int end;
82 u_int rsec;
83 u_int rent;
84 int mod;
85 } part_t;
87 typedef struct {
88 int nparts;
89 part_t *parts;
90 } ptable_t;
93 * Functions exported from ahdi.c
95 EXTERN u_int ahdi_getparts PROTO((disk_t *, ptable_t *, u_int, u_int));
96 #endif /* AHDI_H */