Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Fetching contributors…
Cannot retrieve contributors at this time
41 lines (32 sloc) 918 Bytes
// Copyright (c) 2008 David Caldwell, All Rights Reserved.
#ifndef __MBR_H__
#define __MBR_H__
#include "device.h"
struct chs {
int cylinder;
int head;
int sector;
struct mbr {
char code[440];
int disk_signature;
int unused;
struct mbr_partition {
int status;
struct chs first_sector;
int partition_type;
struct chs last_sector;
unsigned int first_sector_lba;
unsigned int sectors;
} partition[4];
int mbr_signature;
#define MBR_SIGNATURE 0xAA55
struct mbr init_mbr(struct device *dev);
struct mbr read_mbr(struct device *dev);
bool write_mbr(struct device *dev, struct mbr mbr);
void dump_mbr(struct mbr mbr);
struct mbr mbr_from_sector(void *sector); // frees sector
void *sector_from_mbr(struct device *dev, struct mbr mbr); // returns malloced mem
#endif /* __MBR_H__ */
Jump to Line
Something went wrong with that request. Please try again.