]> git.proxmox.com Git - mirror_edk2.git/blob - OvmfPkg/Include/IndustryStandard/Xen/io/xs_wire.h
OvmfPkg: Apply uncrustify changes
[mirror_edk2.git] / OvmfPkg / Include / IndustryStandard / Xen / io / xs_wire.h
1 /*
2 * Details of the "wire" protocol between Xen Store Daemon and client
3 * library or guest kernel.
4 *
5 * SPDX-License-Identifier: MIT
6 *
7 * Copyright (C) 2005 Rusty Russell IBM Corporation
8 */
9
10 #ifndef _XS_WIRE_H
11 #define _XS_WIRE_H
12
13 enum xsd_sockmsg_type {
14 XS_DEBUG,
15 XS_DIRECTORY,
16 XS_READ,
17 XS_GET_PERMS,
18 XS_WATCH,
19 XS_UNWATCH,
20 XS_TRANSACTION_START,
21 XS_TRANSACTION_END,
22 XS_INTRODUCE,
23 XS_RELEASE,
24 XS_GET_DOMAIN_PATH,
25 XS_WRITE,
26 XS_MKDIR,
27 XS_RM,
28 XS_SET_PERMS,
29 XS_WATCH_EVENT,
30 XS_ERROR,
31 XS_IS_DOMAIN_INTRODUCED,
32 XS_RESUME,
33 XS_SET_TARGET,
34 XS_RESTRICT,
35 XS_RESET_WATCHES,
36
37 XS_INVALID = 0xffff /* Guaranteed to remain an invalid type */
38 };
39
40 #define XS_WRITE_NONE "NONE"
41 #define XS_WRITE_CREATE "CREATE"
42 #define XS_WRITE_CREATE_EXCL "CREATE|EXCL"
43
44 /* We hand errors as strings, for portability. */
45 struct xsd_errors {
46 INT32 errnum;
47 const CHAR8 *errstring;
48 };
49
50 #ifdef EINVAL
51 #define XSD_ERROR(x) { x, #x }
52 /* LINTED: static unused */
53 static struct xsd_errors xsd_errors[]
54 #if defined (__GNUC__)
55 __attribute__ ((unused))
56 #endif
57 = {
58 XSD_ERROR (EINVAL),
59 XSD_ERROR (EACCES),
60 XSD_ERROR (EEXIST),
61 XSD_ERROR (EISDIR),
62 XSD_ERROR (ENOENT),
63 XSD_ERROR (ENOMEM),
64 XSD_ERROR (ENOSPC),
65 XSD_ERROR (EIO),
66 XSD_ERROR (ENOTEMPTY),
67 XSD_ERROR (ENOSYS),
68 XSD_ERROR (EROFS),
69 XSD_ERROR (EBUSY),
70 XSD_ERROR (EAGAIN),
71 XSD_ERROR (EISCONN),
72 XSD_ERROR (E2BIG)
73 };
74 #endif
75
76 struct xsd_sockmsg {
77 UINT32 type; /* XS_??? */
78 UINT32 req_id; /* Request identifier, echoed in daemon's response. */
79 UINT32 tx_id; /* Transaction id (0 if not related to a transaction). */
80 UINT32 len; /* Length of data following this. */
81
82 /* Generally followed by nul-terminated string(s). */
83 };
84
85 enum xs_watch_type {
86 XS_WATCH_PATH = 0,
87 XS_WATCH_TOKEN
88 };
89
90 /*
91 * `incontents 150 xenstore_struct XenStore wire protocol.
92 *
93 * Inter-domain shared memory communications. */
94 #define XENSTORE_RING_SIZE 1024
95 typedef UINT32 XENSTORE_RING_IDX;
96 #define MASK_XENSTORE_IDX(idx) ((idx) & (XENSTORE_RING_SIZE-1))
97 struct xenstore_domain_interface {
98 CHAR8 req[XENSTORE_RING_SIZE]; /* Requests to xenstore daemon. */
99 CHAR8 rsp[XENSTORE_RING_SIZE]; /* Replies and async watch events. */
100 XENSTORE_RING_IDX req_cons, req_prod;
101 XENSTORE_RING_IDX rsp_cons, rsp_prod;
102 UINT32 server_features; /* Bitmap of features supported by the server */
103 UINT32 connection;
104 };
105
106 /* Violating this is very bad. See docs/misc/xenstore.txt. */
107 #define XENSTORE_PAYLOAD_MAX 4096
108
109 /* Violating these just gets you an error back */
110 #define XENSTORE_ABS_PATH_MAX 3072
111 #define XENSTORE_REL_PATH_MAX 2048
112
113 /* The ability to reconnect a ring */
114 #define XENSTORE_SERVER_FEATURE_RECONNECTION 1
115
116 /* Valid values for the connection field */
117 #define XENSTORE_CONNECTED 0 /* the steady-state */
118 #define XENSTORE_RECONNECT 1 /* guest has initiated a reconnect */
119
120 #endif /* _XS_WIRE_H */
121
122 /*
123 * Local variables:
124 * mode: C
125 * c-file-style: "BSD"
126 * c-basic-offset: 4
127 * tab-width: 4
128 * indent-tabs-mode: nil
129 * End:
130 */