Skip to contentSkip to conversation

xenstore: document xs_set_permissions

PATCH Superseded Wei Liu 2 participants 3 messages Mar 31, 2015

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Wei Liu

author
#0 lore raw

PATCH 1/1 xenstore: document xs_set_permissions

Cc Ian Campbell <[email protected]>
Cc Ian Jackson <[email protected]>
---
 tools/xenstore/include/xenstore.h | 26 ++++++++++++++++++++++++--
 1 file changed, 24 insertions(+), 2 deletions(-)
tools/xenstore/include/xenstore.h +24 -2
index b4b113e..6af5978 100644
@@ -149,8 +149,30 @@ struct xs_permissions *xs_get_permissions(struct xs_handle *h,
 					  xs_transaction_t t,
 					  const char *path, unsigned int *num);
 
-/* Set permissions of node (must be owner).
- * Returns false on failure.
+/* Set permissions of node (must be owner).  Returns false on failure.
+ *
+ * Domain 0 may read / write anywhere in the store, regardless of
+ * permission settings.
+ *
+ * Note:
+ * The perms array is a list of (domid, permissions) pairs. The first
+ * element in the list specifies the owner of the list, plus the flags
+ * for every domain not explicitly specified subsequently. The
+ * subsequent entries are normal capabilities.
+ *
+ * Example C code:
+ *
+ *  struct xs_permissions perms[2];
+ *
+ *  perms[0].id = dm_domid;
+ *  perms[0].perms = XS_PERM_NONE;
+ *  perms[1].id = guest_domid;
+ *  perms[1].perms = XS_PERM_READ;
+ *
+ * It means the owner of the path is domain $dm_domid, all other
+ * domains (unless specified in subsequent pair) can neither read from
+ * nor write to that path. It then specifies domain $guest_domid can
+ * read from that path.
  */
 bool xs_set_permissions(struct xs_handle *h, xs_transaction_t t,
 			const char *path, struct xs_permissions *perms,
Signature · 1 line
1.9.1
Acked-by on v1 1/1
#1 lore raw
Quoted 3 lines · Wei Liu
Cc Ian Campbell <[email protected]>
Cc Ian Jackson <[email protected]>

One comment/suggestion:

Quoted 25 lines
---
 tools/xenstore/include/xenstore.h | 26 ++++++++++++++++++++++++--
 1 file changed, 24 insertions(+), 2 deletions(-)
tools/xenstore/include/xenstore.h +11 -2
index b4b113e..6af5978 100644
@@ -149,8 +149,30 @@ struct xs_permissions *xs_get_permissions(struct xs_handle *h,
 					  xs_transaction_t t,
 					  const char *path, unsigned int *num);
 
-/* Set permissions of node (must be owner).
- * Returns false on failure.
+/* Set permissions of node (must be owner).  Returns false on failure.
+ *
+ * Domain 0 may read / write anywhere in the store, regardless of
+ * permission settings.
+ *
+ * Note:
+ * The perms array is a list of (domid, permissions) pairs. The first
+ * element in the list specifies the owner of the list, plus the flags
+ * for every domain not explicitly specified subsequently. The
+ * subsequent entries are normal capabilities.
+ *

tools/xenstore/include/xenstore.h struct xs_permissions *xs_get_permissions(struct xs_handle *h, · line 172

Quoted 10 lines
tools/xenstore/include/xenstore.h +10 -0
+ * Example C code:
+ *
+ *  struct xs_permissions perms[2];
+ *
+ *  perms[0].id = dm_domid;
+ *  perms[0].perms = XS_PERM_NONE;
+ *  perms[1].id = guest_domid;
+ *  perms[1].perms = XS_PERM_READ;
+ *
+ * It means the owner of the path is domain $dm_domid,

Is it worth mentioning explicitly that the owner always gets an implicit XS_PERM_READ|XS_PERM_WRITE?

Quoted 7 lines
tools/xenstore/include/xenstore.h +3 -0
 all other
+ * domains (unless specified in subsequent pair) can neither read from
+ * nor write to that path. It then specifies domain $guest_domid can
+ * read from that path.
  */
 bool xs_set_permissions(struct xs_handle *h, xs_transaction_t t,

const char *path, struct xs_permissions *perms,

author
#2 lore raw
Quoted 38 lines · Ian Campbell
Quoted 3 lines · Wei Liu
Cc Ian Campbell <[email protected]>
Cc Ian Jackson <[email protected]>

One comment/suggestion:

Quoted 30 lines
---
 tools/xenstore/include/xenstore.h | 26 ++++++++++++++++++++++++--
 1 file changed, 24 insertions(+), 2 deletions(-)
tools/xenstore/include/xenstore.h +16 -2
index b4b113e..6af5978 100644
@@ -149,8 +149,30 @@ struct xs_permissions *xs_get_permissions(struct xs_handle *h,
 					  xs_transaction_t t,
 					  const char *path, unsigned int *num);
 
-/* Set permissions of node (must be owner).
- * Returns false on failure.
+/* Set permissions of node (must be owner).  Returns false on failure.
+ *
+ * Domain 0 may read / write anywhere in the store, regardless of
+ * permission settings.
+ *
+ * Note:
+ * The perms array is a list of (domid, permissions) pairs. The first
+ * element in the list specifies the owner of the list, plus the flags
+ * for every domain not explicitly specified subsequently. The
+ * subsequent entries are normal capabilities.
+ *
+ * Example C code:
+ *
+ *  struct xs_permissions perms[2];
+ *
+ *  perms[0].id = dm_domid;
Quoted 9 lines

tools/xenstore/include/xenstore.h struct xs_permissions *xs_get_permissions(struct xs_handle *h,

Quoted 5 lines
tools/xenstore/include/xenstore.h +5 -0
+ *  perms[0].perms = XS_PERM_NONE;
+ *  perms[1].id = guest_domid;
+ *  perms[1].perms = XS_PERM_READ;
+ *
+ * It means the owner of the path is domain $dm_domid,

Is it worth mentioning explicitly that the owner always gets an implicit XS_PERM_READ|XS_PERM_WRITE?

No problem. I will send out v2 with this information and your ack.

Wei.

Quoted 8 lines
Quoted 7 lines
tools/xenstore/include/xenstore.h +3 -0
 all other
+ * domains (unless specified in subsequent pair) can neither read from
+ * nor write to that path. It then specifies domain $guest_domid can
+ * read from that path.
  */
 bool xs_set_permissions(struct xs_handle *h, xs_transaction_t t,

const char *path, struct xs_permissions *perms,