Changeset 77a194c in mainline for uspace/lib/label/include/std/mbr.h


Ignore:
Timestamp:
2015-11-04T18:55:46Z (10 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
44183b98
Parents:
5265eea4 (diff), bfcde8d (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge new disk partitioning architecture.

File:
1 moved

Legend:

Unmodified
Added
Removed
  • uspace/lib/label/include/std/mbr.h

    r5265eea4 r77a194c  
    11/*
    2  * Copyright (c) 2009 Jiri Svoboda
    3  * Copyright (c) 2011-2013 Dominik Taborsky
     2 * Copyright (c) 2015 Jiri Svoboda
    43 * All rights reserved.
    54 *
     
    2827 */
    2928
    30  /** @addtogroup libmbr
     29/** @addtogroup bd
    3130 * @{
    3231 */
     
    3433 */
    3534
    36 #ifndef LIBMBR_MBR_H_
    37 #define LIBMBR_MBR_H_
     35#ifndef LIBLABEL_STD_MBR_H_
     36#define LIBLABEL_STD_MBR_H_
    3837
    39 #include <sys/types.h>
     38#include <stdint.h>
    4039
    4140enum {
     41        /** Block address of Master Boot Record. */
     42        mbr_ba = 0,
     43
     44        /** First block allowed for allocation */
     45        mbr_ablock0 = 18,
     46
    4247        /** Number of primary partition records */
    43         N_PRIMARY = 4,
    44        
     48        mbr_nprimary = 4,
     49
    4550        /** Boot record signature */
    46         BR_SIGNATURE = 0xAA55
     51        mbr_br_signature = 0xAA55,
     52
     53        /** EBR PTE slot describing partition corresponding to this EBR */
     54        mbr_ebr_pte_this = 0,
     55        /** EBR PTE slot describing the next EBR */
     56        mbr_ebr_pte_next = 1
    4757};
    4858
    49 enum {
    50         /** Non-bootable */
    51         B_INACTIVE = 0x00,
    52         /** Bootable */
    53         B_ACTIVE = 0x80,
    54         /** Anything else means invalid */
    55 };
    56 
    57 enum {
     59enum mbr_ptype {
    5860        /** Unused partition entry */
    59         PT_UNUSED = 0x00,
     61        mbr_pt_unused      = 0x00,
    6062        /** Extended partition */
    61         PT_EXTENDED = 0x05,
     63        mbr_pt_extended    = 0x05,
    6264        /** Extended partition with LBA */
    63         PT_EXTENDED_LBA = 0x0F,
    64         /** GPT Protective partition */
    65         PT_GPT = 0xEE,
     65        mbr_pt_extended_lba = 0x0f,
     66        /** FAT16 with LBA */
     67        mbr_pt_fat16_lba    = 0x0e,
     68        /** FAT32 with LBA */
     69        mbr_pt_fat32_lba    = 0x0c,
     70        /** IFS, HPFS, NTFS, exFAT */
     71        mbr_pt_ms_advanced  = 0x07,
     72        /** Minix */
     73        mbr_pt_minix        = 0x81,
     74        /** Linux */
     75        mbr_pt_linux        = 0x83,
     76        /** GPT Protective */
     77        mbr_pt_gpt_protect  = 0xee
    6678};
    6779
     
    7991        /** Number of blocks in partition */
    8092        uint32_t length;
    81 } __attribute__((packed)) pt_entry_t;
     93} __attribute__((packed)) mbr_pte_t;
    8294
    8395/** Structure of a boot-record block */
    8496typedef struct {
    85         /** Area for boot code */
     97        /* Area for boot code */
    8698        uint8_t code_area[440];
    87         /** Optional media ID */
     99
     100        /* Optional media ID */
    88101        uint32_t media_id;
    89         /** Padding */
     102
    90103        uint16_t pad0;
     104
    91105        /** Partition table entries */
    92         pt_entry_t pte[N_PRIMARY];
     106        mbr_pte_t pte[mbr_nprimary];
     107
    93108        /** Boot record block signature (@c BR_SIGNATURE) */
    94109        uint16_t signature;
    95 } __attribute__((packed)) br_block_t;
     110} __attribute__((packed)) mbr_br_block_t;
    96111
    97112#endif
    98113
     114/** @}
     115 */
Note: See TracChangeset for help on using the changeset viewer.