diff options
| author | Thomas Weißschuh <thomas.weissschuh@linutronix.de> | 2025-02-04 13:05:35 +0100 |
|---|---|---|
| committer | Thomas Gleixner <tglx@linutronix.de> | 2025-02-21 09:54:01 +0100 |
| commit | 5b47aba858101639a4442c2140b73f64eb796ed1 (patch) | |
| tree | f9192d8a6a18820486a64d4d58b7304e68e25755 /include/vdso | |
| parent | 30533a55ec8e6cd532989421a2d99ec422396fce (diff) | |
| download | linux-5b47aba858101639a4442c2140b73f64eb796ed1.tar.gz linux-5b47aba858101639a4442c2140b73f64eb796ed1.tar.bz2 linux-5b47aba858101639a4442c2140b73f64eb796ed1.zip | |
vdso: Introduce vdso/align.h
The vDSO implementation can only include headers from the vdso/
namespace. To enable the usage of the ALIGN() macro from the vDSO, move
linux/align.h to vdso/align.h wholly.
As the only dependency linux/const.h is only a wrapper around
vdso/const.h anyways adapt that dependency.
Also provide a compatibility wrapper linux/align.h.
Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://lore.kernel.org/all/20250204-vdso-store-rng-v3-3-13a4669dfc8c@linutronix.de
Diffstat (limited to 'include/vdso')
| -rw-r--r-- | include/vdso/align.h | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/include/vdso/align.h b/include/vdso/align.h new file mode 100644 index 000000000000..02dd8626b5c5 --- /dev/null +++ b/include/vdso/align.h @@ -0,0 +1,15 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef __VDSO_ALIGN_H +#define __VDSO_ALIGN_H + +#include <vdso/const.h> + +/* @a is a power of 2 value */ +#define ALIGN(x, a) __ALIGN_KERNEL((x), (a)) +#define ALIGN_DOWN(x, a) __ALIGN_KERNEL((x) - ((a) - 1), (a)) +#define __ALIGN_MASK(x, mask) __ALIGN_KERNEL_MASK((x), (mask)) +#define PTR_ALIGN(p, a) ((typeof(p))ALIGN((unsigned long)(p), (a))) +#define PTR_ALIGN_DOWN(p, a) ((typeof(p))ALIGN_DOWN((unsigned long)(p), (a))) +#define IS_ALIGNED(x, a) (((x) & ((typeof(x))(a) - 1)) == 0) + +#endif /* __VDSO_ALIGN_H */ |
