[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 3/7] tools/xenstored: add missing migration record definitions



Add all the missing migration record structures and defines to the
xenstore_state.h header file.

Update the version of the migration stream to "2". In order to allow
receiving version 1 streams, change the version check of the header
to reject only streams with a version higher than the current known
one.

Signed-off-by: Juergen Gross <jgross@xxxxxxxx>
---
 tools/xenstored/control.c        |  2 +-
 tools/xenstored/lu.c             |  2 +-
 tools/xenstored/xenstore_state.h | 31 ++++++++++++++++++++++++++++++-
 3 files changed, 32 insertions(+), 3 deletions(-)

diff --git a/tools/xenstored/control.c b/tools/xenstored/control.c
index 953c01b735..2611a6fade 100644
--- a/tools/xenstored/control.c
+++ b/tools/xenstored/control.c
@@ -298,7 +298,7 @@ static struct cmd_s cmds[] = {
         */
        { "live-update", do_control_lu,
                "[-c <cmdline>] [-F] [-t <timeout>] [-v <version>] <file>\n"
-               "    Default timeout is 60 seconds, default version is 1.", 7 },
+               "    Default timeout is 60 seconds, default version is 2.", 7 },
 #endif
        { "logfile", do_control_logfile, "<file>" },
        { "memreport", do_control_memreport, "[<file>]" },
diff --git a/tools/xenstored/lu.c b/tools/xenstored/lu.c
index 330820a8a2..2c6adecb56 100644
--- a/tools/xenstored/lu.c
+++ b/tools/xenstored/lu.c
@@ -136,7 +136,7 @@ void lu_read_state(void)
 
        pre = state.buf;
        if (memcmp(pre->ident, XS_STATE_IDENT, sizeof(pre->ident)) ||
-           pre->version != htobe32(XS_STATE_VERSION) ||
+           !pre->version || be32toh(pre->version) > XS_STATE_VERSION ||
            pre->flags != XS_STATE_FLAGS)
                barf("Unknown record identifier");
        for (head = state.buf + sizeof(*pre);
diff --git a/tools/xenstored/xenstore_state.h b/tools/xenstored/xenstore_state.h
index bad966caf4..3fd97d60d8 100644
--- a/tools/xenstored/xenstore_state.h
+++ b/tools/xenstored/xenstore_state.h
@@ -27,8 +27,10 @@
 #ifndef htobe32
 #if __BYTE_ORDER == __LITTLE_ENDIAN
 #define htobe32(x) __builtin_bswap32(x)
+#define be32toh(x) __builtin_bswap32(x)
 #else
 #define htobe32(x) (x)
+#define be32toh(x) (x)
 #endif
 #endif
 
@@ -36,7 +38,7 @@ struct xs_state_preamble {
     char ident[8];
 #define XS_STATE_IDENT    "xenstore"  /* To be used without the NUL byte. */
     uint32_t version;                 /* Version in big endian format. */
-#define XS_STATE_VERSION  0x00000001
+#define XS_STATE_VERSION  0x00000002
     uint32_t flags;                   /* Endianess. */
 #if __BYTE_ORDER == __LITTLE_ENDIAN
 #define XS_STATE_FLAGS    0x00000000  /* Little endian. */
@@ -59,6 +61,9 @@ struct xs_state_record_header {
 #define XS_STATE_TYPE_WATCH      0x00000003
 #define XS_STATE_TYPE_TA         0x00000004
 #define XS_STATE_TYPE_NODE       0x00000005
+#define XS_STATE_TYPE_GLB_QUOTA  0x00000006
+#define XS_STATE_TYPE_DOMAIN     0x00000007
+#define XS_STATE_TYPE_WATCH_EXT  0x00000008
     uint32_t length;         /* Length of record in bytes. */
 };
 
@@ -98,6 +103,15 @@ struct xs_state_watch {
     uint8_t data[];         /* Path bytes, token bytes, 0-7 pad bytes. */
 };
 
+struct xs_state_watch_ext {
+    uint32_t conn_id;       /* Connection this watch is associated with. */
+    uint16_t path_length;   /* Number of bytes of path watched (incl. 0). */
+    uint16_t token_length;  /* Number of bytes of watch token (incl. 0). */
+    uint16_t depth;         /* Number of directory levels below watched path */
+                            /* to consider for a match. */
+    uint8_t data[];         /* Path bytes, token bytes, 0-7 pad bytes. */
+};
+
 /* Transaction: */
 struct xs_state_transaction {
     uint32_t conn_id;       /* Connection this TA is associated with. */
@@ -129,4 +143,19 @@ struct xs_state_node {
     struct xs_state_node_perm perms[];
     /* Path and data follows, plus 0-7 pad bytes. */
 };
+
+/* Global quota data: */
+struct xs_state_glb_quota {
+    uint16_t n_dom_quota;   /* Number of quota values applying to domains. */
+    uint16_t n_glob_quota;  /* Number of quota values applying globally only. 
*/
+    uint32_t quota_val[];   /* Array of quota values (domain ones first). */
+};
+
+/* Domain data: */
+struct xs_state_domain {
+    uint16_t domain_id;     /* Domain-id identifying the domain. */
+    uint16_t n_quota;       /* Number of quota values. */
+    uint32_t features;      /* Server features available to the domain. */
+    uint32_t quota_val[];   /* Array of quota values. */
+};
 #endif /* XENSTORE_STATE_H */
-- 
2.43.0




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.