Transaction_end | Introduce | Release |
Getdomainpath | Write | Mkdir | Rm |
Setperms | Watchevent | Error | Isintroduced |
- Resume | Set_target | Restrict | Reset_watches |
+ Resume | Set_target | Reset_watches |
Invalid
let operation_c_mapping =
Transaction_end; Introduce; Release;
Getdomainpath; Write; Mkdir; Rm;
Setperms; Watchevent; Error; Isintroduced;
- Resume; Set_target; Restrict; Reset_watches |]
+ Resume; Set_target; Reset_watches |]
let size = Array.length operation_c_mapping
let array_search el a =
| Isintroduced -> "IS_INTRODUCED"
| Resume -> "RESUME"
| Set_target -> "SET_TARGET"
- | Restrict -> "RESTRICT"
| Reset_watches -> "RESET_WATCHES"
| Invalid -> "INVALID"
| Isintroduced
| Resume
| Set_target
- | Restrict
| Reset_watches
| Invalid
val operation_c_mapping : operation array
let get_perm con =
con.perm
-let restrict con domid =
- con.perm <- Perms.Connection.restrict con.perm domid
-
let set_target con target_domid =
con.perm <- Perms.Connection.set_target (get_perm con) ~perms:[Perms.READ; Perms.WRITE] target_domid
| Xenbus.Xb.Op.Mkdir -> "mkdir "
| 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"
let is_dom0 (connection:t) =
is_owner connection 0
-let restrict (connection:t) domid =
- match connection.target, connection.main with
- | None, (0, perms) -> { connection with main = (domid, perms) }
- | _ -> raise Define.Permission_denied
-
let elt_to_string (i,p) =
Printf.sprintf "%i%S" i (String.concat "" (List.map String.of_char (List.map char_of_permty p)))
in
if domid = Define.domid_self || Domains.exist domains domid then "T\000" else "F\000"
-(* [restrict] is in the patch queue since xen3.2 *)
-let do_restrict con t domains cons data =
- if not (Connection.is_dom0 con)
- then raise Define.Permission_denied;
- let domid =
- match (split None '\000' data) with
- | [ domid; "" ] -> c_int_of_string domid
- | _ -> raise Invalid_Cmd_Args
- 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 *)
let do_set_target con t domains cons data =
if not (Connection.is_dom0 con)
then raise Define.Permission_denied;
match split None '\000' data with
- | [ domid; "" ] -> do_restrict con t domains con data (* backward compatibility with xen3.2-pq *)
| [ domid; target_domid; "" ] -> Connections.set_target cons (c_int_of_string domid) (c_int_of_string target_domid)
| _ -> raise Invalid_Cmd_Args
| Xenbus.Xb.Op.Isintroduced
| Xenbus.Xb.Op.Resume
| Xenbus.Xb.Op.Set_target
- | Xenbus.Xb.Op.Restrict
| Xenbus.Xb.Op.Reset_watches
| Xenbus.Xb.Op.Invalid -> error "called function_of_type_simple_op on operation %s" (Xenbus.Xb.Op.to_string ty);
raise (Invalid_argument (Xenbus.Xb.Op.to_string ty))
| Xenbus.Xb.Op.Isintroduced -> reply_data do_isintroduced
| 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
| _ -> function_of_type_simple_op ty
bool xs_rm(struct xs_handle *h, xs_transaction_t t,
const char *path);
-/* Restrict a xenstore handle so that it acts as if it had the
- * permissions of domain @domid. The handle must currently be
- * using domain 0's credentials.
- *
- * Returns false on failure, in which case the handle continues
- * to use the old credentials, or true on success.
- */
-bool xs_restrict(struct xs_handle *h, unsigned domid);
-
/* Get permissions of node (first element is owner, first perms is "other").
* Returns malloced array, or NULL: call free() after use.
*/
{ "IS_DOMAIN_INTRODUCED", do_is_domain_introduced },
[XS_RESUME] = { "RESUME", do_resume },
[XS_SET_TARGET] = { "SET_TARGET", do_set_target },
- [XS_RESTRICT] = { "RESTRICT", NULL },
[XS_RESET_WATCHES] = { "RESET_WATCHES", do_reset_watches },
[XS_DIRECTORY_PART] = { "DIRECTORY_PART", send_directory_part },
};
return false;
}
-bool xs_restrict(struct xs_handle *h, unsigned domid)
-{
- char buf[16];
-
- sprintf(buf, "%d", domid);
- return xs_bool(xs_single(h, XBT_NULL, XS_RESTRICT, buf, NULL));
-}
-
/* Watch a node for changes (poll on fd to detect, or call read_watch()).
* When the node (or any child) changes, fd will become readable.
* Token is returned when watch is read, to allow matching.
XS_IS_DOMAIN_INTRODUCED,
XS_RESUME,
XS_SET_TARGET,
- XS_RESTRICT,
- XS_RESET_WATCHES,
+ /* XS_RESTRICT has been removed */
+ XS_RESET_WATCHES = XS_SET_TARGET + 2,
XS_DIRECTORY_PART,
XS_TYPE_COUNT, /* Number of valid types. */