Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

um: always include kconfig.h and compiler-version.h

Since commit a95b37e20db9 ("kbuild: get <linux/compiler_types.h> out of
<linux/kconfig.h>") we can safely include these files in userspace code.
Doing so simplifies matters as options do not need to be exported via
asm-offsets.h anymore.

Signed-off-by: Benjamin Berg <benjamin.berg@intel.com>
Link: https://patch.msgid.link/20241103150506.1367695-2-benjamin@sipsolutions.net
Signed-off-by: Johannes Berg <johannes.berg@intel.com>

authored by

Benjamin Berg and committed by
Johannes Berg
2f278b59 fce01288

+16 -31
+3 -1
arch/um/Makefile
··· 71 71 USER_CFLAGS = $(patsubst $(KERNEL_DEFINES),,$(patsubst -I%,,$(KBUILD_CFLAGS))) \ 72 72 $(ARCH_INCLUDE) $(MODE_INCLUDE) $(filter -I%,$(CFLAGS)) \ 73 73 -D_FILE_OFFSET_BITS=64 -idirafter $(srctree)/include \ 74 - -idirafter $(objtree)/include -D__KERNEL__ -D__UM_HOST__ 74 + -idirafter $(objtree)/include -D__KERNEL__ -D__UM_HOST__ \ 75 + -include $(srctree)/include/linux/compiler-version.h \ 76 + -include $(srctree)/include/linux/kconfig.h 75 77 76 78 #This will adjust *FLAGS accordingly to the platform. 77 79 include $(srctree)/$(ARCH_DIR)/Makefile-os-Linux
-18
arch/um/include/shared/common-offsets.h
··· 15 15 16 16 DEFINE(UM_NSEC_PER_SEC, NSEC_PER_SEC); 17 17 DEFINE(UM_NSEC_PER_USEC, NSEC_PER_USEC); 18 - 19 - #ifdef CONFIG_PRINTK 20 - DEFINE(UML_CONFIG_PRINTK, CONFIG_PRINTK); 21 - #endif 22 - #ifdef CONFIG_UML_X86 23 - DEFINE(UML_CONFIG_UML_X86, CONFIG_UML_X86); 24 - #endif 25 - #ifdef CONFIG_64BIT 26 - DEFINE(UML_CONFIG_64BIT, CONFIG_64BIT); 27 - #endif 28 - #ifdef CONFIG_UML_TIME_TRAVEL_SUPPORT 29 - DEFINE(UML_CONFIG_UML_TIME_TRAVEL_SUPPORT, CONFIG_UML_TIME_TRAVEL_SUPPORT); 30 - #endif 31 - #ifdef CONFIG_UML_MAX_USERSPACE_ITERATIONS 32 - DEFINE(UML_CONFIG_UML_MAX_USERSPACE_ITERATIONS, CONFIG_UML_MAX_USERSPACE_ITERATIONS); 33 - #else 34 - DEFINE(UML_CONFIG_UML_MAX_USERSPACE_ITERATIONS, 0); 35 - #endif
+2 -3
arch/um/include/shared/timetravel.h
··· 12 12 TT_MODE_EXTERNAL, 13 13 }; 14 14 15 - #if defined(UML_CONFIG_UML_TIME_TRAVEL_SUPPORT) || \ 16 - defined(CONFIG_UML_TIME_TRAVEL_SUPPORT) 15 + #if IS_ENABLED(CONFIG_UML_TIME_TRAVEL_SUPPORT) 17 16 extern enum time_travel_mode time_travel_mode; 18 17 extern int time_travel_should_print_bc_msg; 19 18 #else 20 19 #define time_travel_mode TT_MODE_OFF 21 20 #define time_travel_should_print_bc_msg 0 22 - #endif /* (UML_)CONFIG_UML_TIME_TRAVEL_SUPPORT */ 21 + #endif /* CONFIG_UML_TIME_TRAVEL_SUPPORT */ 23 22 24 23 void _time_travel_print_bc_msg(void); 25 24 static inline void time_travel_print_bc_msg(void)
+1 -1
arch/um/include/shared/user.h
··· 38 38 #define UM_KERN_DEBUG KERN_DEBUG 39 39 #define UM_KERN_CONT KERN_CONT 40 40 41 - #ifdef UML_CONFIG_PRINTK 41 + #if IS_ENABLED(CONFIG_PRINTK) 42 42 #define printk(...) _printk(__VA_ARGS__) 43 43 extern int _printk(const char *fmt, ...) 44 44 __attribute__ ((format (printf, 1, 2)));
+4 -4
arch/um/os-Linux/signal.c
··· 65 65 #define SIGALRM_MASK (1 << SIGALRM_BIT) 66 66 67 67 int signals_enabled; 68 - #ifdef UML_CONFIG_UML_TIME_TRAVEL_SUPPORT 68 + #if IS_ENABLED(CONFIG_UML_TIME_TRAVEL_SUPPORT) 69 69 static int signals_blocked, signals_blocked_pending; 70 70 #endif 71 71 static unsigned int signals_pending; ··· 75 75 { 76 76 int enabled = signals_enabled; 77 77 78 - #ifdef UML_CONFIG_UML_TIME_TRAVEL_SUPPORT 78 + #if IS_ENABLED(CONFIG_UML_TIME_TRAVEL_SUPPORT) 79 79 if ((signals_blocked || 80 80 __atomic_load_n(&signals_blocked_pending, __ATOMIC_SEQ_CST)) && 81 81 (sig == SIGIO)) { ··· 297 297 return; 298 298 299 299 signals_enabled = 1; 300 - #ifdef UML_CONFIG_UML_TIME_TRAVEL_SUPPORT 300 + #if IS_ENABLED(CONFIG_UML_TIME_TRAVEL_SUPPORT) 301 301 deliver_time_travel_irqs(); 302 302 #endif 303 303 ··· 389 389 return ret; 390 390 } 391 391 392 - #ifdef UML_CONFIG_UML_TIME_TRAVEL_SUPPORT 392 + #if IS_ENABLED(CONFIG_UML_TIME_TRAVEL_SUPPORT) 393 393 void mark_sigio_pending(void) 394 394 { 395 395 /*
+4 -2
arch/um/os-Linux/skas/process.c
··· 413 413 */ 414 414 if (time_travel_mode == TT_MODE_INFCPU || 415 415 time_travel_mode == TT_MODE_EXTERNAL) { 416 - if (UML_CONFIG_UML_MAX_USERSPACE_ITERATIONS && 416 + #ifdef CONFIG_UML_MAX_USERSPACE_ITERATIONS 417 + if (CONFIG_UML_MAX_USERSPACE_ITERATIONS && 417 418 unscheduled_userspace_iterations++ > 418 - UML_CONFIG_UML_MAX_USERSPACE_ITERATIONS) { 419 + CONFIG_UML_MAX_USERSPACE_ITERATIONS) { 419 420 tt_extra_sched_jiffies += 1; 420 421 unscheduled_userspace_iterations = 0; 421 422 } 423 + #endif 422 424 } 423 425 424 426 time_travel_print_bc_msg();
+2 -2
arch/um/os-Linux/util.c
··· 52 52 struct utsname host; 53 53 54 54 uname(&host); 55 - #ifdef UML_CONFIG_UML_X86 56 - # ifndef UML_CONFIG_64BIT 55 + #if IS_ENABLED(CONFIG_UML_X86) 56 + # if !IS_ENABLED(CONFIG_64BIT) 57 57 if (!strcmp(host.machine, "x86_64")) { 58 58 strcpy(machine_out, "i686"); 59 59 return;