The Pedigree Project  0.1
msdos.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2008-2014, Pedigree Developers
3  *
4  * Please see the CONTRIB file in the root of the source tree for a full
5  * list of contributors.
6  *
7  * Permission to use, copy, modify, and distribute this software for any
8  * purpose with or without fee is hereby granted, provided that the above
9  * copyright notice and this permission notice appear in all copies.
10  *
11  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
12  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
13  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
14  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
15  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
16  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
17  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18  */
19 
22 
23 #ifndef MSDOS_H
24 #define MSDOS_H
25 
26 #include "pedigree/kernel/processor/types.h"
27 
28 class Disk;
29 
30 // Identification of an MBR - 0x55 0xAA in bytes 510 and 511 respectively.
31 #define MSDOS_IDENT_1 0x55
32 #define MSDOS_IDENT_2 0xAA
33 
34 // Start of partition table in the first sector.
35 #define MSDOS_PARTTAB_START 0x1BE
36 // Number of partition entries in one table.
37 #define MSDOS_PARTTAB_NUM 0x4
38 #define MSDOS_EXT_PARTTAB_NUM 0x2
39 
41 typedef struct
42 {
43  uint8_t active;
44  uint8_t start_head;
45  uint8_t start_cylinder_low;
46  uint8_t start_cylinder_high;
47  uint8_t type;
48  uint8_t end_head;
49  uint8_t end_cylinder_low;
50  uint8_t end_cylinder_high;
51  uint32_t start_lba;
52  uint32_t size;
53 } __attribute__((packed)) MsdosPartitionInfo;
54 
59 bool msdosProbeDisk(Disk *pDisk);
60 
62 bool msdosReadTable(MsdosPartitionInfo *pPartitions, Disk *pDisk);
63 
64 #endif
bool msdosReadTable(MsdosPartitionInfo *pPartitions, Disk *pDisk)
Definition: msdos.cc:400
Definition: Disk.h:32
bool msdosProbeDisk(Disk *pDisk)
Definition: msdos.cc:457