Skip to content

Commit d1d3a2e

Browse files
benzeajmberg-intel
authored andcommitted
um: Remove stub-data.h include from common-offsets.h
Further commits will require values from common-offsets.h inside stub-data.h. Resolve the possible circular dependency and simply use offsetof() inside stub_32.h and stub_64.h. Signed-off-by: Benjamin Berg <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Johannes Berg <[email protected]>
1 parent 2cf3a3c commit d1d3a2e

File tree

3 files changed

+8
-11
lines changed

3 files changed

+8
-11
lines changed

arch/um/include/shared/common-offsets.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
/* SPDX-License-Identifier: GPL-2.0 */
22
/* for use by sys-$SUBARCH/kernel-offsets.c */
3-
#include <stub-data.h>
43

54
DEFINE(KERNEL_MADV_REMOVE, MADV_REMOVE);
65

@@ -30,7 +29,3 @@ DEFINE(UML_CONFIG_64BIT, CONFIG_64BIT);
3029
DEFINE(UML_CONFIG_UML_TIME_TRAVEL_SUPPORT, CONFIG_UML_TIME_TRAVEL_SUPPORT);
3130
#endif
3231

33-
/* for stub */
34-
DEFINE(UML_STUB_FIELD_OFFSET, offsetof(struct stub_data, offset));
35-
DEFINE(UML_STUB_FIELD_CHILD_ERR, offsetof(struct stub_data, child_err));
36-
DEFINE(UML_STUB_FIELD_FD, offsetof(struct stub_data, fd));

arch/x86/um/shared/sysdep/stub_32.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
#ifndef __SYSDEP_STUB_H
77
#define __SYSDEP_STUB_H
88

9+
#include <stddef.h>
910
#include <asm/ptrace.h>
1011
#include <generated/asm-offsets.h>
1112

@@ -98,9 +99,9 @@ static __always_inline void remap_stack_and_trap(void)
9899
: :
99100
"g" (~(STUB_DATA_PAGES * UM_KERN_PAGE_SIZE - 1)),
100101
"g" (STUB_MMAP_NR),
101-
"g" (UML_STUB_FIELD_FD),
102-
"g" (UML_STUB_FIELD_OFFSET),
103-
"g" (UML_STUB_FIELD_CHILD_ERR),
102+
"g" (offsetof(struct stub_data, fd)),
103+
"g" (offsetof(struct stub_data, offset)),
104+
"g" (offsetof(struct stub_data, child_err)),
104105
"c" (STUB_DATA_PAGES * UM_KERN_PAGE_SIZE),
105106
"d" (PROT_READ | PROT_WRITE),
106107
"S" (MAP_FIXED | MAP_SHARED)

arch/x86/um/shared/sysdep/stub_64.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
#ifndef __SYSDEP_STUB_H
77
#define __SYSDEP_STUB_H
88

9+
#include <stddef.h>
910
#include <sysdep/ptrace_user.h>
1011
#include <generated/asm-offsets.h>
1112
#include <linux/stddef.h>
@@ -101,9 +102,9 @@ static __always_inline void remap_stack_and_trap(void)
101102
"g" (STUB_MMAP_NR),
102103
"g" (~(STUB_DATA_PAGES * UM_KERN_PAGE_SIZE - 1)),
103104
"g" (MAP_FIXED | MAP_SHARED),
104-
"g" (UML_STUB_FIELD_FD),
105-
"g" (UML_STUB_FIELD_OFFSET),
106-
"g" (UML_STUB_FIELD_CHILD_ERR),
105+
"g" (offsetof(struct stub_data, fd)),
106+
"g" (offsetof(struct stub_data, offset)),
107+
"g" (offsetof(struct stub_data, child_err)),
107108
"S" (STUB_DATA_PAGES * UM_KERN_PAGE_SIZE),
108109
"d" (PROT_READ | PROT_WRITE)
109110
:

0 commit comments

Comments
 (0)