Skip to content

Commit 9a6a6a3

Browse files
ljskernelakpm00
authored andcommitted
tools/testing: add linux/args.h header and fix radix, VMA tests
Commit 857d18f ("cleanup: Introduce ACQUIRE() and ACQUIRE_ERR() for conditional locks") accidentally broke the radix tree, VMA userland tests by including linux/args.h which is not present in the tools/include directory. This patch copies this over and adds an #ifdef block to avoid duplicate __CONCAT declaration in conflict with system headers when we ultimately include this. Link: https://lkml.kernel.org/r/20250811052654.33286-1-lorenzo.stoakes@oracle.com Fixes: 857d18f ("cleanup: Introduce ACQUIRE() and ACQUIRE_ERR() for conditional locks") Signed-off-by: Lorenzo Stoakes <lorenzo.stoakes@oracle.com> Cc: Jann Horn <jannh@google.com> Cc: John Hubbard <jhubbard@nvidia.com> Cc: Liam Howlett <liam.howlett@oracle.com> Cc: Sidhartha Kumar <sidhartha.kumar@oracle.com> Cc: Vlastimil Babka <vbabka@suse.cz> Cc: Dan Williams <dan.j.williams@intel.com> Cc: Peter Zijlstra <peterz@infradead.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
1 parent dde3085 commit 9a6a6a3

2 files changed

Lines changed: 32 additions & 0 deletions

File tree

tools/include/linux/args.h

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
/* SPDX-License-Identifier: GPL-2.0 */
2+
3+
#ifndef _LINUX_ARGS_H
4+
#define _LINUX_ARGS_H
5+
6+
/*
7+
* How do these macros work?
8+
*
9+
* In __COUNT_ARGS() _0 to _12 are just placeholders from the start
10+
* in order to make sure _n is positioned over the correct number
11+
* from 12 to 0 (depending on X, which is a variadic argument list).
12+
* They serve no purpose other than occupying a position. Since each
13+
* macro parameter must have a distinct identifier, those identifiers
14+
* are as good as any.
15+
*
16+
* In COUNT_ARGS() we use actual integers, so __COUNT_ARGS() returns
17+
* that as _n.
18+
*/
19+
20+
/* This counts to 15. Any more, it will return 16th argument. */
21+
#define __COUNT_ARGS(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _n, X...) _n
22+
#define COUNT_ARGS(X...) __COUNT_ARGS(, ##X, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0)
23+
24+
/* Concatenate two parameters, but allow them to be expanded beforehand. */
25+
#define __CONCAT(a, b) a ## b
26+
#define CONCATENATE(a, b) __CONCAT(a, b)
27+
28+
#endif /* _LINUX_ARGS_H */

tools/testing/shared/linux/idr.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,5 @@
1+
/* Avoid duplicate definitions due to system headers. */
2+
#ifdef __CONCAT
3+
#undef __CONCAT
4+
#endif
15
#include "../../../../include/linux/idr.h"

0 commit comments

Comments
 (0)