iPXE
Functions | Variables
xenstore.h File Reference

XenStore interface. More...

#include <ipxe/xen.h>

Go to the source code of this file.

Functions

 FILE_LICENCE (GPL2_OR_LATER_OR_UBDL)
 
 __attribute__ ((sentinel)) int xenstore_read(struct xen_hypervisor *xen
 
char unsigned long const char unsigned long char size_t void xenstore_dump (struct xen_hypervisor *xen, const char *key)
 Dump XenStore directory contents (for debugging) More...
 

Variables

char ** value
 
char unsigned long * num
 
char unsigned long const char unsigned long char ** children
 
char unsigned long const char unsigned long char size_tlen
 

Detailed Description

XenStore interface.

Definition in file xenstore.h.

Function Documentation

◆ FILE_LICENCE()

FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL  )

◆ __attribute__()

__attribute__ ( (sentinel)  )

◆ xenstore_dump()

char unsigned long const char unsigned long char size_t void xenstore_dump ( struct xen_hypervisor xen,
const char *  key 
)

Dump XenStore directory contents (for debugging)

Parameters
xenXen hypervisor
keyKey

Definition at line 520 of file xenstore.c.

520  {
521  char *value;
522  char *children;
523  char *child;
524  char *child_key;
525  size_t len;
526  int rc;
527 
528  /* Try to dump current key as a value */
529  if ( ( rc = xenstore_read ( xen, &value, key, NULL ) ) == 0 ) {
530  DBGC ( xen, "%s = \"%s\"\n", key, value );
531  free ( value );
532  }
533 
534  /* Try to recurse into each child in turn */
535  if ( ( rc = xenstore_directory ( xen, &children, &len, key,
536  NULL ) ) == 0 ) {
537  for ( child = children ; child < ( children + len ) ;
538  child += ( strlen ( child ) + 1 /* NUL */ ) ) {
539 
540  /* Construct child key */
541  if ( asprintf ( &child_key, "%s/%s", key, child ) < 0 ){
542  DBGC ( xen, "XENSTORE could not allocate child "
543  "key \"%s/%s\"\n", key, child );
544  rc = -ENOMEM;
545  break;
546  }
547 
548  /* Recurse into child key, continuing on error */
549  xenstore_dump ( xen, child_key );
550  free ( child_key );
551  }
552  free ( children );
553  }
554 }
struct arbelprm_rc_send_wqe rc
Definition: arbel.h:14
#define DBGC(...)
Definition: compiler.h:505
int xenstore_read(struct xen_hypervisor *xen, char **value,...)
Read XenStore value.
Definition: xenstore.c:371
#define ENOMEM
Not enough space.
Definition: errno.h:534
char unsigned long const char unsigned long char ** children
Definition: xenstore.h:25
pseudo_bit_t value[0x00020]
Definition: arbel.h:13
static void(* free)(struct refcnt *refcnt))
Definition: refcnt.h:54
int xenstore_directory(struct xen_hypervisor *xen, char **children, size_t *len,...)
Read XenStore directory.
Definition: xenstore.c:503
int asprintf(char **strp, const char *fmt,...)
Write a formatted string to newly allocated memory.
Definition: asprintf.c:41
size_t strlen(const char *src)
Get length of string.
Definition: string.c:228
void xenstore_dump(struct xen_hypervisor *xen, const char *key)
Dump XenStore directory contents (for debugging)
Definition: xenstore.c:520
uint32_t len
Length.
Definition: ena.h:14
#define NULL
NULL pointer (VOID *)
Definition: Base.h:362
union @375 key
Sense key.
Definition: scsi.h:18

References asprintf(), children, DBGC, ENOMEM, free, key, len, NULL, rc, strlen(), value, xenstore_directory(), xenstore_dump(), and xenstore_read().

Referenced by xenstore_dump().

Variable Documentation

◆ value

char unsigned long const char* value

Definition at line 15 of file xenstore.h.

◆ num

char unsigned long const char unsigned long num

◆ children

char unsigned long const char unsigned long char** children

Definition at line 25 of file xenstore.h.

Referenced by efi_driver_stop(), xenbus_probe_type(), xenstore_directory(), and xenstore_dump().

◆ len

char unsigned long const char unsigned long char size_t* len

Definition at line 25 of file xenstore.h.