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@suse.com>
Reviewed-by: Jason Andryuk <jason.andryuk@amd.com>
This commit is contained in:
Juergen Gross authored and Jan Beulich committed 2025-07-28 13:06:55 +02:00
1 parent a19e32fcfb
commit 1e675413cb
3 files changed
+32 -3

No files matched your search

+1 -1
View File
@@ -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>]" },
+1 -1
View File
@@ -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);
+30 -1
View File
@@ -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 */
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.