mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 10:11:27 +01:00
version compiles and starts up, but I'm not really sure how to test the new xenbus implementation. * Added unbind_evtchn * Copied parts of the Linux spinlock implementation to make the changes to xenbus compared to Linux smaller. Also added a dummy rwsem implementation. * Updated the xenbus-files Signed-off-by: Simon Kagstrom <simon.kagstrom@bth.se>
27 lines
746 B
C
27 lines
746 B
C
#ifndef __XMALLOC_H__
|
|
#define __XMALLOC_H__
|
|
|
|
/* Allocate space for typed object. */
|
|
#define xmalloc(_type) ((_type *)_xmalloc(sizeof(_type), __alignof__(_type)))
|
|
|
|
/* Allocate space for array of typed objects. */
|
|
#define xmalloc_array(_type, _num) ((_type *)_xmalloc_array(sizeof(_type), __alignof__(_type), _num))
|
|
|
|
#define malloc(size) _xmalloc(size, 4)
|
|
#define free(ptr) xfree(ptr)
|
|
|
|
/* Free any of the above. */
|
|
extern void xfree(const void *);
|
|
|
|
/* Underlying functions */
|
|
extern void *_xmalloc(size_t size, size_t align);
|
|
static inline void *_xmalloc_array(size_t size, size_t align, size_t num)
|
|
{
|
|
/* Check for overflow. */
|
|
if (size && num > UINT_MAX / size)
|
|
return NULL;
|
|
return _xmalloc(size * num, align);
|
|
}
|
|
|
|
#endif /* __XMALLOC_H__ */
|