mbr.h revision 1.36
1/*	$OpenBSD: mbr.h,v 1.36 2021/07/18 12:41:00 krw Exp $	*/
2
3/*
4 * Copyright (c) 1997 Tobias Weingartner
5 *
6 * Permission to use, copy, modify, and distribute this software for any
7 * purpose with or without fee is hereby granted, provided that the above
8 * copyright notice and this permission notice appear in all copies.
9 *
10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 */
18
19#ifndef _MBR_H
20#define _MBR_H
21
22struct mbr {
23	uint64_t	mbr_lba_firstembr;
24	uint64_t	mbr_lba_self;
25	unsigned char	mbr_code[DOSPARTOFF];
26	struct prt	mbr_prt[NDOSPART];
27	uint16_t	mbr_signature;
28};
29
30extern struct mbr	initial_mbr;
31
32void		MBR_print(const struct mbr *, const char *);
33void		MBR_parse(const struct dos_mbr *, const uint64_t,
34    const uint64_t, struct mbr *);
35void		MBR_make(struct mbr *, struct dos_mbr *);
36void		MBR_init(struct mbr *);
37void		MBR_init_GPT(struct mbr *);
38int		MBR_read(const uint64_t, const uint64_t, struct mbr *);
39int		MBR_write(const uint64_t, const struct dos_mbr *);
40int		MBR_protective_mbr(struct mbr *);
41
42#endif /* _MBR_H */
43