|
|
97374c0 |
From fd6d9cd3d20e496bdbf3e0a07354f65de0bcf4ae Mon Sep 17 00:00:00 2001
|
|
|
97374c0 |
From: =?UTF-8?q?Edwin=20T=C3=B6r=C3=B6k?= <edvin.torok@citrix.com>
|
|
|
97374c0 |
Date: Fri, 29 Jul 2022 18:53:29 +0100
|
|
|
97374c0 |
Subject: tools/ocaml/libs/xb: hide type of Xb.t
|
|
|
97374c0 |
MIME-Version: 1.0
|
|
|
97374c0 |
Content-Type: text/plain; charset=UTF-8
|
|
|
97374c0 |
Content-Transfer-Encoding: 8bit
|
|
|
97374c0 |
|
|
|
97374c0 |
Hiding the type will make it easier to change the implementation
|
|
|
97374c0 |
in the future without breaking code that relies on it.
|
|
|
97374c0 |
|
|
|
97374c0 |
No functional change.
|
|
|
97374c0 |
|
|
|
97374c0 |
Signed-off-by: Edwin Török <edvin.torok@citrix.com>
|
|
|
97374c0 |
Acked-by: Christian Lindig <christian.lindig@citrix.com>
|
|
|
97374c0 |
(cherry picked from commit 7ade30a1451734d041363c750a65d322e25b47ba)
|
|
|
97374c0 |
|
|
|
97374c0 |
Reported-by: Julien Grall <jgrall@amazon.com>
|
|
|
97374c0 |
diff --git a/tools/ocaml/libs/xb/xb.ml b/tools/ocaml/libs/xb/xb.ml
|
|
|
97374c0 |
index 104d319d7747..8404ddd8a682 100644
|
|
|
97374c0 |
--- a/tools/ocaml/libs/xb/xb.ml
|
|
|
97374c0 |
+++ b/tools/ocaml/libs/xb/xb.ml
|
|
|
97374c0 |
@@ -196,6 +196,9 @@ let peek_output con = Queue.peek con.pkt_out
|
|
|
97374c0 |
let input_len con = Queue.length con.pkt_in
|
|
|
97374c0 |
let has_in_packet con = Queue.length con.pkt_in > 0
|
|
|
97374c0 |
let get_in_packet con = Queue.pop con.pkt_in
|
|
|
97374c0 |
+let has_partial_input con = match con.partial_in with
|
|
|
97374c0 |
+ | HaveHdr _ -> true
|
|
|
97374c0 |
+ | NoHdr (n, _) -> n < Partial.header_size ()
|
|
|
97374c0 |
let has_more_input con =
|
|
|
97374c0 |
match con.backend with
|
|
|
97374c0 |
| Fd _ -> false
|
|
|
97374c0 |
diff --git a/tools/ocaml/libs/xb/xb.mli b/tools/ocaml/libs/xb/xb.mli
|
|
|
97374c0 |
index 3a00da6cddc1..794e35bb343e 100644
|
|
|
97374c0 |
--- a/tools/ocaml/libs/xb/xb.mli
|
|
|
97374c0 |
+++ b/tools/ocaml/libs/xb/xb.mli
|
|
|
97374c0 |
@@ -66,13 +66,7 @@ type backend_mmap = {
|
|
|
97374c0 |
type backend_fd = { fd : Unix.file_descr; }
|
|
|
97374c0 |
type backend = Fd of backend_fd | Xenmmap of backend_mmap
|
|
|
97374c0 |
type partial_buf = HaveHdr of Partial.pkt | NoHdr of int * bytes
|
|
|
97374c0 |
-type t = {
|
|
|
97374c0 |
- backend : backend;
|
|
|
97374c0 |
- pkt_in : Packet.t Queue.t;
|
|
|
97374c0 |
- pkt_out : Packet.t Queue.t;
|
|
|
97374c0 |
- mutable partial_in : partial_buf;
|
|
|
97374c0 |
- mutable partial_out : string;
|
|
|
97374c0 |
-}
|
|
|
97374c0 |
+type t
|
|
|
97374c0 |
val init_partial_in : unit -> partial_buf
|
|
|
97374c0 |
val reconnect : t -> unit
|
|
|
97374c0 |
val queue : t -> Packet.t -> unit
|
|
|
97374c0 |
@@ -97,6 +91,7 @@ val has_output : t -> bool
|
|
|
97374c0 |
val peek_output : t -> Packet.t
|
|
|
97374c0 |
val input_len : t -> int
|
|
|
97374c0 |
val has_in_packet : t -> bool
|
|
|
97374c0 |
+val has_partial_input : t -> bool
|
|
|
97374c0 |
val get_in_packet : t -> Packet.t
|
|
|
97374c0 |
val has_more_input : t -> bool
|
|
|
97374c0 |
val is_selectable : t -> bool
|
|
|
97374c0 |
diff --git a/tools/ocaml/xenstored/connection.ml b/tools/ocaml/xenstored/connection.ml
|
|
|
97374c0 |
index 65f99ea6f28a..38b47363a173 100644
|
|
|
97374c0 |
--- a/tools/ocaml/xenstored/connection.ml
|
|
|
97374c0 |
+++ b/tools/ocaml/xenstored/connection.ml
|
|
|
97374c0 |
@@ -125,9 +125,7 @@ let get_perm con =
|
|
|
97374c0 |
let set_target con target_domid =
|
|
|
97374c0 |
con.perm <- Perms.Connection.set_target (get_perm con) ~perms:[Perms.READ; Perms.WRITE] target_domid
|
|
|
97374c0 |
|
|
|
97374c0 |
-let is_backend_mmap con = match con.xb.Xenbus.Xb.backend with
|
|
|
97374c0 |
- | Xenbus.Xb.Xenmmap _ -> true
|
|
|
97374c0 |
- | _ -> false
|
|
|
97374c0 |
+let is_backend_mmap con = Xenbus.Xb.is_mmap con.xb
|
|
|
97374c0 |
|
|
|
97374c0 |
let send_reply con tid rid ty data =
|
|
|
97374c0 |
if (String.length data) > xenstore_payload_max && (is_backend_mmap con) then
|
|
|
97374c0 |
@@ -280,9 +278,7 @@ let get_transaction con tid =
|
|
|
97374c0 |
|
|
|
97374c0 |
let do_input con = Xenbus.Xb.input con.xb
|
|
|
97374c0 |
let has_input con = Xenbus.Xb.has_in_packet con.xb
|
|
|
97374c0 |
-let has_partial_input con = match con.xb.Xenbus.Xb.partial_in with
|
|
|
97374c0 |
- | HaveHdr _ -> true
|
|
|
97374c0 |
- | NoHdr (n, _) -> n < Xenbus.Partial.header_size ()
|
|
|
97374c0 |
+let has_partial_input con = Xenbus.Xb.has_partial_input con.xb
|
|
|
97374c0 |
let pop_in con = Xenbus.Xb.get_in_packet con.xb
|
|
|
97374c0 |
let has_more_input con = Xenbus.Xb.has_more_input con.xb
|
|
|
97374c0 |
|