iPXE
include
xen
io
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
12
FILE_LICENCE
( MIT );
13
14
enum
xsd_sockmsg_type
15
{
16
XS_CONTROL
,
17
#define XS_DEBUG XS_CONTROL
18
XS_DIRECTORY
,
19
XS_READ
,
20
XS_GET_PERMS
,
21
XS_WATCH
,
22
XS_UNWATCH
,
23
XS_TRANSACTION_START
,
24
XS_TRANSACTION_END
,
25
XS_INTRODUCE
,
26
XS_RELEASE
,
27
XS_GET_DOMAIN_PATH
,
28
XS_WRITE
,
29
XS_MKDIR
,
30
XS_RM
,
31
XS_SET_PERMS
,
32
XS_WATCH_EVENT
,
33
XS_ERROR
,
34
XS_IS_DOMAIN_INTRODUCED
,
35
XS_RESUME
,
36
XS_SET_TARGET
,
37
/* XS_RESTRICT has been removed */
38
XS_RESET_WATCHES
=
XS_SET_TARGET
+ 2,
39
XS_DIRECTORY_PART
,
40
41
XS_TYPE_COUNT
,
/* Number of valid types. */
42
43
XS_INVALID
= 0xffff
/* Guaranteed to remain an invalid type */
44
};
45
46
#define XS_WRITE_NONE "NONE"
47
#define XS_WRITE_CREATE "CREATE"
48
#define XS_WRITE_CREATE_EXCL "CREATE|EXCL"
49
50
/* We hand errors as strings, for portability. */
51
struct
xsd_errors
52
{
53
int
errnum
;
54
const
char
*
errstring
;
55
};
56
#ifdef EINVAL
57
#define XSD_ERROR(x) { x, #x }
58
/* LINTED: static unused */
59
static
const
struct
xsd_errors
xsd_errors
[]
60
#
if
defined(__GNUC__)
61
__attribute__
((
unused
))
62
#endif
63
= {
64
/* /!\ New errors should be added at the end of the array. */
65
XSD_ERROR(
EINVAL
),
66
XSD_ERROR(
EACCES
),
67
XSD_ERROR(
EEXIST
),
68
XSD_ERROR(
EISDIR
),
69
XSD_ERROR(
ENOENT
),
70
XSD_ERROR(
ENOMEM
),
71
XSD_ERROR(
ENOSPC
),
72
XSD_ERROR(
EIO
),
73
XSD_ERROR(
ENOTEMPTY
),
74
XSD_ERROR(
ENOSYS
),
75
XSD_ERROR(
EROFS
),
76
XSD_ERROR(
EBUSY
),
77
XSD_ERROR(
EAGAIN
),
78
XSD_ERROR(
EISCONN
),
79
XSD_ERROR(
E2BIG
),
80
XSD_ERROR(
EPERM
),
81
};
82
#endif
83
84
struct
xsd_sockmsg
85
{
86
uint32_t
type
;
/* XS_??? */
87
uint32_t
req_id
;
/* Request identifier, echoed in daemon's response. */
88
uint32_t
tx_id
;
/* Transaction id (0 if not related to a transaction). */
89
uint32_t
len
;
/* Length of data following this. */
90
91
/* Generally followed by nul-terminated string(s). */
92
};
93
94
enum
xs_watch_type
95
{
96
XS_WATCH_PATH
= 0,
97
XS_WATCH_TOKEN
98
};
99
100
/*
101
* `incontents 150 xenstore_struct XenStore wire protocol.
102
*
103
* Inter-domain shared memory communications. */
104
#define XENSTORE_RING_SIZE 1024
105
typedef
uint32_t
XENSTORE_RING_IDX
;
106
#define MASK_XENSTORE_IDX(idx) ((idx) & (XENSTORE_RING_SIZE-1))
107
struct
xenstore_domain_interface
{
108
char
req
[
XENSTORE_RING_SIZE
];
/* Requests to xenstore daemon. */
109
char
rsp
[
XENSTORE_RING_SIZE
];
/* Replies and async watch events. */
110
XENSTORE_RING_IDX
req_cons
,
req_prod
;
111
XENSTORE_RING_IDX
rsp_cons
,
rsp_prod
;
112
uint32_t
server_features
;
/* Bitmap of features supported by the server */
113
uint32_t
connection
;
114
uint32_t
error
;
115
};
116
117
/* Violating this is very bad. See docs/misc/xenstore.txt. */
118
#define XENSTORE_PAYLOAD_MAX 4096
119
120
/* Violating these just gets you an error back */
121
#define XENSTORE_ABS_PATH_MAX 3072
122
#define XENSTORE_REL_PATH_MAX 2048
123
124
/* The ability to reconnect a ring */
125
#define XENSTORE_SERVER_FEATURE_RECONNECTION 1
126
/* The presence of the "error" field in the ring page */
127
#define XENSTORE_SERVER_FEATURE_ERROR 2
128
129
/* Valid values for the connection field */
130
#define XENSTORE_CONNECTED 0
/* the steady-state */
131
#define XENSTORE_RECONNECT 1
/* reconnect in progress */
132
133
/* Valid values for the error field */
134
#define XENSTORE_ERROR_NONE 0
/* No error */
135
#define XENSTORE_ERROR_COMM 1
/* Communication problem */
136
#define XENSTORE_ERROR_RINGIDX 2
/* Invalid ring index */
137
#define XENSTORE_ERROR_PROTO 3
/* Protocol violation (payload too long) */
138
139
#endif
/* _XS_WIRE_H */
140
141
/*
142
* Local variables:
143
* mode: C
144
* c-file-style: "BSD"
145
* c-basic-offset: 4
146
* tab-width: 4
147
* indent-tabs-mode: nil
148
* End:
149
*/
XS_RESUME
Definition:
xs_wire.h:35
EINVAL
#define EINVAL
Invalid argument.
Definition:
errno.h:428
xenstore_domain_interface::server_features
uint32_t server_features
Definition:
xs_wire.h:112
XS_WATCH_EVENT
Definition:
xs_wire.h:32
XS_CONTROL
Definition:
xs_wire.h:16
XS_RM
Definition:
xs_wire.h:30
EBUSY
#define EBUSY
Device or resource busy.
Definition:
errno.h:338
EISCONN
#define EISCONN
Socket is connected.
Definition:
errno.h:438
XENSTORE_RING_IDX
uint32_t XENSTORE_RING_IDX
Definition:
xs_wire.h:105
xenstore_domain_interface
Definition:
xs_wire.h:107
xenstore_domain_interface::req
char req[XENSTORE_RING_SIZE]
Definition:
xs_wire.h:108
xsd_errors::errnum
int errnum
Definition:
xs_wire.h:53
EEXIST
#define EEXIST
File exists.
Definition:
errno.h:388
XS_WRITE
Definition:
xs_wire.h:28
XS_WATCH_PATH
Definition:
xs_wire.h:96
EISDIR
#define EISDIR
Is a directory.
Definition:
errno.h:443
xenstore_domain_interface::rsp_cons
XENSTORE_RING_IDX rsp_cons
Definition:
xs_wire.h:111
ENOENT
#define ENOENT
No such file or directory.
Definition:
errno.h:514
xsd_sockmsg::req_id
uint32_t req_id
Definition:
xs_wire.h:87
EACCES
#define EACCES
Permission denied.
Definition:
errno.h:298
XS_WATCH
Definition:
xs_wire.h:21
xsd_errors
Definition:
xs_wire.h:51
xs_watch_type
xs_watch_type
Definition:
xs_wire.h:94
ENOTEMPTY
#define ENOTEMPTY
Directory not empty.
Definition:
errno.h:579
ENOMEM
#define ENOMEM
Not enough space.
Definition:
errno.h:534
XS_WATCH_TOKEN
Definition:
xs_wire.h:97
XS_TRANSACTION_END
Definition:
xs_wire.h:24
XS_SET_TARGET
Definition:
xs_wire.h:36
XS_GET_PERMS
Definition:
xs_wire.h:20
__attribute__
A 16-bit general register.
Definition:
registers.h:24
E2BIG
#define E2BIG
Argument list too long.
Definition:
errno.h:293
XS_INTRODUCE
Definition:
xs_wire.h:25
XS_MKDIR
Definition:
xs_wire.h:29
XS_IS_DOMAIN_INTRODUCED
Definition:
xs_wire.h:34
XS_INVALID
Definition:
xs_wire.h:43
xenstore_domain_interface::rsp_prod
XENSTORE_RING_IDX rsp_prod
Definition:
xs_wire.h:111
uint32_t
unsigned int uint32_t
Definition:
stdint.h:12
xsd_sockmsg::type
uint32_t type
Definition:
xs_wire.h:86
EAGAIN
#define EAGAIN
Resource temporarily unavailable.
Definition:
errno.h:318
unused
uint8_t unused
Unused.
Definition:
librm.h:254
XS_TRANSACTION_START
Definition:
xs_wire.h:23
xenstore_domain_interface::req_prod
XENSTORE_RING_IDX req_prod
Definition:
xs_wire.h:110
FILE_LICENCE
FILE_LICENCE(MIT)
xsd_sockmsg::tx_id
uint32_t tx_id
Definition:
xs_wire.h:88
EPERM
#define EPERM
Operation not permitted.
Definition:
errno.h:614
ENOSPC
#define ENOSPC
No space left on device.
Definition:
errno.h:549
XS_RELEASE
Definition:
xs_wire.h:26
xsd_sockmsg
Definition:
xs_wire.h:84
XS_READ
Definition:
xs_wire.h:19
EIO
#define EIO
Input/output error.
Definition:
errno.h:433
xenstore_domain_interface::req_cons
XENSTORE_RING_IDX req_cons
Definition:
xs_wire.h:110
XS_DIRECTORY
Definition:
xs_wire.h:18
xsd_sockmsg_type
xsd_sockmsg_type
Definition:
xs_wire.h:14
XS_ERROR
Definition:
xs_wire.h:33
ENOSYS
#define ENOSYS
Function not implemented.
Definition:
errno.h:564
EROFS
#define EROFS
Read-only file system.
Definition:
errno.h:644
xenstore_domain_interface::rsp
char rsp[XENSTORE_RING_SIZE]
Definition:
xs_wire.h:109
XS_SET_PERMS
Definition:
xs_wire.h:31
XS_TYPE_COUNT
Definition:
xs_wire.h:41
XS_RESET_WATCHES
Definition:
xs_wire.h:38
xsd_errors::errstring
const char * errstring
Definition:
xs_wire.h:54
XS_UNWATCH
Definition:
xs_wire.h:22
xsd_sockmsg::len
uint32_t len
Definition:
xs_wire.h:89
xenstore_domain_interface::connection
uint32_t connection
Definition:
xs_wire.h:113
XENSTORE_RING_SIZE
#define XENSTORE_RING_SIZE
Definition:
xs_wire.h:104
XS_GET_DOMAIN_PATH
Definition:
xs_wire.h:27
if
if(natsemi->flags &NATSEMI_64BIT) return 1
XS_DIRECTORY_PART
Definition:
xs_wire.h:39
xenstore_domain_interface::error
uint32_t error
Definition:
xs_wire.h:114
Generated by
1.8.15