Skip to content

Commit 83e7995

Browse files
shiqingglijinxia
authored andcommitted
hv: clean up some header files
- move the contents in macros.h and stdarg.h to util.h - remove macros.h and stdarg.h Tracked-On: #861 Signed-off-by: Shiqing Gao <shiqing.gao@intel.com> Acked-by: Eddie Dong <eddie.dong@intel.com>
1 parent 5a996ce commit 83e7995

File tree

4 files changed

+14
-39
lines changed

4 files changed

+14
-39
lines changed

hypervisor/include/hv_lib.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,9 @@
99

1010
#include <types.h>
1111
#include <errno.h>
12-
#include <macros.h>
1312
#include <rtl.h>
1413
#include <spinlock.h>
1514
#include <mem_mgt.h>
16-
#include <stdarg.h>
1715
#include <util.h>
1816
#include <list.h>
1917
#include <atomic.h>

hypervisor/include/lib/macros.h

Lines changed: 0 additions & 22 deletions
This file was deleted.

hypervisor/include/lib/stdarg.h

Lines changed: 0 additions & 15 deletions
This file was deleted.

hypervisor/include/lib/util.h

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
#define UTIL_H
99

1010
#define offsetof(st, m) __builtin_offsetof(st, m)
11+
#define va_start __builtin_va_start
12+
#define va_end __builtin_va_end
1113

1214
/** Roundup (x/y) to ( x/y + (x%y) ? 1 : 0) **/
1315
#define INT_DIV_ROUNDUP(x, y) ((((x)+(y))-1)/(y))
@@ -16,4 +18,16 @@
1618

1719
#define max(x, y) ((x) < (y)) ? (y) : (x)
1820

21+
/** Replaces 'x' by the string "x". */
22+
#define STRINGIFY(x) #x
23+
24+
/* Macro used to check if a value is aligned to the required boundary.
25+
* Returns TRUE if aligned; FALSE if not aligned
26+
* NOTE: The required alignment must be a power of 2 (2, 4, 8, 16, 32, etc)
27+
*/
28+
static inline bool mem_aligned_check(uint64_t value, uint64_t req_align)
29+
{
30+
return ((value & (req_align - 1UL)) == 0UL);
31+
}
32+
1933
#endif /* UTIL_H */

0 commit comments

Comments
 (0)