Skip to content

Commit

Permalink
Merge pull request #77 from hannesm/no-result
Browse files Browse the repository at this point in the history
remove open Result
  • Loading branch information
djs55 authored Sep 9, 2018
2 parents 509bf01 + 397e497 commit f190d3f
Show file tree
Hide file tree
Showing 10 changed files with 12 additions and 21 deletions.
8 changes: 4 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ env:
- PINS="fat-filesystem:."
- DISTRO="debian-stable"
matrix:
- PACKAGE="fat-filesystem" OCAML_VERSION="4.03.0"
- PACKAGE="fat-filesystem" OCAML_VERSION="4.04.2"
- PACKAGE="fat-filesystem" OCAML_VERSION="4.05.0"
- PACKAGE="fat-filesystem" OCAML_VERSION="4.06.0"
- PACKAGE="fat-filesystem" OCAML_VERSION="4.03"
- PACKAGE="fat-filesystem" OCAML_VERSION="4.04"
- PACKAGE="fat-filesystem" OCAML_VERSION="4.05"
- PACKAGE="fat-filesystem" OCAML_VERSION="4.06"
11 changes: 5 additions & 6 deletions bin/impl.ml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*)
open Lwt.Infix
open Result
open Mirage_fs

module Filesystem = Fat.FS(Block)
Expand All @@ -31,11 +30,11 @@ let (>>*=) m f = m >>= function
| Ok x -> f x

let rec iter_s f = function
| [] -> Lwt.return (Result.Ok ())
| [] -> Lwt.return (Ok ())
| x :: xs ->
f x >>= function
| Result.Error e -> Lwt.return (Result.Error e)
| Result.Ok () -> iter_s f xs
| Error e -> Lwt.return (Error e)
| Ok () -> iter_s f xs

let alloc bytes =
let pages = Io_page.(to_cstruct (get ((bytes + 4095) / 4096))) in
Expand Down Expand Up @@ -65,8 +64,8 @@ let copy_file_in fs outside inside =
let frag = Cstruct.sub block 0 this in
Block.really_read ifd frag >>= fun () ->
Filesystem.write fs inside offset frag >>= function
| Result.Ok () -> loop (offset + this) (remaining - this)
| Result.Error e ->
| Ok () -> loop (offset + this) (remaining - this)
| Error e ->
let b = Buffer.create 20 in
let ppf = Format.formatter_of_buffer b in
let k ppf =
Expand Down
1 change: 0 additions & 1 deletion bin/shell.ml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
(* This is a toplevel-like test program *)
open Lwt.Infix
open Mirage_fs
open Result

module Test = Fat.FS(Block)

Expand Down
1 change: 0 additions & 1 deletion fat-filesystem.opam
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ depends: [
"cstruct" {>= "3.0.0"}
"ppx_tools" {build}
"ppx_cstruct" {build}
"result"
"rresult"
"lwt" {>= "2.4.3"}
"mirage-fs" {>= "1.0.0"}
Expand Down
2 changes: 1 addition & 1 deletion src/fat.mli
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,6 @@ module FS (B: Mirage_block_lwt.S): sig
]
include Mirage_fs_lwt.S with type error := error and type write_error := write_error
val connect : B.t -> t Lwt.t
val format : B.t -> int64 -> (t, write_error) Result.result Lwt.t
val format : B.t -> int64 -> (t, write_error) result Lwt.t

end
2 changes: 0 additions & 2 deletions src/fat_boot_sector.ml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*)

open Result

type t = {
oem_name: string;
bytes_per_sector: int; (* usually 512 *)
Expand Down
4 changes: 1 addition & 3 deletions src/fat_boot_sector.mli
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*)

open Result

type t = {
oem_name: string;
bytes_per_sector: int;
Expand Down Expand Up @@ -49,7 +47,7 @@ val sectors_of_cluster: t -> int -> int list
val clusters: t -> int
(** Return the number of clusters *)

val detect_format: t -> (Fat_format.t, string) Result.result
val detect_format: t -> (Fat_format.t, string) result
(* Choose between FAT12, FAT16 and FAT32 using heuristic from:
http://averstak.tripod.com/fatdox/bootsec.htm *)

Expand Down
1 change: 0 additions & 1 deletion src/fat_fs.ml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
open Lwt.Infix
open Mirage_block
open Mirage_fs
open Result

type fs = {
boot : Fat_boot_sector.t;
Expand Down
2 changes: 1 addition & 1 deletion src/fat_fs.mli
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,6 @@ module Make (B: Mirage_block_lwt.S): sig
and type write_error := write_error

val connect : B.t -> t Lwt.t
val format : B.t -> int64 -> (t, write_error) Result.result Lwt.t
val format : B.t -> int64 -> (t, write_error) result Lwt.t

end
1 change: 0 additions & 1 deletion test/test.ml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

open Lwt.Infix
open Block
open Result
open Mirage_fs

module MemFS = Fat.FS(Mirage_block_lwt.Mem)
Expand Down

0 comments on commit f190d3f

Please sign in to comment.