Skip to content

Commit f86743a

Browse files
committed
split Lwt and non-Lwt code into separate libraries
Introduce xenstore_transport.core and xenstore_transport.lwt. Code that only wants the Unix backend doesn't need to link Lwt. This is useful if applications introduce link-time checks to avoid accidentally linking and using Lwt functions (e.g. such as XAPI, because it has many blocking functions, and is incompatible with Lwt). For backwards compatibility xenstore_transport is retained as a library that links and reexports both core and lwt, so users can move to use the '.core' library at the own pace. This effectively undoes the deprecation in, turns out the separate subpackages would be useful after all: Fixes: b6d83e1 ("Add backwards-compatibility ocamlfind subpackages") Signed-off-by: Edwin Török <[email protected]>
1 parent 04b1c1d commit f86743a

File tree

9 files changed

+19
-14
lines changed

9 files changed

+19
-14
lines changed

META.xenstore_transport.template

Lines changed: 0 additions & 11 deletions
This file was deleted.

dune-project

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1-
(lang dune 1.0)
1+
(lang dune 2.0)
2+
23
(name xenstore-tool)

lib/dune

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
(library
22
(name xenstore_transport)
33
(public_name xenstore_transport)
4-
(libraries lwt xenstore xenstore.client lwt.unix)
4+
(libraries
5+
(re_export xenstore_transport.unix)
6+
(re_export xenstore_transport.lwt))
57
(wrapped false)
68
(flags :standard -safe-string))

lib/lwt/dune

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
(library
2+
(name xenstore_transport_lwt)
3+
(public_name xenstore_transport.lwt)
4+
(libraries lwt xenstore xenstore.client lwt.unix xenstore_transport.unix)
5+
(wrapped false)
6+
(flags
7+
(:standard -safe-string)))
File renamed without changes.
File renamed without changes.

lib/unix/dune

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
(library
2+
(name xenstore_transport_core)
3+
(public_name xenstore_transport.unix)
4+
(libraries unix)
5+
(wrapped false)
6+
(flags :standard -safe-string))
File renamed without changes.

lib/xs_transport_unix_client.ml renamed to lib/unix/xs_transport_unix_client.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ let create () =
4040
raise e
4141
end
4242
| _ ->
43-
Unix.openfile path [Lwt_unix.O_RDWR] 0o0
43+
Unix.openfile path [Unix.O_RDWR] 0o0
4444

4545
let destroy fd = Unix.close fd
4646
let read fd = Unix.read fd

0 commit comments

Comments
 (0)