else try
let ndom = Domains.create domains domid mfn port in
Connections.add_domain cons ndom;
- Connections.fire_spec_watches cons "@introduceDomain";
+ Connections.fire_spec_watches cons Store.Path.introduce_domain;
ndom
with _ -> raise Invalid_Cmd_Args
in
Domains.del domains domid;
Connections.del_domain cons domid;
if fire_spec_watches
- then Connections.fire_spec_watches cons "@releaseDomain"
+ then Connections.fire_spec_watches cons Store.Path.release_domain
else raise Invalid_Cmd_Args
let do_resume con _t domains _cons data =
let apply rnode path fct =
lookup rnode path fct
+
+let introduce_domain = "@introduceDomain"
+let release_domain = "@releaseDomain"
+let specials = List.map of_string [ introduce_domain; release_domain ]
+
end
(* The Store.t type *)
Unix.close fd;
int_of_string (Bytes.sub_string buf 0 sz)
-let path_complete path connection_path =
- if String.get path 0 <> '/' then
- connection_path ^ path
- else
- path
-
+(* @path may be guest data and needs its length validating. @connection_path
+ * is generated locally in xenstored and always of the form "/local/domain/$N/" *)
let path_validate path connection_path =
- if String.length path = 0 || String.length path > 1024 then
- raise Define.Invalid_path
- else
- let cpath = path_complete path connection_path in
- if String.get cpath 0 <> '/' then
- raise Define.Invalid_path
- else
- cpath
+ let len = String.length path in
+
+ if len = 0 || len > 1024 then raise Define.Invalid_path;
+
+ let abs_path =
+ match String.get path 0 with
+ | '/' | '@' -> path
+ | _ -> connection_path ^ path
+ in
+ abs_path
let quit = ref false in
Logging.init_xenstored_log();
+ List.iter (fun path ->
+ Store.write store Perms.Connection.full_rights path "") Store.Path.specials;
let filename = Paths.xen_run_stored ^ "/db" in
if cf.restart && Sys.file_exists filename then (
let (notify, deaddom) = Domains.cleanup domains in
List.iter (Connections.del_domain cons) deaddom;
if deaddom <> [] || notify then
- Connections.fire_spec_watches cons "@releaseDomain"
+ Connections.fire_spec_watches cons Store.Path.release_domain
)
else
let c = Connections.find_domain_by_port cons port in