package mirage-block-partition
Mirage block device partitioning
Install
Dune Dependency
Authors
Maintainers
Sources
mirage-block-partition-0.2.0.tbz
sha256=7173ad10ff70864846423ebd4f868a7b16e67ba85f54056a0c56bd91fe960171
sha512=665726cfe861c3de311a61591a03574e512f36ba81193451bece340b022e0a1b9a1a492132a1ae722c3439c44689a22763a83b5a9bb0dd8079c2ca5c4cdc249a
doc/src/mirage-block-partition.mbr/mirage_block_partition_mbr.ml.html
Source file mirage_block_partition_mbr.ml
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
module Make (B : Mirage_block.S) = struct module P = Mirage_block_partition.Make (B) include P let subpartition b (mbr : Mbr.t) = let ( let* ) = Result.bind in let* partitions = List.fold_left (fun acc p -> let* acc = acc in let start = Mbr.Partition.sector_start p in let len = Mbr.Partition.size_sectors p in let* p' = P.subpartition ~start ~len b in Ok ((p, p') :: acc)) (Ok []) mbr.partitions in Ok (List.rev partitions) let connect b = let open Lwt.Syntax in let* { Mirage_block.sector_size; _ } = B.get_info b in (* XXX: MBRs *usually* expect a sector size of 512 bytes, and a lot of software will not behave correctly if sector size != 512. *) if sector_size <> Mbr.sizeof then Printf.ksprintf invalid_arg "Bad sector size: %d" sector_size; let* b = P.connect b in let buf = Cstruct.create Mbr.sizeof in let* r = P.read b 0L [ buf ] in (match r with | Error e -> Format.kasprintf failwith "MBR read error: %a" pp_error e | Ok () -> ()); match Mbr.unmarshal buf with | Error e -> Printf.ksprintf Lwt.fail_with "Bad MBR: %s" e | Ok mbr -> Lwt.return (subpartition b mbr) end
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>