Path: blob/master/include/xen/interface/io/xs_wire.h
10818 views
/*1* Details of the "wire" protocol between Xen Store Daemon and client2* library or guest kernel.3* Copyright (C) 2005 Rusty Russell IBM Corporation4*/56#ifndef _XS_WIRE_H7#define _XS_WIRE_H89enum xsd_sockmsg_type10{11XS_DEBUG,12XS_DIRECTORY,13XS_READ,14XS_GET_PERMS,15XS_WATCH,16XS_UNWATCH,17XS_TRANSACTION_START,18XS_TRANSACTION_END,19XS_INTRODUCE,20XS_RELEASE,21XS_GET_DOMAIN_PATH,22XS_WRITE,23XS_MKDIR,24XS_RM,25XS_SET_PERMS,26XS_WATCH_EVENT,27XS_ERROR,28XS_IS_DOMAIN_INTRODUCED29};3031#define XS_WRITE_NONE "NONE"32#define XS_WRITE_CREATE "CREATE"33#define XS_WRITE_CREATE_EXCL "CREATE|EXCL"3435/* We hand errors as strings, for portability. */36struct xsd_errors37{38int errnum;39const char *errstring;40};41#define XSD_ERROR(x) { x, #x }42static struct xsd_errors xsd_errors[] __attribute__((unused)) = {43XSD_ERROR(EINVAL),44XSD_ERROR(EACCES),45XSD_ERROR(EEXIST),46XSD_ERROR(EISDIR),47XSD_ERROR(ENOENT),48XSD_ERROR(ENOMEM),49XSD_ERROR(ENOSPC),50XSD_ERROR(EIO),51XSD_ERROR(ENOTEMPTY),52XSD_ERROR(ENOSYS),53XSD_ERROR(EROFS),54XSD_ERROR(EBUSY),55XSD_ERROR(EAGAIN),56XSD_ERROR(EISCONN)57};5859struct xsd_sockmsg60{61uint32_t type; /* XS_??? */62uint32_t req_id;/* Request identifier, echoed in daemon's response. */63uint32_t tx_id; /* Transaction id (0 if not related to a transaction). */64uint32_t len; /* Length of data following this. */6566/* Generally followed by nul-terminated string(s). */67};6869enum xs_watch_type70{71XS_WATCH_PATH = 0,72XS_WATCH_TOKEN73};7475/* Inter-domain shared memory communications. */76#define XENSTORE_RING_SIZE 102477typedef uint32_t XENSTORE_RING_IDX;78#define MASK_XENSTORE_IDX(idx) ((idx) & (XENSTORE_RING_SIZE-1))79struct xenstore_domain_interface {80char req[XENSTORE_RING_SIZE]; /* Requests to xenstore daemon. */81char rsp[XENSTORE_RING_SIZE]; /* Replies and async watch events. */82XENSTORE_RING_IDX req_cons, req_prod;83XENSTORE_RING_IDX rsp_cons, rsp_prod;84};8586#endif /* _XS_WIRE_H */878889