Linux Audio

Check our new training course

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