iPXE
xs_wire.h
Go to the documentation of this file.
1/* SPDX-License-Identifier: MIT */
2/*
3 * Details of the "wire" protocol between Xen Store Daemon and client
4 * library or guest kernel.
5 *
6 * Copyright (C) 2005 Rusty Russell IBM Corporation
7 */
8
9#ifndef _XS_WIRE_H
10#define _XS_WIRE_H
11
13FILE_SECBOOT ( PERMITTED );
14
50
51/* We hand errors as strings, for portability. */
53{
54 int errnum;
55 const char *errstring;
56};
57#ifdef EINVAL
58#define XSD_ERROR(x) { x, #x }
59/* LINTED: static unused */
60static const struct xsd_errors xsd_errors[]
61#if defined(__GNUC__)
63#endif
64 = {
65 /* /!\ New errors should be added at the end of the array. */
66 XSD_ERROR(EINVAL),
67 XSD_ERROR(EACCES),
68 XSD_ERROR(EEXIST),
69 XSD_ERROR(EISDIR),
70 XSD_ERROR(ENOENT),
71 XSD_ERROR(ENOMEM),
72 XSD_ERROR(ENOSPC),
73 XSD_ERROR(EIO),
74 XSD_ERROR(ENOTEMPTY),
75 XSD_ERROR(ENOSYS),
76 XSD_ERROR(EROFS),
77 XSD_ERROR(EBUSY),
78 XSD_ERROR(EAGAIN),
79 XSD_ERROR(EISCONN),
80 XSD_ERROR(E2BIG),
81 XSD_ERROR(EPERM),
82};
83#endif
84
86{
87 uint32_t type; /* XS_??? */
88 uint32_t req_id;/* Request identifier, echoed in daemon's response. */
89 uint32_t tx_id; /* Transaction id (0 if not related to a transaction). */
90 uint32_t len; /* Length of data following this. */
91
92 /* Generally followed by nul-terminated string(s). */
93};
94
100
101/*
102 * `incontents 150 xenstore_struct XenStore wire protocol.
103 *
104 * Inter-domain shared memory communications. */
105#define XENSTORE_RING_SIZE 1024
107#define MASK_XENSTORE_IDX(idx) ((idx) & (XENSTORE_RING_SIZE-1))
109 char req[XENSTORE_RING_SIZE]; /* Requests to xenstore daemon. */
110 char rsp[XENSTORE_RING_SIZE]; /* Replies and async watch events. */
113 uint32_t server_features; /* Bitmap of features supported by the server */
117};
118
119/* Violating this is very bad. See docs/misc/xenstore.txt. */
120#define XENSTORE_PAYLOAD_MAX 4096
121
122/* Violating these just gets you an error back */
123#define XENSTORE_ABS_PATH_MAX 3072
124#define XENSTORE_REL_PATH_MAX 2048
125
126/* The ability to reconnect a ring */
127#define XENSTORE_SERVER_FEATURE_RECONNECTION 1
128/* The presence of the "error" field in the ring page */
129#define XENSTORE_SERVER_FEATURE_ERROR 2
130
131/* Valid values for the connection field */
132#define XENSTORE_CONNECTED 0 /* the steady-state */
133#define XENSTORE_RECONNECT 1 /* reconnect in progress */
134
135/* Valid values for the error field */
136#define XENSTORE_ERROR_NONE 0 /* No error */
137#define XENSTORE_ERROR_COMM 1 /* Communication problem */
138#define XENSTORE_ERROR_RINGIDX 2 /* Invalid ring index */
139#define XENSTORE_ERROR_PROTO 3 /* Protocol violation (payload too long) */
140
141/*
142 * The evtchn_port field is the domain's event channel for xenstored to signal.
143 * It is filled in by Xen for dom0less/Hyperlaunch domains. It is only used
144 * when non-zero. Otherwise the event channel from XS_INTRODUCE is used.
145 */
146
147#endif /* _XS_WIRE_H */
148
149/*
150 * Local variables:
151 * mode: C
152 * c-file-style: "BSD"
153 * c-basic-offset: 4
154 * tab-width: 4
155 * indent-tabs-mode: nil
156 * End:
157 */
unsigned int uint32_t
Definition stdint.h:12
#define FILE_LICENCE(_licence)
Declare a particular licence as applying to a file.
Definition compiler.h:896
#define ENOENT
No such file or directory.
Definition errno.h:515
#define ENOSPC
No space left on device.
Definition errno.h:550
#define EEXIST
File exists.
Definition errno.h:389
#define EISCONN
Socket is connected.
Definition errno.h:439
#define EINVAL
Invalid argument.
Definition errno.h:429
#define ENOSYS
Function not implemented.
Definition errno.h:565
#define ENOMEM
Not enough space.
Definition errno.h:535
#define EIO
Input/output error.
Definition errno.h:434
#define EBUSY
Device or resource busy.
Definition errno.h:339
#define ENOTEMPTY
Directory not empty.
Definition errno.h:580
#define E2BIG
Argument list too long.
Definition errno.h:294
#define EACCES
Permission denied.
Definition errno.h:299
#define EROFS
Read-only file system.
Definition errno.h:645
#define EPERM
Operation not permitted.
Definition errno.h:615
#define EISDIR
Is a directory.
Definition errno.h:444
#define EAGAIN
Resource temporarily unavailable.
Definition errno.h:319
#define FILE_SECBOOT(_status)
Declare a file's UEFI Secure Boot permission status.
Definition compiler.h:926
#define __attribute__(x)
Definition compiler.h:10
uint8_t unused
Unused.
Definition librm.h:5
if(natsemi->flags &NATSEMI_64BIT) return 1
XENSTORE_RING_IDX req_prod
Definition xs_wire.h:111
char req[XENSTORE_RING_SIZE]
Definition xs_wire.h:109
XENSTORE_RING_IDX rsp_prod
Definition xs_wire.h:112
XENSTORE_RING_IDX rsp_cons
Definition xs_wire.h:112
XENSTORE_RING_IDX req_cons
Definition xs_wire.h:111
char rsp[XENSTORE_RING_SIZE]
Definition xs_wire.h:110
const char * errstring
Definition xs_wire.h:55
int errnum
Definition xs_wire.h:54
uint32_t len
Definition xs_wire.h:90
uint32_t req_id
Definition xs_wire.h:88
uint32_t tx_id
Definition xs_wire.h:89
uint32_t type
Definition xs_wire.h:87
#define XENSTORE_RING_SIZE
Definition xs_wire.h:105
xsd_sockmsg_type
Definition xs_wire.h:16
@ XS_GET_QUOTA
Definition xs_wire.h:43
@ XS_INVALID
Definition xs_wire.h:48
@ XS_RELEASE
Definition xs_wire.h:27
@ XS_WRITE
Definition xs_wire.h:29
@ XS_MKDIR
Definition xs_wire.h:30
@ XS_CONTROL
Definition xs_wire.h:17
@ XS_DIRECTORY_PART
Definition xs_wire.h:40
@ XS_IS_DOMAIN_INTRODUCED
Definition xs_wire.h:35
@ XS_TRANSACTION_START
Definition xs_wire.h:24
@ XS_GET_DOMAIN_PATH
Definition xs_wire.h:28
@ XS_DIRECTORY
Definition xs_wire.h:19
@ XS_WATCH_EVENT
Definition xs_wire.h:33
@ XS_READ
Definition xs_wire.h:20
@ XS_TYPE_COUNT
Definition xs_wire.h:46
@ XS_GET_FEATURE
Definition xs_wire.h:41
@ XS_RESET_WATCHES
Definition xs_wire.h:39
@ XS_RESUME
Definition xs_wire.h:36
@ XS_ERROR
Definition xs_wire.h:34
@ XS_SET_QUOTA
Definition xs_wire.h:44
@ XS_INTRODUCE
Definition xs_wire.h:26
@ XS_UNWATCH
Definition xs_wire.h:23
@ XS_WATCH
Definition xs_wire.h:22
@ XS_SET_TARGET
Definition xs_wire.h:37
@ XS_RM
Definition xs_wire.h:31
@ XS_GET_PERMS
Definition xs_wire.h:21
@ XS_SET_PERMS
Definition xs_wire.h:32
@ XS_TRANSACTION_END
Definition xs_wire.h:25
@ XS_SET_FEATURE
Definition xs_wire.h:42
xs_watch_type
Definition xs_wire.h:96
@ XS_WATCH_TOKEN
Definition xs_wire.h:98
@ XS_WATCH_PATH
Definition xs_wire.h:97
uint32_t XENSTORE_RING_IDX
Definition xs_wire.h:106