Skip to content

Commit 8c59ab8

Browse files
fvincenzoKAGA-KOKO
authored andcommitted
lib/vdso: Enable common headers
The vDSO library should only include the necessary headers required for a userspace library (UAPI and a minimal set of kernel headers). To make this possible it is necessary to isolate from the kernel headers the common parts that are strictly necessary to build the library. Refactor the unified vdso code to use the common headers. Signed-off-by: Vincenzo Frascino <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Link: https://lkml.kernel.org/r/[email protected]
1 parent 78c8516 commit 8c59ab8

File tree

2 files changed

+30
-25
lines changed

2 files changed

+30
-25
lines changed

include/vdso/datapage.h

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,20 @@
44

55
#ifndef __ASSEMBLY__
66

7-
#include <linux/bits.h>
8-
#include <linux/time.h>
9-
#include <linux/types.h>
7+
#include <linux/compiler.h>
8+
#include <uapi/linux/time.h>
9+
#include <uapi/linux/types.h>
10+
#include <uapi/asm-generic/errno-base.h>
11+
12+
#include <vdso/bits.h>
13+
#include <vdso/clocksource.h>
14+
#include <vdso/ktime.h>
15+
#include <vdso/limits.h>
16+
#include <vdso/math64.h>
17+
#include <vdso/processor.h>
18+
#include <vdso/time.h>
19+
#include <vdso/time32.h>
20+
#include <vdso/time64.h>
1021

1122
#define VDSO_BASES (CLOCK_TAI + 1)
1223
#define VDSO_HRES (BIT(CLOCK_REALTIME) | \
@@ -99,6 +110,22 @@ struct vdso_data {
99110
*/
100111
extern struct vdso_data _vdso_data[CS_BASES] __attribute__((visibility("hidden")));
101112

113+
/*
114+
* The generic vDSO implementation requires that gettimeofday.h
115+
* provides:
116+
* - __arch_get_vdso_data(): to get the vdso datapage.
117+
* - __arch_get_hw_counter(): to get the hw counter based on the
118+
* clock_mode.
119+
* - gettimeofday_fallback(): fallback for gettimeofday.
120+
* - clock_gettime_fallback(): fallback for clock_gettime.
121+
* - clock_getres_fallback(): fallback for clock_getres.
122+
*/
123+
#ifdef ENABLE_COMPAT_VDSO
124+
#include <asm/vdso/compat_gettimeofday.h>
125+
#else
126+
#include <asm/vdso/gettimeofday.h>
127+
#endif /* ENABLE_COMPAT_VDSO */
128+
102129
#endif /* !__ASSEMBLY__ */
103130

104131
#endif /* __VDSO_DATAPAGE_H */

lib/vdso/gettimeofday.c

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2,31 +2,9 @@
22
/*
33
* Generic userspace implementations of gettimeofday() and similar.
44
*/
5-
#include <linux/compiler.h>
6-
#include <linux/math64.h>
7-
#include <linux/time.h>
8-
#include <linux/kernel.h>
9-
#include <linux/hrtimer_defs.h>
10-
#include <linux/clocksource.h>
115
#include <vdso/datapage.h>
126
#include <vdso/helpers.h>
137

14-
/*
15-
* The generic vDSO implementation requires that gettimeofday.h
16-
* provides:
17-
* - __arch_get_vdso_data(): to get the vdso datapage.
18-
* - __arch_get_hw_counter(): to get the hw counter based on the
19-
* clock_mode.
20-
* - gettimeofday_fallback(): fallback for gettimeofday.
21-
* - clock_gettime_fallback(): fallback for clock_gettime.
22-
* - clock_getres_fallback(): fallback for clock_getres.
23-
*/
24-
#ifdef ENABLE_COMPAT_VDSO
25-
#include <asm/vdso/compat_gettimeofday.h>
26-
#else
27-
#include <asm/vdso/gettimeofday.h>
28-
#endif /* ENABLE_COMPAT_VDSO */
29-
308
#ifndef vdso_calc_delta
319
/*
3210
* Default implementation which works for all sane clocksources. That

0 commit comments

Comments
 (0)