package mbr-format

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type
type t = private {
  1. active : bool;
    (*

    true means the partition is active, also known as bootable

    *)
  2. first_absolute_sector_chs : Geometry.t;
    (*

    the CHS address of the first data sector. This is only used by BIOSes with pre-LBA disks (< 1996). This will not be marshalled.

    *)
  3. ty : int;
    (*

    the advertised filesystem type

    *)
  4. last_absolute_sector_chs : Geometry.t;
    (*

    the CHS address of the last data sector. This is only used by BIOSes with pre-LBA disks (< 1996). This will not be marshalled.

    *)
  5. first_absolute_sector_lba : int32;
    (*

    the Logical Block Address (LBA) of the first data sector. This is the absolute sector offset of the first data sector.

    *)
  6. sectors : int32;
    (*

    the total number of sectors in the partition

    *)
}

a primary partition within the partition table

val sector_start : t -> int64

sector_start t is the int64 representation of t.first_absolute_sector_lba.

val size_sectors : t -> int64

size_sectors t is the int64 representation of t.sectors.

val make : ?active:bool -> partition_type:int -> int32 -> int32 -> (t, string) Stdlib.result

make ?active ~partition_type start length creates a partition starting at sector start and with length length sectors. If the active flag is set then the partition will be marked as active/bootable. Partition type ty determines the advertised filesystem type. ty must be between 1 and 255.

val make' : ?active:bool -> partition_type:int -> int64 -> int64 -> (t, string) Stdlib.result

make' ?active ~partition_type sector_start size_sectors is make ?active ~partition_type (Int64.to_int32 sector_start) (Int64.to_int32 size_sectors) when both sector_start and size_sectors fit in int32. Otherwise Error _.

val unmarshal : Cstruct.t -> (t option, string) Stdlib.result

unmarshal buf is the partition entry encoded in the beginning of buf. If it is the empty partition entry None is returned.

OCaml

Innovation. Community. Security.