|
iPXE
|
XenStore interface. More...
#include <stdint.h>#include <stdarg.h>#include <stdlib.h>#include <stdio.h>#include <string.h>#include <ipxe/io.h>#include <ipxe/nap.h>#include <ipxe/malloc.h>#include <ipxe/xen.h>#include <ipxe/xenevent.h>#include <ipxe/xenstore.h>#include <xen/io/xs_wire.h>#include <errno.h>Go to the source code of this file.
Functions | |
| FILE_LICENCE (GPL2_OR_LATER_OR_UBDL) | |
| static void | xenstore_send (struct xen_hypervisor *xen, const void *data, size_t len) |
| Send XenStore request raw data. More... | |
| static void | xenstore_send_string (struct xen_hypervisor *xen, const char *string) |
| Send XenStore request string (excluding terminating NUL) More... | |
| static void | xenstore_recv (struct xen_hypervisor *xen, void *data, size_t len) |
| Receive XenStore response raw data. More... | |
| static int | xenstore_request (struct xen_hypervisor *xen, enum xsd_sockmsg_type type, uint32_t req_id, const char *value, va_list key) |
| Send XenStore request. More... | |
| static int | xenstore_response (struct xen_hypervisor *xen, uint32_t req_id, char **value, size_t *len) |
| Receive XenStore response. More... | |
| static int | xenstore_message (struct xen_hypervisor *xen, enum xsd_sockmsg_type type, char **response, size_t *len, const char *request, va_list key) |
| Issue a XenStore message. More... | |
| static int | xenstore_vread (struct xen_hypervisor *xen, char **value, va_list key) |
| Read XenStore value. More... | |
| int | xenstore_read (struct xen_hypervisor *xen, char **value,...) |
| Read XenStore value. More... | |
| int | xenstore_read_num (struct xen_hypervisor *xen, unsigned long *num,...) |
| Read XenStore numeric value. More... | |
| static int | xenstore_vwrite (struct xen_hypervisor *xen, const char *value, va_list key) |
| Write XenStore value. More... | |
| int | xenstore_write (struct xen_hypervisor *xen, const char *value,...) |
| Write XenStore value. More... | |
| int | xenstore_write_num (struct xen_hypervisor *xen, unsigned long num,...) |
| Write XenStore numeric value. More... | |
| int | xenstore_rm (struct xen_hypervisor *xen,...) |
| Delete XenStore value. More... | |
| int | xenstore_directory (struct xen_hypervisor *xen, char **children, size_t *len,...) |
| Read XenStore directory. More... | |
| void | xenstore_dump (struct xen_hypervisor *xen, const char *key) |
| Dump XenStore directory contents (for debugging) More... | |
Variables | |
| static uint32_t | xenstore_req_id |
| Request identifier. More... | |
XenStore interface.
Definition in file xenstore.c.
| FILE_LICENCE | ( | GPL2_OR_LATER_OR_UBDL | ) |
|
static |
Send XenStore request raw data.
| xen | Xen hypervisor |
| data | Data buffer |
| len | Length of data |
Definition at line 64 of file xenstore.c.
References bytes, cons, cpu_nap(), data, DBGC2, DBGCP, DBGCP_HDA, fill, xen_store::intf, len, MASK_XENSTORE_IDX, offset, readl(), xenstore_domain_interface::req, xenstore_domain_interface::req_cons, xenstore_domain_interface::req_prod, rmb, xen_hypervisor::store, wmb(), writeb(), writel(), and XENSTORE_RING_SIZE.
Referenced by xenstore_request(), and xenstore_send_string().
|
static |
Send XenStore request string (excluding terminating NUL)
| xen | Xen hypervisor |
| string | String |
Definition at line 108 of file xenstore.c.
References strlen(), and xenstore_send().
Referenced by xenstore_request().
|
static |
Receive XenStore response raw data.
| xen | Xen hypervisor |
| data | Data buffer, or NULL to discard data |
| len | Length of data |
Definition at line 121 of file xenstore.c.
References bytes, cons, cpu_nap(), data, DBGC2, DBGCP, DBGCP_HDA, fill, xen_store::intf, len, MASK_XENSTORE_IDX, offset, readb(), readl(), rmb, xenstore_domain_interface::rsp, xenstore_domain_interface::rsp_cons, xenstore_domain_interface::rsp_prod, xen_hypervisor::store, wmb(), and writel().
Referenced by xenstore_response().
|
static |
Send XenStore request.
| xen | Xen hypervisor |
| type | Message type |
| req_id | Request ID |
| value | Value, or NULL to omit |
| key | Key path components |
| rc | Return status code |
Definition at line 170 of file xenstore.c.
References assert(), DBGC, DBGC2, EXEN, key, msg(), NULL, xen_store::port, rc, xen_hypervisor::store, strerror(), string, strlen(), tmp, type, va_arg, va_copy, va_end, value, xenstore_send(), and xenstore_send_string().
Referenced by xenstore_message().
|
static |
Receive XenStore response.
| xen | Xen hypervisor |
| req_id | Request ID |
| value | Value to fill in |
| len | Length to fill in |
| rc | Return status code |
The caller is responsible for eventually calling free() on the returned value. Note that the value may comprise multiple NUL-terminated strings concatenated together. A terminating NUL will always be appended to the returned value.
Definition at line 239 of file xenstore.c.
References cpu_nap(), DBG_EXTRA, DBGC, DBGC2, EIO, ENOMEM, EPROTO, free, len, msg(), NULL, xen_store::port, rc, xsd_sockmsg::req_id, xen_hypervisor::store, string, strlen(), value, xenstore_recv(), XS_ERROR, and zalloc().
Referenced by xenstore_message().
|
static |
Issue a XenStore message.
| xen | Xen hypervisor |
| type | Message type |
| response | Response value to fill in, or NULL to discard |
| len | Response length to fill in, or NULL to ignore |
| request | Request value, or NULL to omit |
| key | Key path components |
| rc | Return status code |
Definition at line 313 of file xenstore.c.
References free, key, len, rc, request, type, xenstore_req_id, xenstore_request(), and xenstore_response().
Referenced by xenstore_directory(), xenstore_rm(), xenstore_vread(), and xenstore_vwrite().
|
static |
Read XenStore value.
| xen | Xen hypervisor |
| value | Value to fill in |
| key | Key path components |
| rc | Return status code |
On a successful return, the caller is responsible for calling free() on the returned value.
Definition at line 353 of file xenstore.c.
References key, NULL, value, xenstore_message(), and XS_READ.
Referenced by xenstore_read(), and xenstore_read_num().
| int xenstore_read | ( | struct xen_hypervisor * | xen, |
| char ** | value, | ||
| ... | |||
| ) |
Read XenStore value.
| xen | Xen hypervisor |
| value | Value to fill in |
| ... | Key path components |
| rc | Return status code |
On a successful return, the caller is responsible for calling free() on the returned value.
Definition at line 371 of file xenstore.c.
References key, rc, va_end, va_start, value, and xenstore_vread().
Referenced by hvm_map_xenstore(), netfront_read_mac(), xenbus_probe_device(), and xenstore_dump().
| int xenstore_read_num | ( | struct xen_hypervisor * | xen, |
| unsigned long * | num, | ||
| ... | |||
| ) |
Read XenStore numeric value.
| xen | Xen hypervisor |
| num | Numeric value to fill in |
| ... | Key path components |
| rc | Return status code |
Definition at line 390 of file xenstore.c.
References DBGC, EINVAL, free, key, num, rc, strtoul(), va_end, va_start, value, and xenstore_vread().
Referenced by xenbus_backend_state(), and xenbus_probe_device().
|
static |
Write XenStore value.
| xen | Xen hypervisor |
| value | Value |
| key | Key path components |
| rc | Return status code |
Definition at line 426 of file xenstore.c.
References key, NULL, value, xenstore_message(), and XS_WRITE.
Referenced by xenstore_write(), and xenstore_write_num().
| int xenstore_write | ( | struct xen_hypervisor * | xen, |
| const char * | value, | ||
| ... | |||
| ) |
Write XenStore value.
| xen | Xen hypervisor |
| value | Value |
| ... | Key path components |
| rc | Return status code |
Definition at line 441 of file xenstore.c.
References key, rc, va_end, va_start, value, and xenstore_vwrite().
| int xenstore_write_num | ( | struct xen_hypervisor * | xen, |
| unsigned long | num, | ||
| ... | |||
| ) |
Write XenStore numeric value.
| xen | Xen hypervisor |
| num | Numeric value |
| ... | Key path components |
| rc | Return status code |
Definition at line 460 of file xenstore.c.
References key, num, rc, snprintf(), va_end, va_start, value, and xenstore_vwrite().
Referenced by netfront_write_num(), and xenbus_set_state().
| int xenstore_rm | ( | struct xen_hypervisor * | xen, |
| ... | |||
| ) |
Delete XenStore value.
| xen | Xen hypervisor |
| ... | Key path components |
| rc | Return status code |
Definition at line 483 of file xenstore.c.
References key, NULL, rc, va_end, va_start, xenstore_message(), and XS_RM.
Referenced by netfront_rm().
| int xenstore_directory | ( | struct xen_hypervisor * | xen, |
| char ** | children, | ||
| size_t * | len, | ||
| ... | |||
| ) |
Read XenStore directory.
| xen | Xen hypervisor |
| children | Child key names to fill in |
| len | Length of child key names to fill in |
| ... | Key path components |
| rc | Return status code |
Definition at line 503 of file xenstore.c.
References children, key, len, NULL, rc, va_end, va_start, xenstore_message(), and XS_DIRECTORY.
Referenced by xenbus_probe(), xenbus_probe_type(), and xenstore_dump().
| void xenstore_dump | ( | struct xen_hypervisor * | xen, |
| const char * | key | ||
| ) |
Dump XenStore directory contents (for debugging)
| xen | Xen hypervisor |
| key | Key |
Definition at line 520 of file xenstore.c.
References asprintf(), children, DBGC, ENOMEM, free, key, len, NULL, rc, strlen(), value, xenstore_directory(), xenstore_dump(), and xenstore_read().
Referenced by xenstore_dump().
|
static |
1.8.15