iPXE
xs_wire.h
Go to the documentation of this file.
1 /*
2  * Details of the "wire" protocol between Xen Store Daemon and client
3  * library or guest kernel.
4  *
5  * Permission is hereby granted, free of charge, to any person obtaining a copy
6  * of this software and associated documentation files (the "Software"), to
7  * deal in the Software without restriction, including without limitation the
8  * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
9  * sell copies of the Software, and to permit persons to whom the Software is
10  * furnished to do so, subject to the following conditions:
11  *
12  * The above copyright notice and this permission notice shall be included in
13  * all copies or substantial portions of the Software.
14  *
15  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21  * DEALINGS IN THE SOFTWARE.
22  *
23  * Copyright (C) 2005 Rusty Russell IBM Corporation
24  */
25 
26 #ifndef _XS_WIRE_H
27 #define _XS_WIRE_H
28 
29 FILE_LICENCE ( MIT );
30 
32 {
55 };
56 
57 #define XS_WRITE_NONE "NONE"
58 #define XS_WRITE_CREATE "CREATE"
59 #define XS_WRITE_CREATE_EXCL "CREATE|EXCL"
60 
61 /* We hand errors as strings, for portability. */
62 struct xsd_errors
63 {
64  int errnum;
65  const char *errstring;
66 };
67 #ifdef EINVAL
68 #define XSD_ERROR(x) { x, #x }
69 /* LINTED: static unused */
70 static struct xsd_errors xsd_errors[]
71 #if defined(__GNUC__)
73 #endif
74  = {
75  XSD_ERROR(EINVAL),
76  XSD_ERROR(EACCES),
77  XSD_ERROR(EEXIST),
78  XSD_ERROR(EISDIR),
79  XSD_ERROR(ENOENT),
80  XSD_ERROR(ENOMEM),
81  XSD_ERROR(ENOSPC),
82  XSD_ERROR(EIO),
83  XSD_ERROR(ENOTEMPTY),
84  XSD_ERROR(ENOSYS),
85  XSD_ERROR(EROFS),
86  XSD_ERROR(EBUSY),
87  XSD_ERROR(EAGAIN),
88  XSD_ERROR(EISCONN),
89  XSD_ERROR(E2BIG)
90 };
91 #endif
92 
94 {
95  uint32_t type; /* XS_??? */
96  uint32_t req_id;/* Request identifier, echoed in daemon's response. */
97  uint32_t tx_id; /* Transaction id (0 if not related to a transaction). */
98  uint32_t len; /* Length of data following this. */
99 
100  /* Generally followed by nul-terminated string(s). */
101 };
102 
104 {
107 };
108 
109 /*
110  * `incontents 150 xenstore_struct XenStore wire protocol.
111  *
112  * Inter-domain shared memory communications. */
113 #define XENSTORE_RING_SIZE 1024
115 #define MASK_XENSTORE_IDX(idx) ((idx) & (XENSTORE_RING_SIZE-1))
117  char req[XENSTORE_RING_SIZE]; /* Requests to xenstore daemon. */
118  char rsp[XENSTORE_RING_SIZE]; /* Replies and async watch events. */
121 };
122 
123 /* Violating this is very bad. See docs/misc/xenstore.txt. */
124 #define XENSTORE_PAYLOAD_MAX 4096
125 
126 /* Violating these just gets you an error back */
127 #define XENSTORE_ABS_PATH_MAX 3072
128 #define XENSTORE_REL_PATH_MAX 2048
129 
130 #endif /* _XS_WIRE_H */
131 
132 /*
133  * Local variables:
134  * mode: C
135  * c-file-style: "BSD"
136  * c-basic-offset: 4
137  * tab-width: 4
138  * indent-tabs-mode: nil
139  * End:
140  */
#define EINVAL
Invalid argument.
Definition: errno.h:428
Definition: xs_wire.h:46
#define EBUSY
Device or resource busy.
Definition: errno.h:338
#define EISCONN
Socket is connected.
Definition: errno.h:438
uint32_t XENSTORE_RING_IDX
Definition: xs_wire.h:114
char req[XENSTORE_RING_SIZE]
Definition: xs_wire.h:117
int errnum
Definition: xs_wire.h:64
#define EEXIST
File exists.
Definition: errno.h:388
#define EISDIR
Is a directory.
Definition: errno.h:443
XENSTORE_RING_IDX rsp_cons
Definition: xs_wire.h:120
#define ENOENT
No such file or directory.
Definition: errno.h:514
uint32_t req_id
Definition: xs_wire.h:96
#define EACCES
Permission denied.
Definition: errno.h:298
xs_watch_type
Definition: xs_wire.h:103
#define ENOTEMPTY
Directory not empty.
Definition: errno.h:579
#define ENOMEM
Not enough space.
Definition: errno.h:534
A 16-bit general register.
Definition: registers.h:24
#define E2BIG
Argument list too long.
Definition: errno.h:293
XENSTORE_RING_IDX rsp_prod
Definition: xs_wire.h:120
unsigned int uint32_t
Definition: stdint.h:12
uint32_t type
Definition: xs_wire.h:95
#define EAGAIN
Resource temporarily unavailable.
Definition: errno.h:318
XENSTORE_RING_IDX req_prod
Definition: xs_wire.h:119
FILE_LICENCE(MIT)
uint32_t tx_id
Definition: xs_wire.h:97
#define ENOSPC
No space left on device.
Definition: errno.h:549
uint8_t unused[32]
Unused.
Definition: eltorito.h:15
#define EIO
Input/output error.
Definition: errno.h:433
XENSTORE_RING_IDX req_cons
Definition: xs_wire.h:119
xsd_sockmsg_type
Definition: xs_wire.h:31
#define ENOSYS
Function not implemented.
Definition: errno.h:564
#define EROFS
Read-only file system.
Definition: errno.h:644
char rsp[XENSTORE_RING_SIZE]
Definition: xs_wire.h:118
const char * errstring
Definition: xs_wire.h:65
uint32_t len
Definition: xs_wire.h:98
#define XENSTORE_RING_SIZE
Definition: xs_wire.h:113
if(natsemi->flags &NATSEMI_64BIT) return 1