From f7d2b1e53a028a1788e740ec941285272ebe1913 Mon Sep 17 00:00:00 2001 From: Jeremy Yallop Date: Fri, 31 Mar 2017 15:19:51 +0100 Subject: [PATCH 1/4] Move Profuse_7_8 type signatures to Profuse_signatures module. --- lib/profuse_7_8.mli | 50 +++------------------------------------ lib/profuse_signatures.ml | 50 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 53 insertions(+), 47 deletions(-) diff --git a/lib/profuse_7_8.mli b/lib/profuse_7_8.mli index be99536..716dafc 100644 --- a/lib/profuse_7_8.mli +++ b/lib/profuse_7_8.mli @@ -4,53 +4,9 @@ module Types : sig type 'a structure = 'a Ctypes_static.structure open Profuse_signatures.Types_7_8 - module Struct : sig - open Struct - module Kstatfs : Kstatfs - module File_lock : File_lock - module Attr : Attr - module Dirent : Dirent - end - - module Out : sig - open Out - module Hdr : Hdr - module Write : Write - module Open : Open - module Init : Init - module Entry : Entry with type struct_attr_t := Struct.Attr.t - module Attr : Attr with type struct_attr_t := Struct.Attr.t - module Statfs : Statfs with type struct_kstatfs_t := Struct.Kstatfs.t - module Getxattr : Getxattr - module Lk : Lk with type struct_file_lock_t := Struct.File_lock.t - module Bmap : Bmap - end - - module In : sig - open In - module Opcode : Opcode - module Hdr : Hdr - module Init : Init - module Open : Open - module Read : Read - module Release : Release - module Access : Access - module Forget : Forget - module Flush : Flush - module Create : Create - module Mknod : Mknod - module Mkdir : Mkdir - module Rename : Rename - module Link : Link - module Write : Write - module Fsync : Fsync - module Lk : Lk with type struct_file_lock_t := Struct.File_lock.t - module Interrupt : Interrupt - module Bmap : Bmap - module Setattr : Setattr - module Getxattr : Getxattr - module Setxattr : Setxattr - end + module Struct : Profuse_signatures.Types_7_8_struct + module Out : Profuse_signatures.Types_7_8_out with module Struct := Struct + module In : Profuse_signatures.Types_7_8_in with module Struct := Struct end type 'a structure = 'a Types.structure diff --git a/lib/profuse_signatures.ml b/lib/profuse_signatures.ml index f01d853..ff8432e 100644 --- a/lib/profuse_signatures.ml +++ b/lib/profuse_signatures.ml @@ -536,6 +536,56 @@ module Types_7_8 = struct end end +module type Types_7_8_struct = sig + open Types_7_8.Struct + module Kstatfs : Kstatfs + module File_lock : File_lock + module Attr : Attr + module Dirent : Dirent +end + +module type Types_7_8_out = sig + module Struct : Types_7_8_struct + open Types_7_8.Out + module Hdr : Hdr + module Write : Write + module Open : Open + module Init : Init + module Entry : Entry with type struct_attr_t := Struct.Attr.t + module Attr : Attr with type struct_attr_t := Struct.Attr.t + module Statfs : Statfs with type struct_kstatfs_t := Struct.Kstatfs.t + module Getxattr : Getxattr + module Lk : Lk with type struct_file_lock_t := Struct.File_lock.t + module Bmap : Bmap +end + +module type Types_7_8_in = sig + module Struct : Types_7_8_struct + open Types_7_8.In + module Opcode : Opcode + module Hdr : Hdr + module Init : Init + module Open : Open + module Read : Read + module Release : Release + module Access : Access + module Forget : Forget + module Flush : Flush + module Create : Create + module Mknod : Mknod + module Mkdir : Mkdir + module Rename : Rename + module Link : Link + module Write : Write + module Fsync : Fsync + module Lk : Lk with type struct_file_lock_t := Struct.File_lock.t + module Interrupt : Interrupt + module Bmap : Bmap + module Setattr : Setattr + module Getxattr : Getxattr + module Setxattr : Setxattr +end + module Types_7_23 = struct type 'a structure = 'a Ctypes_static.structure From b0d3750a3b08d65b01a41cb53f2c4ed088f77258 Mon Sep 17 00:00:00 2001 From: Jeremy Yallop Date: Fri, 31 Mar 2017 16:50:14 +0100 Subject: [PATCH 2/4] Move Profuse_7_8.In signature to Profuse_signatures. --- lib/profuse_7_8.mli | 237 +---------------------- lib/profuse_signatures.ml | 386 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 391 insertions(+), 232 deletions(-) diff --git a/lib/profuse_7_8.mli b/lib/profuse_7_8.mli index 716dafc..cabea21 100644 --- a/lib/profuse_7_8.mli +++ b/lib/profuse_7_8.mli @@ -85,238 +85,11 @@ module Struct : sig end end -module In : sig - module T = Types.In - - module Opcode : sig - module T = T.Opcode - - type t = T.t - - val to_string : t -> string - - val returns : t -> bool - - val of_uint32 : Unsigned.uint32 -> t - - val to_uint32 : t -> Unsigned.uint32 - end - - module Hdr : sig - module T = T.Hdr - - val sz : int - - val packet : - opcode:Opcode.t -> - unique:Unsigned.uint64 -> - nodeid:Unsigned.uint64 -> - uid:Unsigned.uint32 -> - gid:Unsigned.uint32 -> - pid:Unsigned.uint32 -> count:int -> char Ctypes.CArray.t - - val make : - opcode:Opcode.t -> - unique:Unsigned.uint64 -> - nodeid:Unsigned.uint64 -> - uid:Unsigned.uint32 -> - gid:Unsigned.uint32 -> pid:Unsigned.uint32 -> 'a Ctypes.typ -> 'a - - val memcpy : - dest:unit Ctypes.ptr -> src:unit Ctypes.ptr -> int -> unit - - val packet_from_hdr : - T.t structure -> - count:int -> char Ctypes.CArray.t - - val make_from_hdr : - T.t structure -> 'a Ctypes.typ -> 'a - end - - module Init : sig - module T = T.Init - end - - module Open : sig - module T = T.Open - end - - module Read : sig - module T = T.Read - end - - module Release : sig - module T = T.Release - end - - module Access : sig - module T = T.Access - end - - module Forget : sig - module T = T.Forget - end - - module Flush : sig - module T = T.Flush - end - - module Create : sig - module T = T.Create - - val name : unit Ctypes.ptr -> string - end - - module Mknod : sig - module T = T.Mknod - - val name : unit Ctypes.ptr -> string - end - - module Mkdir : sig - module T = T.Mkdir - - val name : unit Ctypes.ptr -> string - end - - module Rename : sig - module T = T.Rename - - val source_destination : unit Ctypes.ptr -> string * string - end - - module Link : sig - module T = T.Link - - val name : unit Ctypes.ptr -> string - end - - module Write : sig - module T = T.Write - end - - module Fsync : sig - module T = T.Fsync - end - - module Lk : sig - module T = T.Lk - end - - module Interrupt : sig - module T = T.Interrupt - end - - module Bmap : sig - module T = T.Bmap - end - - module Setattr : sig - module T = T.Setattr - - module Valid : sig - module T = T.Valid - - type t = { - mode : bool; - uid : bool; - gid : bool; - size : bool; - atime : bool; - mtime : bool; - fh : bool; - unknown : int32; - (*atime_now : bool; - mtime_now : bool; - lockowner : bool;*) - } - - val to_string_list : t -> string list - - val of_uint32 : Unsigned.uint32 -> t - - val to_uint32 : t -> Unsigned.uint32 - end - - val create_from_hdr : - valid:Unsigned.uint32 -> - fh:Unsigned.uint64 -> - size:Unsigned.uint64 -> - atime:Unsigned.uint64 -> - mtime:Unsigned.uint64 -> - atimensec:Unsigned.uint32 -> - mtimensec:Unsigned.uint32 -> - mode:Unsigned.uint32 -> - uid:Unsigned.uint32 -> - gid:Unsigned.uint32 -> - Hdr.T.t structure -> char Ctypes.CArray.t - end - - module Getxattr : sig - module T = T.Getxattr - - val create_from_hdr : - size:Unsigned.uint32 -> - Hdr.T.t structure -> char Ctypes.CArray.t - end - - module Setxattr : sig - module T = T.Setxattr - - val create_from_hdr : - size:Unsigned.uint32 -> - flags:Unsigned.uint32 -> - Hdr.T.t structure -> char Ctypes.CArray.t - end - - module Message : sig - type t = - | Init of Init.T.t Ctypes.structure - | Getattr - | Lookup of string - | Opendir of Open.T.t Ctypes.structure - | Readdir of Read.T.t Ctypes.structure - | Releasedir of Release.T.t Ctypes.structure - | Fsyncdir of Fsync.T.t Ctypes.structure - | Rmdir of string - | Getxattr of Getxattr.T.t Ctypes.structure * string - | Setxattr of Setxattr.T.t Ctypes.structure * string - | Listxattr of Getxattr.T.t Ctypes.structure - | Removexattr of string - | Access of Access.T.t Ctypes.structure - | Forget of Forget.T.t Ctypes.structure - | Readlink - | Open of Open.T.t Ctypes.structure - | Read of Read.T.t Ctypes.structure - | Write of Write.T.t structure * char Ctypes.ptr - | Statfs - | Flush of Flush.T.t Ctypes.structure - | Release of Release.T.t Ctypes.structure - | Fsync of Fsync.T.t Ctypes.structure - | Unlink of string - | Create of Create.T.t Ctypes.structure * string - | Mknod of Mknod.T.t Ctypes.structure * string - | Mkdir of Mkdir.T.t Ctypes.structure * string - | Setattr of Setattr.T.t Ctypes.structure - | Link of Link.T.t Ctypes.structure * string - | Symlink of string * string - | Rename of Rename.T.t Ctypes.structure * string * string - | Getlk of Lk.T.t Ctypes.structure - | Setlk of Lk.T.t Ctypes.structure - | Setlkw of Lk.T.t Ctypes.structure - | Interrupt of Interrupt.T.t Ctypes.structure - | Bmap of Bmap.T.t Ctypes.structure - | Destroy - | Other of Opcode.t - | Unknown of int32 - - val parse : - chan -> Hdr.T.t Ctypes.structure -> int -> unit Ctypes.ptr - -> (Hdr.T.t, t) packet - - val describe : (Hdr.T.t, t) packet -> string - end -end +module In : Profuse_signatures.Signatures_7_8_in + with module Struct := Types.Struct + with module T = Types.In + and type chan := chan + and type ('h, 'b) packet := ('h, 'b) packet type 'a request = (In.Hdr.T.t, 'a) packet diff --git a/lib/profuse_signatures.ml b/lib/profuse_signatures.ml index ff8432e..e645dad 100644 --- a/lib/profuse_signatures.ml +++ b/lib/profuse_signatures.ml @@ -760,3 +760,389 @@ struct module type Bmap = Bmap end end + +module Signatures_7_8 = +struct + type 'a structure = 'a Ctypes.structure + + module In = struct + module type Opcode = sig + module Struct : Types_7_8_struct + module Types : Types_7_8_in with module Struct := Struct + module T = Types.Opcode + + type t = T.t + + val to_string : t -> string + + val returns : t -> bool + + val of_uint32 : Unsigned.uint32 -> t + + val to_uint32 : t -> Unsigned.uint32 + end + + module type Hdr = sig + module Struct : Types_7_8_struct + module Types : Types_7_8_in with module Struct := Struct + module T = Types.Hdr + + type opcode_t + + val sz : int + + val packet : + opcode:opcode_t -> + unique:Unsigned.uint64 -> + nodeid:Unsigned.uint64 -> + uid:Unsigned.uint32 -> + gid:Unsigned.uint32 -> + pid:Unsigned.uint32 -> count:int -> char Ctypes.CArray.t + + val make : + opcode:opcode_t -> + unique:Unsigned.uint64 -> + nodeid:Unsigned.uint64 -> + uid:Unsigned.uint32 -> + gid:Unsigned.uint32 -> pid:Unsigned.uint32 -> 'a Ctypes.typ -> 'a + + val memcpy : + dest:unit Ctypes.ptr -> src:unit Ctypes.ptr -> int -> unit + + val packet_from_hdr : + T.t structure -> + count:int -> char Ctypes.CArray.t + + val make_from_hdr : + T.t structure -> 'a Ctypes.typ -> 'a + end + + module type Init = sig + module Struct : Types_7_8_struct + module Types : Types_7_8_in with module Struct := Struct + + module T = Types.Init + end + + module type Open = sig + module Struct : Types_7_8_struct + module Types : Types_7_8_in with module Struct := Struct + module T = Types.Open + + end + + module type Read = sig + module Struct : Types_7_8_struct + module Types : Types_7_8_in with module Struct := Struct + module T = Types.Read + + end + + module type Release = sig + module Struct : Types_7_8_struct + module Types : Types_7_8_in with module Struct := Struct + module T = Types.Release + + end + + module type Access = sig + module Struct : Types_7_8_struct + module Types : Types_7_8_in with module Struct := Struct + module T = Types.Access + + end + + module type Forget = sig + module Struct : Types_7_8_struct + module Types : Types_7_8_in with module Struct := Struct + module T = Types.Forget + + end + + module type Flush = sig + module Struct : Types_7_8_struct + module Types : Types_7_8_in with module Struct := Struct + module T = Types.Flush + + end + + module type Create = sig + module Struct : Types_7_8_struct + module Types : Types_7_8_in with module Struct := Struct + module T = Types.Create + + val name : unit Ctypes.ptr -> string + end + + module type Mknod = sig + module Struct : Types_7_8_struct + module Types : Types_7_8_in with module Struct := Struct + module T = Types.Mknod + + val name : unit Ctypes.ptr -> string + end + + module type Mkdir = sig + module Struct : Types_7_8_struct + module Types : Types_7_8_in with module Struct := Struct + module T = Types.Mkdir + + val name : unit Ctypes.ptr -> string + end + + module type Rename = sig + module Struct : Types_7_8_struct + module Types : Types_7_8_in with module Struct := Struct + module T = Types.Rename + + val source_destination : unit Ctypes.ptr -> string * string + end + + module type Link = sig + module Struct : Types_7_8_struct + module Types : Types_7_8_in with module Struct := Struct + module T = Types.Link + + val name : unit Ctypes.ptr -> string + end + + module type Write = sig + module Struct : Types_7_8_struct + module Types : Types_7_8_in with module Struct := Struct + module T = Types.Write + + end + + module type Fsync = sig + module Struct : Types_7_8_struct + module Types : Types_7_8_in with module Struct := Struct + module T = Types.Fsync + + end + + module type Lk = sig + module Struct : Types_7_8_struct + module Types : Types_7_8_in with module Struct := Struct + module T = Types.Lk + + end + + module type Interrupt = sig + module Struct : Types_7_8_struct + module Types : Types_7_8_in with module Struct := Struct + module T = Types.Interrupt + + end + module type Bmap = sig + module Struct : Types_7_8_struct + module Types : Types_7_8_in with module Struct := Struct + module T = Types.Bmap + + end + + module type Setattr = sig + module Struct : Types_7_8_struct + module Types : Types_7_8_in with module Struct := Struct + module T = Types.Setattr + + module Valid : sig + module T = T.Valid + + type t = { + mode : bool; + uid : bool; + gid : bool; + size : bool; + atime : bool; + mtime : bool; + fh : bool; + unknown : int32; + (*atime_now : bool; + mtime_now : bool; + lockowner : bool;*) + } + + val to_string_list : t -> string list + + val of_uint32 : Unsigned.uint32 -> t + + val to_uint32 : t -> Unsigned.uint32 + end + + type hdr_t + + val create_from_hdr : + valid:Unsigned.uint32 -> + fh:Unsigned.uint64 -> + size:Unsigned.uint64 -> + atime:Unsigned.uint64 -> + mtime:Unsigned.uint64 -> + atimensec:Unsigned.uint32 -> + mtimensec:Unsigned.uint32 -> + mode:Unsigned.uint32 -> + uid:Unsigned.uint32 -> + gid:Unsigned.uint32 -> + hdr_t structure -> char Ctypes.CArray.t + end + + module type Getxattr = sig + module Struct : Types_7_8_struct + module Types : Types_7_8_in with module Struct := Struct + module T = Types.Getxattr + + type hdr_t + + val create_from_hdr : + size:Unsigned.uint32 -> + hdr_t structure -> char Ctypes.CArray.t + end + + module type Setxattr = sig + module Struct : Types_7_8_struct + module Types : Types_7_8_in with module Struct := Struct + module T = Types.Setxattr + + type hdr_t + + val create_from_hdr : + size:Unsigned.uint32 -> + flags:Unsigned.uint32 -> + hdr_t structure -> char Ctypes.CArray.t + end + + module type Message = sig + type t + type hdr_t + type chan + type (_,_) packet + + val parse : + chan -> hdr_t Ctypes.structure -> int -> unit Ctypes.ptr + -> (hdr_t, t) packet + + val describe : (hdr_t, t) packet -> string + end + end +end + +module type Signatures_7_8_in = sig + module Struct : Types_7_8_struct + module T : Types_7_8_in with module Struct := Struct + open Signatures_7_8 + open In + + type chan + type ('h, 'b) packet + + module Opcode : Opcode + with module Struct := Struct + with module Types := T + module Hdr : Hdr with type opcode_t := Opcode.t + with module Struct := Struct + with module Types := T + module Init : Init + with module Struct := Struct + with module Types := T + module Open : Open + with module Struct := Struct + with module Types := T + module Read : Read + with module Struct := Struct + with module Types := T + module Release : Release + with module Struct := Struct + with module Types := T + module Access : Access + with module Struct := Struct + with module Types := T + module Forget : Forget + with module Struct := Struct + with module Types := T + module Flush : Flush + with module Struct := Struct + with module Types := T + module Create : Create + with module Struct := Struct + with module Types := T + module Mknod : Mknod + with module Struct := Struct + with module Types := T + module Mkdir : Mkdir + with module Struct := Struct + with module Types := T + module Rename : Rename + with module Struct := Struct + with module Types := T + module Link : Link + with module Struct := Struct + with module Types := T + module Write : Write + with module Struct := Struct + with module Types := T + module Fsync : Fsync + with module Struct := Struct + with module Types := T + module Lk : Lk + with module Struct := Struct + with module Types := T + module Interrupt : Interrupt + with module Struct := Struct + with module Types := T + module Bmap : Bmap + with module Struct := Struct + with module Types := T + module Setattr : Setattr with type hdr_t := Hdr.T.t + with module Struct := Struct + with module Types := T + module Getxattr : Getxattr with type hdr_t := Hdr.T.t + with module Struct := Struct + with module Types := T + module Setxattr : Setxattr with type hdr_t := Hdr.T.t + with module Struct := Struct + with module Types := T + module Message : sig + type t = + | Init of Init.T.t Ctypes.structure + | Getattr + | Lookup of string + | Opendir of Open.T.t Ctypes.structure + | Readdir of Read.T.t Ctypes.structure + | Releasedir of Release.T.t Ctypes.structure + | Fsyncdir of Fsync.T.t Ctypes.structure + | Rmdir of string + | Getxattr of Getxattr.T.t Ctypes.structure * string + | Setxattr of Setxattr.T.t Ctypes.structure * string + | Listxattr of Getxattr.T.t Ctypes.structure + | Removexattr of string + | Access of Access.T.t Ctypes.structure + | Forget of Forget.T.t Ctypes.structure + | Readlink + | Open of Open.T.t Ctypes.structure + | Read of Read.T.t Ctypes.structure + | Write of Write.T.t structure * char Ctypes.ptr + | Statfs + | Flush of Flush.T.t Ctypes.structure + | Release of Release.T.t Ctypes.structure + | Fsync of Fsync.T.t Ctypes.structure + | Unlink of string + | Create of Create.T.t Ctypes.structure * string + | Mknod of Mknod.T.t Ctypes.structure * string + | Mkdir of Mkdir.T.t Ctypes.structure * string + | Setattr of Setattr.T.t Ctypes.structure + | Link of Link.T.t Ctypes.structure * string + | Symlink of string * string + | Rename of Rename.T.t Ctypes.structure * string * string + | Getlk of Lk.T.t Ctypes.structure + | Setlk of Lk.T.t Ctypes.structure + | Setlkw of Lk.T.t Ctypes.structure + | Interrupt of Interrupt.T.t Ctypes.structure + | Bmap of Bmap.T.t Ctypes.structure + | Destroy + | Other of Opcode.t + | Unknown of int32 + include Message with type t := t + and type hdr_t := Hdr.T.t + and type chan := chan + and type ('h, 'b) packet := ('h, 'b) packet + end +end From 551d69cab7ff325b9aa37e00226464a604b44c88 Mon Sep 17 00:00:00 2001 From: Jeremy Yallop Date: Tue, 4 Apr 2017 11:31:15 +0100 Subject: [PATCH 3/4] Move Profuse_7_8.Struct signature to Profuse_signatures. --- lib/profuse_7_8.mli | 76 +-------------------- lib/profuse_signatures.ml | 140 +++++++++++++++++++++++++++++++------- 2 files changed, 117 insertions(+), 99 deletions(-) diff --git a/lib/profuse_7_8.mli b/lib/profuse_7_8.mli index cabea21..3042ab6 100644 --- a/lib/profuse_7_8.mli +++ b/lib/profuse_7_8.mli @@ -11,79 +11,9 @@ end type 'a structure = 'a Types.structure -module Struct : sig - module T = Types.Struct - module Kstatfs : sig - module T = T.Kstatfs - - val store : - blocks:Unsigned.uint64 -> - bfree:Unsigned.uint64 -> - bavail:Unsigned.uint64 -> - files:Unsigned.uint64 -> - ffree:Unsigned.uint64 -> - bsize:Unsigned.uint32 -> - namelen:Unsigned.uint32 -> - frsize:Unsigned.uint32 -> - T.t structure -> unit - - val create : - blocks:Unsigned.uint64 -> - bfree:Unsigned.uint64 -> - bavail:Unsigned.uint64 -> - files:Unsigned.uint64 -> - ffree:Unsigned.uint64 -> - bsize:Unsigned.uint32 -> - namelen:Unsigned.uint32 -> - frsize:Unsigned.uint32 -> - unit -> T.t structure - end - - module File_lock : sig - module T = T.File_lock - end - - module Attr : sig - module T = T.Attr - - val store : - ino:Unsigned.uint64 -> - size:Unsigned.uint64 -> - blocks:Unsigned.uint64 -> - atime:Unsigned.uint64 -> - mtime:Unsigned.uint64 -> - ctime:Unsigned.uint64 -> - atimensec:Unsigned.uint32 -> - mtimensec:Unsigned.uint32 -> - ctimensec:Unsigned.uint32 -> - mode:Unsigned.uint32 -> - nlink:Unsigned.uint32 -> - uid:Unsigned.uint32 -> - gid:Unsigned.uint32 -> - rdev:Unsigned.uint32 -> - T.t structure -> unit - - val create : - ino:Unsigned.uint64 -> - size:Unsigned.uint64 -> - blocks:Unsigned.uint64 -> - atime:Unsigned.uint64 -> - mtime:Unsigned.uint64 -> - ctime:Unsigned.uint64 -> - atimensec:Unsigned.uint32 -> - mtimensec:Unsigned.uint32 -> - ctimensec:Unsigned.uint32 -> - mode:Unsigned.uint32 -> - nlink:Unsigned.uint32 -> - uid:Unsigned.uint32 -> - gid:Unsigned.uint32 -> - rdev:Unsigned.uint32 -> - unit -> T.t structure - - val describe : host:Host.t -> T.t structure -> string - - end -end +module Struct : Profuse_signatures.Signatures_7_8_struct + with module T = Types.Struct + and type host_t := Host.t module In : Profuse_signatures.Signatures_7_8_in with module Struct := Types.Struct diff --git a/lib/profuse_signatures.ml b/lib/profuse_signatures.ml index e645dad..b0dfc6c 100644 --- a/lib/profuse_signatures.ml +++ b/lib/profuse_signatures.ml @@ -765,6 +765,82 @@ module Signatures_7_8 = struct type 'a structure = 'a Ctypes.structure + module Struct = struct + module type Kstatfs = sig + module Types : Types_7_8_struct + module T = Types.Kstatfs + + val store : + blocks:Unsigned.uint64 -> + bfree:Unsigned.uint64 -> + bavail:Unsigned.uint64 -> + files:Unsigned.uint64 -> + ffree:Unsigned.uint64 -> + bsize:Unsigned.uint32 -> + namelen:Unsigned.uint32 -> + frsize:Unsigned.uint32 -> + T.t structure -> unit + + val create : + blocks:Unsigned.uint64 -> + bfree:Unsigned.uint64 -> + bavail:Unsigned.uint64 -> + files:Unsigned.uint64 -> + ffree:Unsigned.uint64 -> + bsize:Unsigned.uint32 -> + namelen:Unsigned.uint32 -> + frsize:Unsigned.uint32 -> + unit -> T.t structure + end + + module type File_lock = sig + module Types : Types_7_8_struct + module T = Types.File_lock + end + + module type Attr = sig + module Types : Types_7_8_struct + module T = Types.Attr + + val store : + ino:Unsigned.uint64 -> + size:Unsigned.uint64 -> + blocks:Unsigned.uint64 -> + atime:Unsigned.uint64 -> + mtime:Unsigned.uint64 -> + ctime:Unsigned.uint64 -> + atimensec:Unsigned.uint32 -> + mtimensec:Unsigned.uint32 -> + ctimensec:Unsigned.uint32 -> + mode:Unsigned.uint32 -> + nlink:Unsigned.uint32 -> + uid:Unsigned.uint32 -> + gid:Unsigned.uint32 -> + rdev:Unsigned.uint32 -> + T.t structure -> unit + + val create : + ino:Unsigned.uint64 -> + size:Unsigned.uint64 -> + blocks:Unsigned.uint64 -> + atime:Unsigned.uint64 -> + mtime:Unsigned.uint64 -> + ctime:Unsigned.uint64 -> + atimensec:Unsigned.uint32 -> + mtimensec:Unsigned.uint32 -> + ctimensec:Unsigned.uint32 -> + mode:Unsigned.uint32 -> + nlink:Unsigned.uint32 -> + uid:Unsigned.uint32 -> + gid:Unsigned.uint32 -> + rdev:Unsigned.uint32 -> + unit -> T.t structure + + type host_t + val describe : host:host_t -> T.t structure -> string + end + end + module In = struct module type Opcode = sig module Struct : Types_7_8_struct @@ -1025,79 +1101,91 @@ struct end end +module type Signatures_7_8_struct = sig + module T : Types_7_8_struct + type host_t + + module Kstatfs : Signatures_7_8.Struct.Kstatfs + with module Types := T + module File_lock : Signatures_7_8.Struct.File_lock + with module Types := T + module Attr : Signatures_7_8.Struct.Attr + with module Types := T + with type host_t := host_t +end + + module type Signatures_7_8_in = sig module Struct : Types_7_8_struct module T : Types_7_8_in with module Struct := Struct - open Signatures_7_8 - open In type chan type ('h, 'b) packet - module Opcode : Opcode + module Opcode : Signatures_7_8.In.Opcode with module Struct := Struct with module Types := T - module Hdr : Hdr with type opcode_t := Opcode.t + module Hdr : Signatures_7_8.In.Hdr with type opcode_t := Opcode.t with module Struct := Struct with module Types := T - module Init : Init + module Init : Signatures_7_8.In.Init with module Struct := Struct with module Types := T - module Open : Open + module Open : Signatures_7_8.In.Open with module Struct := Struct with module Types := T - module Read : Read + module Read : Signatures_7_8.In.Read with module Struct := Struct with module Types := T - module Release : Release + module Release : Signatures_7_8.In.Release with module Struct := Struct with module Types := T - module Access : Access + module Access : Signatures_7_8.In.Access with module Struct := Struct with module Types := T - module Forget : Forget + module Forget : Signatures_7_8.In.Forget with module Struct := Struct with module Types := T - module Flush : Flush + module Flush : Signatures_7_8.In.Flush with module Struct := Struct with module Types := T - module Create : Create + module Create : Signatures_7_8.In.Create with module Struct := Struct with module Types := T - module Mknod : Mknod + module Mknod : Signatures_7_8.In.Mknod with module Struct := Struct with module Types := T - module Mkdir : Mkdir + module Mkdir : Signatures_7_8.In.Mkdir with module Struct := Struct with module Types := T - module Rename : Rename + module Rename : Signatures_7_8.In.Rename with module Struct := Struct with module Types := T - module Link : Link + module Link : Signatures_7_8.In.Link with module Struct := Struct with module Types := T - module Write : Write + module Write : Signatures_7_8.In.Write with module Struct := Struct with module Types := T - module Fsync : Fsync + module Fsync : Signatures_7_8.In.Fsync with module Struct := Struct with module Types := T - module Lk : Lk + module Lk : Signatures_7_8.In.Lk with module Struct := Struct with module Types := T - module Interrupt : Interrupt + module Interrupt : Signatures_7_8.In.Interrupt with module Struct := Struct with module Types := T - module Bmap : Bmap + module Bmap : Signatures_7_8.In.Bmap with module Struct := Struct with module Types := T - module Setattr : Setattr with type hdr_t := Hdr.T.t + module Setattr : Signatures_7_8.In.Setattr with type hdr_t := Hdr.T.t with module Struct := Struct with module Types := T - module Getxattr : Getxattr with type hdr_t := Hdr.T.t + module Getxattr : Signatures_7_8.In.Getxattr with type hdr_t := Hdr.T.t with module Struct := Struct with module Types := T - module Setxattr : Setxattr with type hdr_t := Hdr.T.t + module Setxattr : Signatures_7_8.In.Setxattr with type hdr_t := Hdr.T.t with module Struct := Struct with module Types := T module Message : sig @@ -1119,7 +1207,7 @@ module type Signatures_7_8_in = sig | Readlink | Open of Open.T.t Ctypes.structure | Read of Read.T.t Ctypes.structure - | Write of Write.T.t structure * char Ctypes.ptr + | Write of Write.T.t Ctypes.structure * char Ctypes.ptr | Statfs | Flush of Flush.T.t Ctypes.structure | Release of Release.T.t Ctypes.structure @@ -1140,7 +1228,7 @@ module type Signatures_7_8_in = sig | Destroy | Other of Opcode.t | Unknown of int32 - include Message with type t := t + include Signatures_7_8.In.Message with type t := t and type hdr_t := Hdr.T.t and type chan := chan and type ('h, 'b) packet := ('h, 'b) packet From e331758916919570b580737f1c3bf1255e08d64d Mon Sep 17 00:00:00 2001 From: Jeremy Yallop Date: Tue, 4 Apr 2017 14:14:11 +0100 Subject: [PATCH 4/4] Move Profuse_7_8.Out signature to Profuse_signatures. --- lib/profuse_7_8.mli | 219 ++------------------------- lib/profuse_signatures.ml | 311 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 321 insertions(+), 209 deletions(-) diff --git a/lib/profuse_7_8.mli b/lib/profuse_7_8.mli index 3042ab6..351ad92 100644 --- a/lib/profuse_7_8.mli +++ b/lib/profuse_7_8.mli @@ -13,219 +13,20 @@ type 'a structure = 'a Types.structure module Struct : Profuse_signatures.Signatures_7_8_struct with module T = Types.Struct - and type host_t := Host.t + and type host_t := Host.t -module In : Profuse_signatures.Signatures_7_8_in +module In : Profuse_signatures.Signatures_7_8_in with module Struct := Types.Struct - with module T = Types.In + and module T = Types.In and type chan := chan and type ('h, 'b) packet := ('h, 'b) packet type 'a request = (In.Hdr.T.t, 'a) packet -module Out : sig - module T = Types.Out - - module Hdr : sig - module T = T.Hdr - - val sz : int - - val packet : - ?nerrno:int32 -> - count:int -> 'a request -> char Ctypes.CArray.t - - val make : 'a request -> 'b Ctypes.typ -> 'b - - val set_size : char Ctypes.CArray.t -> int -> char Ctypes.CArray.t - end - - module Dirent : sig - module T = Struct.T.Dirent - - val struct_size : int - - val size : string -> int - - val of_list : - host:Host.t -> - (int * int64 * string * Dirent.File_kind.t) list -> - int -> int -> 'a request -> char Ctypes.CArray.t - end - - module Readlink : sig - val create : - target:string -> 'a request -> char Ctypes.CArray.t - end - - module Read : sig - val allocate : size:int -> 'a request -> char Ctypes.CArray.t - - val finalize : - size:int -> char Ctypes.CArray.t -> 'a request -> char Ctypes.CArray.t - - val describe : char Ctypes.CArray.t -> string - end - - module Write : sig - module T = T.Write - - val create : size:Unsigned.uint32 -> 'a request -> char Ctypes.CArray.t - end - - module Statfs : sig - module T = T.Statfs - - val create : - blocks:Unsigned.uint64 -> - bfree:Unsigned.uint64 -> - bavail:Unsigned.uint64 -> - files:Unsigned.uint64 -> - ffree:Unsigned.uint64 -> - bsize:Unsigned.uint32 -> - namelen:Unsigned.uint32 -> - frsize:Unsigned.uint32 -> - 'a request -> char Ctypes.CArray.t - end - - module Open : sig - module T = T.Open - - module Flags : sig - module T = T.Flags - - type t = { - direct_io : bool; - keep_cache : bool; - } - - val zero : t - - val of_uint32 : Unsigned.uint32 -> t - val to_uint32 : t -> Unsigned.uint32 - val to_string : t -> string - end - - val store : - fh:Unsigned.uint64 -> - open_flags:Flags.t -> - T.t structure -> 'a -> unit - - val create : - fh:Unsigned.uint64 -> - open_flags:Flags.t -> - 'a request -> char Ctypes.CArray.t - end - - module Init : sig - module T = T.Init - - val create : - major:Unsigned.uint32 -> - minor:Unsigned.uint32 -> - max_readahead:Unsigned.uint32 -> - flags:Unsigned.uint32 -> - max_write:Unsigned.uint32 -> - 'a request -> char Ctypes.CArray.t - val describe : T.t structure -> string - end - - module Entry : sig - module T = T.Entry - - val store : - nodeid:Unsigned.uint64 -> - generation:Unsigned.uint64 -> - entry_valid:Unsigned.uint64 -> - attr_valid:Unsigned.uint64 -> - entry_valid_nsec:Unsigned.uint32 -> - attr_valid_nsec:Unsigned.uint32 -> - store_attr:(Types.Struct.Attr.t structure -> unit) -> - T.t structure -> 'a -> unit - - val create : - nodeid:Unsigned.uint64 -> - generation:Unsigned.uint64 -> - entry_valid:Unsigned.uint64 -> - attr_valid:Unsigned.uint64 -> - entry_valid_nsec:Unsigned.uint32 -> - attr_valid_nsec:Unsigned.uint32 -> - store_attr:(Types.Struct.Attr.t structure -> unit) -> - 'a request -> char Ctypes.CArray.t - - val describe : host:Host.t -> T.t structure -> string - end - - module Attr : sig - module T = T.Attr - - val create : - attr_valid:Unsigned.uint64 -> - attr_valid_nsec:Unsigned.uint32 -> - store_attr:(Types.Struct.Attr.t structure -> unit) -> - 'a request -> char Ctypes.CArray.t - end - - module Create : sig - module T : sig - type t - val t : t structure Ctypes.typ - - val entry : (Types.Out.Entry.t structure, t structure) Ctypes.field - val open_ : (Types.Out.Open.t structure, t structure) Ctypes.field - end - - val create : - store_entry:(Entry.T.t structure -> 'a request -> unit) - -> store_open:(Open.T.t structure -> 'a request -> unit) - -> 'a request -> char Ctypes.CArray.t - end - - module Message : sig - type t = - | Init of Init.T.t structure - | Getattr of Attr.T.t structure - | Lookup of Entry.T.t structure - | Opendir of Open.T.t structure - | Readdir of char Ctypes.CArray.t - | Releasedir - | Fsyncdir (* TODO: do *) - | Rmdir - | Mkdir of Entry.T.t structure - | Getxattr (* TODO: do *) - | Setxattr (* TODO: do *) - | Listxattr (* TODO: do *) - | Removexattr (* TODO: do *) - | Access - | Forget (* TODO: should never happen? *) - | Readlink of string - | Open of Open.T.t structure - | Read of char Ctypes.CArray.t - | Write of Write.T.t structure - | Statfs of Struct.Kstatfs.T.t structure - | Flush - | Release - | Fsync - | Unlink - | Create of Entry.T.t structure * Open.T.t structure - | Mknod of Entry.T.t structure - | Setattr of Attr.T.t structure - | Link of Entry.T.t structure - | Symlink of Entry.T.t structure - | Rename - | Getlk (* TODO: do *) - | Setlk (* TODO: do *) - | Setlkw (* TODO: do *) - | Interrupt (* TODO: do *) - | Bmap (* TODO: do *) - | Destroy - | Other of In.Opcode.t - | Unknown of int32 * int * unit Ctypes.ptr - - val deserialize : - (In.Hdr.T.t, 'a) packet -> int -> char Ctypes.ptr - -> (Hdr.T.t, t) packet - - val describe : ('a,t) packet -> string - end -end +module Out : Profuse_signatures.Signatures_7_8_out + with module Struct := Types.Struct + and module In := Types.In + and module T = Types.Out + and type 'a request := 'a request + and type host_t := Host.t + and type ('h, 'b) packet := ('h, 'b) packet diff --git a/lib/profuse_signatures.ml b/lib/profuse_signatures.ml index b0dfc6c..6c66e74 100644 --- a/lib/profuse_signatures.ml +++ b/lib/profuse_signatures.ml @@ -1099,6 +1099,217 @@ struct val describe : (hdr_t, t) packet -> string end end + + module Out = struct + module type Hdr = sig + type 'a request + module Struct : Types_7_8_struct + module Types : Types_7_8_out with module Struct := Struct + module T = Types.Hdr + + val sz : int + + val packet : + ?nerrno:int32 -> + count:int -> 'a request -> char Ctypes.CArray.t + + val make : 'a request -> 'b Ctypes.typ -> 'b + + val set_size : char Ctypes.CArray.t -> int -> char Ctypes.CArray.t + end + + module type Dirent = sig + type 'a request + type host_t + module Struct : Types_7_8_struct + module T = Struct.Dirent + + val struct_size : int + + val size : string -> int + + val of_list : + host:host_t -> + (int * int64 * string * Dirent.File_kind.t) list -> + int -> int -> 'a request -> char Ctypes.CArray.t + end + + module type Readlink = sig + type 'a request + val create : + target:string -> 'a request -> char Ctypes.CArray.t + end + + module type Read = sig + type 'a request + val allocate : size:int -> 'a request -> char Ctypes.CArray.t + + val finalize : + size:int -> char Ctypes.CArray.t -> 'a request -> char Ctypes.CArray.t + + val describe : char Ctypes.CArray.t -> string + end + + module type Write = sig + type 'a request + module Struct : Types_7_8_struct + module Types : Types_7_8_out with module Struct := Struct + module T = Types.Write + + val create : size:Unsigned.uint32 -> 'a request -> char Ctypes.CArray.t + end + + module type Statfs = sig + type 'a request + module Struct : Types_7_8_struct + module Types : Types_7_8_out with module Struct := Struct + module T = Types.Statfs + + val create : + blocks:Unsigned.uint64 -> + bfree:Unsigned.uint64 -> + bavail:Unsigned.uint64 -> + files:Unsigned.uint64 -> + ffree:Unsigned.uint64 -> + bsize:Unsigned.uint32 -> + namelen:Unsigned.uint32 -> + frsize:Unsigned.uint32 -> + 'a request -> char Ctypes.CArray.t + end + + module type Open_flags = sig + type t = { + direct_io : bool; + keep_cache : bool; + } + + val zero : t + + val of_uint32 : Unsigned.uint32 -> t + val to_uint32 : t -> Unsigned.uint32 + val to_string : t -> string + end + + module type Open = sig + type 'a request + module Struct : Types_7_8_struct + module Types : Types_7_8_out with module Struct := Struct + module T = Types.Open + + module Flags : Open_flags + + val store : + fh:Unsigned.uint64 -> + open_flags:Flags.t -> + T.t structure -> 'a -> unit + + val create : + fh:Unsigned.uint64 -> + open_flags:Flags.t -> + 'a request -> char Ctypes.CArray.t + end + + module type Init = sig + type 'a request + module Struct : Types_7_8_struct + module Types : Types_7_8_out with module Struct := Struct + module T = Types.Init + + val create : + major:Unsigned.uint32 -> + minor:Unsigned.uint32 -> + max_readahead:Unsigned.uint32 -> + flags:Unsigned.uint32 -> + max_write:Unsigned.uint32 -> + 'a request -> char Ctypes.CArray.t + val describe : T.t structure -> string + end + + module type Entry = sig + type 'a request + module Struct : Types_7_8_struct + module Types : Types_7_8_out with module Struct := Struct + module T = Types.Entry + + val store : + nodeid:Unsigned.uint64 -> + generation:Unsigned.uint64 -> + entry_valid:Unsigned.uint64 -> + attr_valid:Unsigned.uint64 -> + entry_valid_nsec:Unsigned.uint32 -> + attr_valid_nsec:Unsigned.uint32 -> + store_attr:(Struct.Attr.t structure -> unit) -> + T.t structure -> 'a -> unit + + val create : + nodeid:Unsigned.uint64 -> + generation:Unsigned.uint64 -> + entry_valid:Unsigned.uint64 -> + attr_valid:Unsigned.uint64 -> + entry_valid_nsec:Unsigned.uint32 -> + attr_valid_nsec:Unsigned.uint32 -> + store_attr:(Struct.Attr.t structure -> unit) -> + 'a request -> char Ctypes.CArray.t + + type host_t + val describe : host:host_t -> T.t structure -> string + end + + module type Attr = sig + type 'a request + module Struct : Types_7_8_struct + module Types : Types_7_8_out with module Struct := Struct + module T = Types.Attr + + val create : + attr_valid:Unsigned.uint64 -> + attr_valid_nsec:Unsigned.uint32 -> + store_attr:(Struct.Attr.t structure -> unit) -> + 'a request -> char Ctypes.CArray.t + end + + module type Create_t = sig + module Struct : Types_7_8_struct + module Types : Types_7_8_out with module Struct := Struct + type t + val t : t structure Ctypes.typ + + val entry : (Types.Entry.t structure, t structure) Ctypes.field + val open_ : (Types.Open.t structure, t structure) Ctypes.field + end + + module type Create = sig + type 'a request + type host_t + module Struct : Types_7_8_struct + module Types : Types_7_8_out with module Struct := Struct + module Entry : Entry + with module Struct := Struct + with module Types := Types + with type 'a request := 'a request + with type host_t := host_t + module Open : Open with module Struct := Struct with module Types := Types with type 'a request := 'a request + module T : Create_t with module Struct := Struct with module Types := Types + + val create : + store_entry:(Entry.T.t structure -> 'a request -> unit) + -> store_open:(Open.T.t structure -> 'a request -> unit) + -> 'a request -> char Ctypes.CArray.t + end + + module type Message = sig + type t + type in_hdr_t + type hdr_t + type (_,_) packet + + val deserialize : + (in_hdr_t, 'a) packet -> int -> char Ctypes.ptr + -> (hdr_t, t) packet + + val describe : ('a,t) packet -> string + end + end end module type Signatures_7_8_struct = sig @@ -1234,3 +1445,103 @@ module type Signatures_7_8_in = sig and type ('h, 'b) packet := ('h, 'b) packet end end + +module type Signatures_7_8_out = sig + module Struct : Types_7_8_struct + module In : Types_7_8_in with module Struct := Struct + module T : Types_7_8_out with module Struct := Struct + type 'a request + type host_t + type ('h, 'b) packet + + module Hdr : Signatures_7_8.Out.Hdr + with module Struct := Struct + and module Types := T + and type 'a request := 'a request + module Dirent : Signatures_7_8.Out.Dirent + with module Struct := Struct + and type 'a request := 'a request + and type host_t := host_t + module Readlink : Signatures_7_8.Out.Readlink + with type 'a request := 'a request + module Read : Signatures_7_8.Out.Read + with type 'a request := 'a request + module Write : Signatures_7_8.Out.Write + with module Struct := Struct + and module Types := T + and type 'a request := 'a request + module Statfs : Signatures_7_8.Out.Statfs + with module Struct := Struct + and module Types := T + and type 'a request := 'a request + module Open : Signatures_7_8.Out.Open + with module Struct := Struct + and module Types := T + and type 'a request := 'a request + module Init : Signatures_7_8.Out.Init + with module Struct := Struct + and module Types := T + and type 'a request := 'a request + module Entry : Signatures_7_8.Out.Entry + with module Struct := Struct + and module Types := T + and type 'a request := 'a request + and type host_t := host_t + module Attr : Signatures_7_8.Out.Attr + with module Struct := Struct + and module Types := T + and type 'a request := 'a request + module Create : Signatures_7_8.Out.Create + with module Struct := Struct + and module Types := T + and type 'a request := 'a request + and type host_t := host_t + and module Open := Open + and module Entry := Entry + module Message : sig + type t = + | Init of Init.T.t Ctypes.structure + | Getattr of Attr.T.t Ctypes.structure + | Lookup of Entry.T.t Ctypes.structure + | Opendir of Open.T.t Ctypes.structure + | Readdir of char Ctypes.CArray.t + | Releasedir + | Fsyncdir (* TODO: do *) + | Rmdir + | Mkdir of Entry.T.t Ctypes.structure + | Getxattr (* TODO: do *) + | Setxattr (* TODO: do *) + | Listxattr (* TODO: do *) + | Removexattr (* TODO: do *) + | Access + | Forget (* TODO: should never happen? *) + | Readlink of string + | Open of Open.T.t Ctypes.structure + | Read of char Ctypes.CArray.t + | Write of Write.T.t Ctypes.structure + | Statfs of Struct.Kstatfs.t Ctypes.structure + | Flush + | Release + | Fsync + | Unlink + | Create of Entry.T.t Ctypes.structure * Open.T.t Ctypes.structure + | Mknod of Entry.T.t Ctypes.structure + | Setattr of Attr.T.t Ctypes.structure + | Link of Entry.T.t Ctypes.structure + | Symlink of Entry.T.t Ctypes.structure + | Rename + | Getlk (* TODO: do *) + | Setlk (* TODO: do *) + | Setlkw (* TODO: do *) + | Interrupt (* TODO: do *) + | Bmap (* TODO: do *) + | Destroy + | Other of In.Opcode.t + | Unknown of int32 * int * unit Ctypes.ptr + include Signatures_7_8.Out.Message + with type t := t + and type in_hdr_t := In.Hdr.t + and type hdr_t := T.Hdr.t + and type ('h, 'b) packet := ('h, 'b) packet + end +end