Re: [LTP] [PATCH 2/3] syscalls/move_pages: modified HAS_NUMA_H as HAVE_NUMA_H

Caspar Zhang
2012-04-28T07:57:04Z

On 04/28/2012 03:48 PM, Zhouping Liu wrote:
> HAS_NUMA_H should be HAVE_NUMA_H, and most functions are defined
> in numa.h and numaif.h, so added the include headers into
> move_pages_support.h
>
> Signed-off-by: Zhouping Liu <zliu@redhat.com>

Acked-by: Caspar Zhang <caspar@casparzhang.com>

> ---
> testcases/kernel/syscalls/move_pages/move_pages_support.c | 12 ++++++------
> testcases/kernel/syscalls/move_pages/move_pages_support.h | 7 +++++++
> 2 files changed, 13 insertions(+), 6 deletions(-)
>
> diff --git a/testcases/kernel/syscalls/move_pages/move_pages_support.c b/testcases/kernel/syscalls/move_pages/move_pages_support.c
> index 168805e..6bd95d3 100644
> --- a/testcases/kernel/syscalls/move_pages/move_pages_support.c
> +++ b/testcases/kernel/syscalls/move_pages/move_pages_support.c
> @@ -37,7 +37,7 @@ long get_page_size()
> void free_pages(void **pages, unsigned int num)
> {
>
> -#if HAS_NUMA_H
> +#if HAVE_NUMA_H
> int i;
> size_t onepage = get_page_size();
>
> @@ -112,7 +112,7 @@ int alloc_pages_linear(void **pages, unsigned int num)
> {
> int nodes[num];
>
> -#if HAS_NUMA_H
> +#if HAVE_NUMA_H
> unsigned int i;
> unsigned int n;
>
> @@ -208,7 +208,7 @@ verify_pages_on_nodes(void **pages, int *status, unsigned int num, int *nodes)
> */
> void verify_pages_linear(void **pages, int *status, unsigned int num)
> {
> -#if HAS_NUMA_H
> +#if HAVE_NUMA_H
> unsigned int i;
> unsigned int n;
> int nodes[num];
> @@ -257,7 +257,7 @@ void verify_pages_on_node(void **pages, int *status, unsigned int num, int node)
> */
> int alloc_shared_pages_on_node(void **pages, unsigned int num, int node)
> {
> -#if HAS_NUMA_H
> +#if HAVE_NUMA_H
> char *shared;
> unsigned int i;
> int nodes[num];
> @@ -380,7 +380,7 @@ void free_sem(sem_t * sem, int num)
> */
> void check_config(unsigned int min_nodes)
> {
> -#if HAS_NUMA_H
> +#if HAVE_NUMA_H && HAVE_NUMAIF_H
> if (numa_available() < 0) {
> tst_resm(TCONF, "NUMA support is not available");
> } else if (numa_max_node() < (min_nodes - 1)) {
> @@ -392,4 +392,4 @@ void check_config(unsigned int min_nodes)
> tst_resm(TCONF, "NUMA support not provided");
> #endif
> tst_exit();
> -}
> \ No newline at end of file
> +}
> diff --git a/testcases/kernel/syscalls/move_pages/move_pages_support.h b/testcases/kernel/syscalls/move_pages/move_pages_support.h
> index 4081625..fd78572 100644
> --- a/testcases/kernel/syscalls/move_pages/move_pages_support.h
> +++ b/testcases/kernel/syscalls/move_pages/move_pages_support.h
> @@ -19,6 +19,13 @@
> #ifndef MOVE_PAGES_SUPPORT_H
> #define MOVE_PAGES_SUPPORT_H
>
> +#include "config.h"
> +#if HAVE_NUMA_H
> +#include <numa.h>
> +#endif
> +#if HAVE_NUMAIF_H
> +#include <numaif.h>
> +#endif
> #include <semaphore.h>
>
> long get_page_size();