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>
This commit is contained in:
Shiqing Gao 2018-09-13 09:25:27 +08:00 committed by lijinxia
parent 5a996ce6a9
commit 83e7995d5d
4 changed files with 14 additions and 39 deletions

View File

@ -9,11 +9,9 @@
#include <types.h>
#include <errno.h>
#include <macros.h>
#include <rtl.h>
#include <spinlock.h>
#include <mem_mgt.h>
#include <stdarg.h>
#include <util.h>
#include <list.h>
#include <atomic.h>

View File

@ -1,22 +0,0 @@
/*
* Copyright (C) 2018 Intel Corporation. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#ifndef MACROS_H
#define MACROS_H
/** Replaces 'x' by the string "x". */
#define STRINGIFY(x) #x
/* Macro used to check if a value is aligned to the required boundary.
* Returns TRUE if aligned; FALSE if not aligned
* NOTE: The required alignment must be a power of 2 (2, 4, 8, 16, 32, etc)
*/
static inline bool mem_aligned_check(uint64_t value, uint64_t req_align)
{
return ((value & (req_align - 1UL)) == 0UL);
}
#endif /* INCLUDE_MACROS_H defined */

View File

@ -1,15 +0,0 @@
/*
* Copyright (C) 2018 Intel Corporation. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#ifndef STDARG_H
#define STDARG_H
#include <types.h>
#define va_start __builtin_va_start
#define va_end __builtin_va_end
#endif /* STDARG_H */

View File

@ -8,6 +8,8 @@
#define UTIL_H
#define offsetof(st, m) __builtin_offsetof(st, m)
#define va_start __builtin_va_start
#define va_end __builtin_va_end
/** Roundup (x/y) to ( x/y + (x%y) ? 1 : 0) **/
#define INT_DIV_ROUNDUP(x, y) ((((x)+(y))-1)/(y))
@ -16,4 +18,16 @@
#define max(x, y) ((x) < (y)) ? (y) : (x)
/** Replaces 'x' by the string "x". */
#define STRINGIFY(x) #x
/* Macro used to check if a value is aligned to the required boundary.
* Returns TRUE if aligned; FALSE if not aligned
* NOTE: The required alignment must be a power of 2 (2, 4, 8, 16, 32, etc)
*/
static inline bool mem_aligned_check(uint64_t value, uint64_t req_align)
{
return ((value & (req_align - 1UL)) == 0UL);
}
#endif /* UTIL_H */