Xen Test Framework
Macros | Functions
lib.h File Reference
#include <xtf/compiler.h>
#include <xtf/console.h>
#include <xtf/types.h>
+ Include dependency graph for lib.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define ARRAY_SIZE(a)   (sizeof(a) / sizeof(*a))
 
#define ACCESS_ONCE(x)   (*(volatile typeof(x) *)&(x))
 
#define ASSERT(cond)
 
#define BUILD_BUG_ON(cond)   ((void)sizeof(struct { char: -!!(cond); }))
 
#define min(a, b)
 
#define max(a, b)
 
#define ROUNDUP(x, a)   (((x) + (a) - 1) & ~((a) - 1))
 

Functions

void panic (const char *fmt,...)
 
void heapsort (void *base, size_t nmemb, size_t size, int(*compar)(const void *, const void *), void(*swap)(void *, void *))
 
unsigned long exec_user_param (unsigned long(*fn)(unsigned long), unsigned long p1)
 Execute fn(p1) at user privilege, passing its return value back. More...
 
static unsigned long exec_user (unsigned long(*fn)(void))
 
static void exec_user_void (void(*fn)(void))
 
int xtf_probe_sysctl_interface_version (void)
 Probe for the SYSCTL_INTERFACE_VERSION in use by the hypervisor. More...
 
int xtf_get_domid (void)
 Obtain the current domid. More...
 

Macro Definition Documentation

◆ ARRAY_SIZE

#define ARRAY_SIZE (   a)    (sizeof(a) / sizeof(*a))

Definition at line 8 of file lib.h.

◆ ACCESS_ONCE

#define ACCESS_ONCE (   x)    (*(volatile typeof(x) *)&(x))

Definition at line 10 of file lib.h.

◆ ASSERT

#define ASSERT (   cond)
Value:
do { if ( !(cond) ) \
panic("ASSERT(%s) failed at %s:%u\n", \
#cond, __FILE__, __LINE__); \
} while ( 0 )

Definition at line 14 of file lib.h.

◆ BUILD_BUG_ON

#define BUILD_BUG_ON (   cond)    ((void)sizeof(struct { char: -!!(cond); }))

Definition at line 24 of file lib.h.

◆ min

#define min (   a,
 
)
Value:
({ \
const typeof(a) _a = (a); \
const typeof(b) _b = (b); \
(void)(&_a == &_b); \
_a < _b ? _a : _b; \
})

Definition at line 28 of file lib.h.

◆ max

#define max (   a,
 
)
Value:
({ \
const typeof(a) _a = (a); \
const typeof(b) _b = (b); \
(void)(&_a == &_b); \
_a > _b ? _a : _b; \
})

Definition at line 36 of file lib.h.

◆ ROUNDUP

#define ROUNDUP (   x,
 
)    (((x) + (a) - 1) & ~((a) - 1))

Definition at line 44 of file lib.h.

Function Documentation

◆ panic()

void panic ( const char *  fmt,
  ... 
)

Definition at line 15 of file lib.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ heapsort()

void heapsort ( void *  base,
size_t  nmemb,
size_t  size,
int(*)(const void *, const void *)  compar,
void(*)(void *, void *)  swap 
)

Definition at line 25 of file heapsort.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ exec_user_param()

unsigned long exec_user_param ( unsigned long(*)(unsigned long)  fn,
unsigned long  p1 
)

Execute fn(p1) at user privilege, passing its return value back.

fn() is executed on user_stack[], and is non-reentrant.

+ Here is the caller graph for this function:

◆ exec_user()

static unsigned long exec_user ( unsigned long(*)(void)  fn)
inlinestatic

Definition at line 62 of file lib.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ exec_user_void()

static void exec_user_void ( void(*)(void)  fn)
inlinestatic

Definition at line 70 of file lib.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ xtf_probe_sysctl_interface_version()

int xtf_probe_sysctl_interface_version ( void  )

Probe for the SYSCTL_INTERFACE_VERSION in use by the hypervisor.

Returns
version, or -1 on failure.

Definition at line 32 of file lib.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ xtf_get_domid()

int xtf_get_domid ( void  )

Obtain the current domid.

Returns
domid, or -1 on failure.

Definition at line 47 of file lib.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function: