2 disk
: string; (* The disk image. *)
13 params := (k
, v
) :: !params
15 let test_config_complete () =
16 let params = List.rev
!params in
17 assert (params = [ "a", "1"; "b", "2"; "c", "3" ])
19 let test_open readonly
=
21 let s = String.create
(512 * 8) in
24 s.[i
*8+j
] <- Char.chr
(j
+1)
34 Int64.of_int
(String.length h
.disk)
36 let test_pread h buf offset
=
37 let len = String.length buf
in
38 String.blit h
.disk (Int64.to_int offset
) buf
0 len
40 let test_pwrite h buf offset
=
41 let len = String.length buf
in
42 String.blit buf
0 h
.disk (Int64.to_int offset
) len
45 NBDKit.default_callbacks
with
46 NBDKit.name
= "testocaml";
49 load
= Some
test_load;
50 unload
= Some
test_unload;
51 config
= Some
test_config;
52 config_complete
= Some
test_config_complete;
54 open_connection
= Some
test_open;
55 close
= Some
test_close;
56 get_size
= Some
test_get_size;
57 pread
= Some
test_pread;
58 pwrite
= Some
test_pwrite;
61 let thread_model = NBDKit.THREAD_MODEL_SERIALIZE_CONNECTIONS
63 let () = NBDKit.register_plugin
thread_model plugin