* [PATCH] oxenstored: implement XS_RESET_WATCHES
@ 2015-06-09 10:08 Wei Liu
2015-06-17 11:13 ` Ian Campbell
0 siblings, 1 reply; 2+ messages in thread
From: Wei Liu @ 2015-06-09 10:08 UTC (permalink / raw)
To: Xen-devel; +Cc: Wei Liu, vkuznets, Ian Jackson, Ian Campbell, Dave.Scott
Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: David Scott <dave.scott@citrix.com>
---
tools/ocaml/libs/xb/op.ml | 6 ++++--
tools/ocaml/libs/xb/xb.mli | 1 +
tools/ocaml/xenstored/connection.ml | 7 +++++++
tools/ocaml/xenstored/logging.ml | 1 +
tools/ocaml/xenstored/process.ml | 6 ++++++
5 files changed, 19 insertions(+), 2 deletions(-)
diff --git a/tools/ocaml/libs/xb/op.ml b/tools/ocaml/libs/xb/op.ml
index 0ee8666..69346d8 100644
--- a/tools/ocaml/libs/xb/op.ml
+++ b/tools/ocaml/libs/xb/op.ml
@@ -19,7 +19,8 @@ type operation = Debug | Directory | Read | Getperms |
Transaction_end | Introduce | Release |
Getdomainpath | Write | Mkdir | Rm |
Setperms | Watchevent | Error | Isintroduced |
- Resume | Set_target | Restrict | Invalid
+ Resume | Set_target | Restrict | Reset_watches |
+ Invalid
let operation_c_mapping =
[| Debug; Directory; Read; Getperms;
@@ -27,7 +28,7 @@ let operation_c_mapping =
Transaction_end; Introduce; Release;
Getdomainpath; Write; Mkdir; Rm;
Setperms; Watchevent; Error; Isintroduced;
- Resume; Set_target; Restrict |]
+ Resume; Set_target; Restrict; Reset_watches |]
let size = Array.length operation_c_mapping
let array_search el a =
@@ -68,4 +69,5 @@ let to_string ty =
| Resume -> "RESUME"
| Set_target -> "SET_TARGET"
| Restrict -> "RESTRICT"
+ | Reset_watches -> "RESET_WATCHES"
| Invalid -> "INVALID"
diff --git a/tools/ocaml/libs/xb/xb.mli b/tools/ocaml/libs/xb/xb.mli
index 4e1f833..6c242da 100644
--- a/tools/ocaml/libs/xb/xb.mli
+++ b/tools/ocaml/libs/xb/xb.mli
@@ -23,6 +23,7 @@ module Op :
| Resume
| Set_target
| Restrict
+ | Reset_watches
| Invalid
val operation_c_mapping : operation array
val size : int
diff --git a/tools/ocaml/xenstored/connection.ml b/tools/ocaml/xenstored/connection.ml
index b4dc9cb..9de4978 100644
--- a/tools/ocaml/xenstored/connection.ml
+++ b/tools/ocaml/xenstored/connection.ml
@@ -186,6 +186,13 @@ let del_watch con path token =
con.nb_watches <- con.nb_watches - 1;
apath, w
+let del_watches con =
+ Hashtbl.clear con.watches
+
+let del_transactions con =
+ Hashtbl.clear con.transactions;
+ con.nb_watches <- 0
+
let list_watches con =
let ll = Hashtbl.fold
(fun _ watches acc -> List.map (fun watch -> watch.path, watch.token) watches :: acc)
diff --git a/tools/ocaml/xenstored/logging.ml b/tools/ocaml/xenstored/logging.ml
index 665b922..4c90032 100644
--- a/tools/ocaml/xenstored/logging.ml
+++ b/tools/ocaml/xenstored/logging.ml
@@ -242,6 +242,7 @@ let string_of_access_type = function
| Xenbus.Xb.Op.Rm -> "rm "
| Xenbus.Xb.Op.Setperms -> "setperms "
| Xenbus.Xb.Op.Restrict -> "restrict "
+ | Xenbus.Xb.Op.Reset_watches -> "reset watches"
| Xenbus.Xb.Op.Set_target -> "settarget"
| Xenbus.Xb.Op.Error -> "error "
diff --git a/tools/ocaml/xenstored/process.ml b/tools/ocaml/xenstored/process.ml
index 0620585..e827678 100644
--- a/tools/ocaml/xenstored/process.ml
+++ b/tools/ocaml/xenstored/process.ml
@@ -272,6 +272,11 @@ let do_restrict con t domains cons data =
in
Connection.restrict con domid
+(* only in xen >= 4.2 *)
+let do_reset_watches con t domains cons data =
+ Connection.del_watches con;
+ Connection.del_transactions con
+
(* only in >= xen3.3 *)
(* we ensure backward compatibility with restrict by counting the number of argument of set_target ... *)
(* This is not very elegant, but it is safe as 'restrict' only restricts permission of dom0 connections *)
@@ -324,6 +329,7 @@ let function_of_type ty =
| Xenbus.Xb.Op.Resume -> reply_ack do_resume
| Xenbus.Xb.Op.Set_target -> reply_ack do_set_target
| Xenbus.Xb.Op.Restrict -> reply_ack do_restrict
+ | Xenbus.Xb.Op.Reset_watches -> reply_ack do_reset_watches
| Xenbus.Xb.Op.Invalid -> reply_ack do_error
| _ -> reply_ack do_error
--
1.9.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] oxenstored: implement XS_RESET_WATCHES
2015-06-09 10:08 [PATCH] oxenstored: implement XS_RESET_WATCHES Wei Liu
@ 2015-06-17 11:13 ` Ian Campbell
0 siblings, 0 replies; 2+ messages in thread
From: Ian Campbell @ 2015-06-17 11:13 UTC (permalink / raw)
To: Wei Liu; +Cc: Xen-devel, vkuznets, Ian Jackson, Dave.Scott
On Tue, 2015-06-09 at 11:08 +0100, Wei Liu wrote:
> Signed-off-by: Wei Liu <wei.liu2@citrix.com>
> Acked-by: David Scott <dave.scott@citrix.com>
Applied, thanks.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-06-17 11:17 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-06-09 10:08 [PATCH] oxenstored: implement XS_RESET_WATCHES Wei Liu
2015-06-17 11:13 ` Ian Campbell
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.