Chameleon

Chameleon Svn Source Tree

Root/tags/2.0/i386/util/fdisk/mbr.h

Source at commit 1808 created 12 years 4 months ago.
By blackosx, Revise layout of package installer 'Welcome' file so it looks cleaner. Change the copyright notice to begin from 2009 as seen in the Chameleon 2.0 r431 installer. Should this date be set earlier?
1/*
2 * Copyright (c) 2002 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
11 * file.
12 *
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
20 *
21 * @APPLE_LICENSE_HEADER_END@
22 */
23/*
24 * 2008-05-24:
25 * Tamas Kosarszky: changed MBR_CODE_SIZE to 0x1B8 to make fdisk
26 * compatible with Vista and GPT specifications.
27 *
28 * Credits goes to Dense for the idea of this modification and
29 * Kabyl for findig this piece of source.
30 */
31/*
32 * Copyright (c) 1997 Tobias Weingartner
33 * All rights reserved.
34 *
35 * Redistribution and use in source and binary forms, with or without
36 * modification, are permitted provided that the following conditions
37 * are met:
38 * 1. Redistributions of source code must retain the above copyright
39 * notice, this list of conditions and the following disclaimer.
40 * 2. Redistributions in binary form must reproduce the above copyright
41 * notice, this list of conditions and the following disclaimer in the
42 * documentation and/or other materials provided with the distribution.
43 * 3. All advertising materials mentioning features or use of this software
44 * must display the following acknowledgement:
45 * This product includes software developed by Tobias Weingartner.
46 * 4. The name of the author may not be used to endorse or promote products
47 * derived from this software without specific prior written permission.
48 *
49 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
50 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
51 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
52 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
53 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
54 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
55 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
56 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
57 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
58 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
59 */
60
61#ifndef _MBR_H
62#define _MBR_H
63
64#include "part.h"
65
66#ifndef NDOSPART
67#define NDOSPART 4
68#define DOSPTYP_UNUSED 0
69#define DOSPTYP_EXTEND 5
70#define DOSPTYP_EXTENDL 15
71#define DOSACTIVE 128
72#endif
73
74/* Various constants */
75#define MBR_CODE_SIZE 0x1B8
76#define MBR_PART_SIZE0x10
77#define MBR_PART_OFF 0x1BE
78#define MBR_SIG_OFF 0x1FE
79/* MBR_BUF_SIZE is the largest sector size we support */
80#define MBR_BUF_SIZE 4096
81
82#define MBR_SIGNATURE 0xAA55
83
84/* MBR type */
85typedef struct _mbr_t {
86 off_t reloffset; /* the offset of the first extended partition that contains all the rest */
87 off_t offset; /* the absolute offset of this partition */
88 struct _mbr_t *next; /* pointer to the next MBR in an extended partition chain */
89unsigned char code[MBR_CODE_SIZE];
90unsigned short signature;
91prt_t part[NDOSPART];
92 unsigned char buf[MBR_BUF_SIZE];
93} mbr_t;
94
95/* Prototypes */
96void MBR_print_disk __P((char *));
97void MBR_print __P((mbr_t *));
98void MBR_print_all __P((mbr_t *));
99void MBR_parse __P((disk_t *, off_t, off_t, mbr_t *));
100void MBR_make __P((mbr_t *));
101void MBR_init __P((disk_t *, mbr_t *));
102int MBR_read __P((disk_t *,int, off_t, mbr_t *));
103int MBR_write __P((disk_t *,int, mbr_t *));
104void MBR_pcopy __P((disk_t *, mbr_t *));
105mbr_t * MBR_parse_spec __P((FILE *, disk_t *));
106void MBR_dump __P((mbr_t *));
107void MBR_dump_all __P((mbr_t *));
108mbr_t *MBR_alloc __P((mbr_t *));
109void MBR_free __P((mbr_t *));
110mbr_t * MBR_read_all __P((disk_t *));
111int MBR_write_all __P((disk_t *, mbr_t *));
112void MBR_clear __P((mbr_t *));
113
114/* Sanity check */
115#include <machine/param.h>
116#if (DEV_BSIZE != 512)
117#error "DEV_BSIZE != 512, somebody better fix me!"
118#endif
119
120#endif /* _MBR_H */
121
122

Archive Download this file

Revision: 1808