search for: fold_left

Displaying 20 results from an estimated 162 matches for "fold_left".

2014 Oct 08
0
[PATCH V5 3/4] resize: support resize extended partition
...size.ml b/resize/resize.ml index fc622ba..80a37e2 100644 --- a/resize/resize.ml +++ b/resize/resize.ml @@ -749,12 +749,33 @@ read the man page virt-resize(1). start_overhead_sects +^ alignment_sects +^ gpt_end_sects in sectsize *^ overhead_sects in + let required_logical = List.fold_left ( + fun total p -> + let newsize = + match p.p_operation with + | OpCopy | OpIgnore -> roundup64 p.p_part.G.part_size (alignment *^ sectsize) + | OpDelete -> 0L + | OpResize newsize -> roundup64 newsize (alignment *^ sectsize) in +...
2014 Oct 08
6
[PATCH V5 0/4] virt-resize: add support for resizing logical
Hi Rich, This is v5 series to add support for resizing MBR logical partitions. please review. Thanks! changes to v4: 1. add support to resize extended partition (--resize or --expand extended partition) 2. fix the problem of deficit of 512 bytes when expanding a logical partition (this problem can be reproduced in v4 by only expanding a logical partition, without resizing any other
2014 Sep 26
0
[RFC PATCH v4 7/7] resize: support resize extended partition
...esize.ml b/resize/resize.ml index a5cc7e5..c45d058 100644 --- a/resize/resize.ml +++ b/resize/resize.ml @@ -749,6 +749,24 @@ read the man page virt-resize(1). start_overhead_sects +^ alignment_sects +^ gpt_end_sects in sectsize *^ overhead_sects in + let required_logical = List.fold_left ( + fun total p -> + let newsize = + match p.p_operation with + | OpCopy | OpIgnore -> roundup64 p.p_part.G.part_size (alignment *^ sectsize) + | OpDelete -> 0L + | OpResize newsize -> roundup64 newsize (alignment *^ sectsize) in +...
2014 Sep 22
0
[PATCH v3 7/7] resize: add support to resize logical partitions
...rtitions; fun ~option name -> let name = if String.length name < 5 || String.sub name 0 5 <> "/dev/" then @@ -719,8 +721,10 @@ read the man page virt-resize(1). (* We need some overhead for partitioning. *) let overhead = let maxl64 = List.fold_left max 0L in + let alignment = if alignment = 1L then 2L else alignment in let nr_partitions = List.length partitions in + let nr_partitions = nr_partitions + List.length logical_partitions in let gpt_start_sects = 64L in let gpt_end_sects = gpt_start_sects in @@ -74...
2014 Oct 08
0
[PATCH V5 2/4] resize: add support to resize logical partitions
...rtitions; fun ~option name -> let name = if String.length name < 5 || String.sub name 0 5 <> "/dev/" then @@ -719,8 +721,10 @@ read the man page virt-resize(1). (* We need some overhead for partitioning. *) let overhead = let maxl64 = List.fold_left max 0L in + let alignment = if alignment = 1L then 2L else alignment in let nr_partitions = List.length partitions in + let nr_partitions = nr_partitions + List.length logical_partitions in let gpt_start_sects = 64L in let gpt_end_sects = gpt_start_sects in @@ -74...
2015 May 28
2
Re: [PATCH v2 04/11] resize: add support for logical partitions for calculate_surplus
...a/resize/resize.ml b/resize/resize.ml > index 92f7304..a0ed713 100644 > --- a/resize/resize.ml > +++ b/resize/resize.ml > @@ -741,8 +741,10 @@ read the man page virt-resize(1). > (* We need some overhead for partitioning. *) > let overhead = > let maxl64 = List.fold_left max 0L in > + (* We need at least 1 sector gap between logical partitions *) > + let alignment = if alignment = 1L then 2L else alignment in > > - let nr_partitions = List.length partitions in > + let nr_partitions = List.length partitions + List.length logical_...
2014 Oct 30
8
[PATCH v5 REBASE 0/4] virt-resize: add support for resizing logical
Hi Rich, This is rebase of v5 series. Meanwhile, I found a bug when shrinking partitions, and the fix is incuded in this version (patch 2). Regards, Hu changes to v4: 1. add support to resize extended partition (--resize or --expand extended partition) 2. fix the problem of deficit of 512 bytes when expanding a logical partition (this problem can be reproduced in v4 by only expanding a
2015 May 20
15
[PATCH v2 00/11] virt-resize: add support for resizing MBR logical partitions
In current virt-resize, only primary partitions(including extended partition) are supported. They are collected in an array for resize operations. Logical partitions are not supported. This series add support for resizing logical partitions. v2: 1) Add 3 variables to describe relationship of logical and extended partitions: - partitions flat list of primary partitions (as now, the global
2015 May 20
0
[PATCH v2 04/11] resize: add support for logical partitions for calculate_surplus
...ons(+), 2 deletions(-) diff --git a/resize/resize.ml b/resize/resize.ml index 92f7304..a0ed713 100644 --- a/resize/resize.ml +++ b/resize/resize.ml @@ -741,8 +741,10 @@ read the man page virt-resize(1). (* We need some overhead for partitioning. *) let overhead = let maxl64 = List.fold_left max 0L in + (* We need at least 1 sector gap between logical partitions *) + let alignment = if alignment = 1L then 2L else alignment in - let nr_partitions = List.length partitions in + let nr_partitions = List.length partitions + List.length logical_partitions in le...
2014 Mar 20
3
[PATCH 1/2] builder: allow the index parser to parse files with no sections
Gracefully handle files with no sections; extend the validate.sh test to try to validate an empty file. --- builder/index-parse.y | 2 ++ builder/website/validate.sh | 7 +++++++ 2 files changed, 9 insertions(+) diff --git a/builder/index-parse.y b/builder/index-parse.y index 9355bd4..5133959 100644 --- a/builder/index-parse.y +++ b/builder/index-parse.y @@ -108,6 +108,8 @@ sections:
2015 Jun 03
13
[PATCH v3 00/11] virt-resize: add support for resizing MBR logical partitions
In current virt-resize, only primary partitions(including extended partition) are supported. They are collected in an array for resize operations. Logical partitions are not supported. This series add support for resizing logical partitions. v3: 1) rewrite partitions/logical_partitions/extended_partition section by the comments from Rich and Pino. 2) in 03/11 introduce logical_align for
2015 Jun 17
13
[PATCH v4 00/11] virt-resize: add support for resizing MBR logical partitions
In current virt-resize, only primary partitions(including extended partition) are supported. They are collected in an array for resize operations. Logical partitions are not supported. This series add support for resizing logical partitions. v4: rebase on upstream. v3: 1) rewrite partitions/logical_partitions/extended_partition section by the comments from Rich and Pino. 2) in 03/11
2015 Jul 06
13
[PATCH rebase v4 00/11] virt-resize: add support for resizing MBR logical partitions
In current virt-resize, only primary partitions(including extended partition) are supported. They are collected in an array for resize operations. Logical partitions are not supported. This series add support for resizing logical partitions. v4: rebase on upstream. v3: 1) rewrite partitions/logical_partitions/extended_partition section by the comments from Rich and Pino. 2) in 03/11
2016 Feb 22
2
Re: [PATCH v2 4/4] v2v: in-place: request caps based on source config
...overlays > > +and rcaps_from_source source = > + (* Request guest caps based on source configuration. *) > + > + (* rely on s_controller enum being in ascending preference order, and None > + * being smaller than Some anything *) > + let best_block_type = > + List.fold_left max None > + (List.map (fun sd -> sd.s_controller) source.s_disks) in > + let block_type = > + match best_block_type with > + | Some Source_virtio_blk -> Some Virtio_blk > + | Some Source_SCSI -> None > + | Some Source_IDE -> Some IDE > + | None...
2016 Feb 24
0
Re: [PATCH v2 4/4] v2v: in-place: request caps based on source config
...ps_from_source source = > > + (* Request guest caps based on source configuration. *) > > + > > + (* rely on s_controller enum being in ascending preference order, and None > > + * being smaller than Some anything *) > > + let best_block_type = > > + List.fold_left max None > > + (List.map (fun sd -> sd.s_controller) source.s_disks) in > > + let block_type = > > + match best_block_type with > > + | Some Source_virtio_blk -> Some Virtio_blk > > + | Some Source_SCSI -> None > > + | Some Source_IDE -...
2019 Aug 10
0
[PATCH libnbd 8/9] generator: Enhance Flags/OFlags with optional "all flags" mask.
...s_bitmask; flags } -> List.iter ( fun (flag, i) -> let flag = sprintf "LIBNBD_%s_%s" flag_prefix flag in pr "#define %-40s %d\n" flag i ) flags; - pr "\n" + if all_flags_bitmask then ( + let all = List.fold_left (lor) 0 (List.map snd flags) in + let n = sprintf "LIBNBD_%s_ALL" flag_prefix in + pr "#define %-40s %d\n" n all; + ); + pr "\n"; ) all_flags; List.iter ( fun (n, i) -> @@ -4606,12 +4613,17 @@ Error.__str__ = _str pr "\...
2017 Jul 20
1
Re: [PATCH 19/27] daemon: Reimplement ‘list_filesystems’ API in the daemon, in OCaml.
...ems > + * (RHBZ#590167). However vfs-type will fail to tell us anything > + * useful about devices which just contain partitions, so we also > + * get the list of partitions and exclude the corresponding devices > + * by using part-to-dev. > + *) > + let devices = List.fold_left ( > + fun devices part -> > + let d = Devsparts.part_to_dev part in > + List.filter ((<>) d) devices > + ) devices partitions in Hm it took me a couple of reading to get it -- what would you think about the following (untested): module StringSet = Set.Make (St...
2018 Jan 23
2
Re: [RFC PATCH v1 3/3] daemon: list-filesystems: Don't list partitioned md devices
...ut devices which just contain partitions, so we also > - * get the list of partitions and exclude the corresponding devices > - * by using part-to-dev. > + * get the list of partitions and exclude the corresponding devices. > *) > - let devices_containing_partitions = List.fold_left ( > - fun set part -> > - StringSet.add (Devsparts.part_to_dev part) set > - ) StringSet.empty partitions in > - let devices = List.filter ( > - fun dev -> > - not (StringSet.mem dev devices_containing_partitions) > - ) devices in > + let device_wit...
2016 Feb 09
0
[PATCH 4/4] v2v: in-place: request caps based on source config
...g-overlays]\n") saved_filename ) overlays +and rcaps_from_source source = + (* Request guest caps based on source configuration. *) + + (* rely on s_controller enum being in ascending preference order, and None + * being smaller than Some anything *) + let best_block_type = + List.fold_left max None + (List.map (fun sd -> sd.s_controller) source.s_disks) in + let block_type = + match best_block_type with + | Some Source_virtio_blk -> Some Virtio_blk + | Some Source_SCSI -> None + | Some Source_IDE -> Some IDE + | None -> None in + + (* rely on s_ni...
2016 Feb 20
0
[PATCH v2 4/4] v2v: in-place: request caps based on source config
...g-overlays]\n") saved_filename ) overlays +and rcaps_from_source source = + (* Request guest caps based on source configuration. *) + + (* rely on s_controller enum being in ascending preference order, and None + * being smaller than Some anything *) + let best_block_type = + List.fold_left max None + (List.map (fun sd -> sd.s_controller) source.s_disks) in + let block_type = + match best_block_type with + | Some Source_virtio_blk -> Some Virtio_blk + | Some Source_SCSI -> None + | Some Source_IDE -> Some IDE + | None -> None in + + (* rely on s_ni...