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

[PATCH] cleanup asm/setup.h userspace visibility

Make the contents of the userspace asm/setup.h header consistent on all
architectures:

- export setup.h to userspace on all architectures
- export only COMMAND_LINE_SIZE to userspace
- frv: move COMMAND_LINE_SIZE from param.h
- i386: remove duplicate COMMAND_LINE_SIZE from param.h
- arm:
- export ATAGs to userspace
- change u8/u16/u32 to __u8/__u16/__u32

Signed-off-by: Adrian Bunk <bunk@stusta.de>
Acked-by: Russell King <rmk@arm.linux.org.uk>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>

authored by

Adrian Bunk and committed by
Linus Torvalds
7d1362c0 f46ba223

+102 -68
+55 -49
include/asm-arm/setup.h
··· 14 14 #ifndef __ASMARM_SETUP_H 15 15 #define __ASMARM_SETUP_H 16 16 17 + #include <asm/types.h> 18 + 17 19 #define COMMAND_LINE_SIZE 1024 18 20 19 21 /* The list ends with an ATAG_NONE node. */ 20 22 #define ATAG_NONE 0x00000000 21 23 22 24 struct tag_header { 23 - u32 size; 24 - u32 tag; 25 + __u32 size; 26 + __u32 tag; 25 27 }; 26 28 27 29 /* The list must start with an ATAG_CORE node */ 28 30 #define ATAG_CORE 0x54410001 29 31 30 32 struct tag_core { 31 - u32 flags; /* bit 0 = read-only */ 32 - u32 pagesize; 33 - u32 rootdev; 33 + __u32 flags; /* bit 0 = read-only */ 34 + __u32 pagesize; 35 + __u32 rootdev; 34 36 }; 35 37 36 38 /* it is allowed to have multiple ATAG_MEM nodes */ 37 39 #define ATAG_MEM 0x54410002 38 40 39 41 struct tag_mem32 { 40 - u32 size; 41 - u32 start; /* physical start address */ 42 + __u32 size; 43 + __u32 start; /* physical start address */ 42 44 }; 43 45 44 46 /* VGA text type displays */ 45 47 #define ATAG_VIDEOTEXT 0x54410003 46 48 47 49 struct tag_videotext { 48 - u8 x; 49 - u8 y; 50 - u16 video_page; 51 - u8 video_mode; 52 - u8 video_cols; 53 - u16 video_ega_bx; 54 - u8 video_lines; 55 - u8 video_isvga; 56 - u16 video_points; 50 + __u8 x; 51 + __u8 y; 52 + __u16 video_page; 53 + __u8 video_mode; 54 + __u8 video_cols; 55 + __u16 video_ega_bx; 56 + __u8 video_lines; 57 + __u8 video_isvga; 58 + __u16 video_points; 57 59 }; 58 60 59 61 /* describes how the ramdisk will be used in kernel */ 60 62 #define ATAG_RAMDISK 0x54410004 61 63 62 64 struct tag_ramdisk { 63 - u32 flags; /* bit 0 = load, bit 1 = prompt */ 64 - u32 size; /* decompressed ramdisk size in _kilo_ bytes */ 65 - u32 start; /* starting block of floppy-based RAM disk image */ 65 + __u32 flags; /* bit 0 = load, bit 1 = prompt */ 66 + __u32 size; /* decompressed ramdisk size in _kilo_ bytes */ 67 + __u32 start; /* starting block of floppy-based RAM disk image */ 66 68 }; 67 69 68 70 /* describes where the compressed ramdisk image lives (virtual address) */ ··· 78 76 #define ATAG_INITRD2 0x54420005 79 77 80 78 struct tag_initrd { 81 - u32 start; /* physical start address */ 82 - u32 size; /* size of compressed ramdisk image in bytes */ 79 + __u32 start; /* physical start address */ 80 + __u32 size; /* size of compressed ramdisk image in bytes */ 83 81 }; 84 82 85 83 /* board serial number. "64 bits should be enough for everybody" */ 86 84 #define ATAG_SERIAL 0x54410006 87 85 88 86 struct tag_serialnr { 89 - u32 low; 90 - u32 high; 87 + __u32 low; 88 + __u32 high; 91 89 }; 92 90 93 91 /* board revision */ 94 92 #define ATAG_REVISION 0x54410007 95 93 96 94 struct tag_revision { 97 - u32 rev; 95 + __u32 rev; 98 96 }; 99 97 100 98 /* initial values for vesafb-type framebuffers. see struct screen_info ··· 103 101 #define ATAG_VIDEOLFB 0x54410008 104 102 105 103 struct tag_videolfb { 106 - u16 lfb_width; 107 - u16 lfb_height; 108 - u16 lfb_depth; 109 - u16 lfb_linelength; 110 - u32 lfb_base; 111 - u32 lfb_size; 112 - u8 red_size; 113 - u8 red_pos; 114 - u8 green_size; 115 - u8 green_pos; 116 - u8 blue_size; 117 - u8 blue_pos; 118 - u8 rsvd_size; 119 - u8 rsvd_pos; 104 + __u16 lfb_width; 105 + __u16 lfb_height; 106 + __u16 lfb_depth; 107 + __u16 lfb_linelength; 108 + __u32 lfb_base; 109 + __u32 lfb_size; 110 + __u8 red_size; 111 + __u8 red_pos; 112 + __u8 green_size; 113 + __u8 green_pos; 114 + __u8 blue_size; 115 + __u8 blue_pos; 116 + __u8 rsvd_size; 117 + __u8 rsvd_pos; 120 118 }; 121 119 122 120 /* command line: \0 terminated string */ ··· 130 128 #define ATAG_ACORN 0x41000101 131 129 132 130 struct tag_acorn { 133 - u32 memc_control_reg; 134 - u32 vram_pages; 135 - u8 sounddefault; 136 - u8 adfsdrives; 131 + __u32 memc_control_reg; 132 + __u32 vram_pages; 133 + __u8 sounddefault; 134 + __u8 adfsdrives; 137 135 }; 138 136 139 137 /* footbridge memory clock, see arch/arm/mach-footbridge/arch.c */ 140 138 #define ATAG_MEMCLK 0x41000402 141 139 142 140 struct tag_memclk { 143 - u32 fmemclk; 141 + __u32 fmemclk; 144 142 }; 145 143 146 144 struct tag { ··· 169 167 }; 170 168 171 169 struct tagtable { 172 - u32 tag; 170 + __u32 tag; 173 171 int (*parse)(const struct tag *); 174 172 }; 175 - 176 - #define __tag __attribute_used__ __attribute__((__section__(".taglist.init"))) 177 - #define __tagtable(tag, fn) \ 178 - static struct tagtable __tagtable_##fn __tag = { tag, fn } 179 173 180 174 #define tag_member_present(tag,member) \ 181 175 ((unsigned long)(&((struct tag *)0L)->member + 1) \ 182 176 <= (tag)->hdr.size * 4) 183 177 184 - #define tag_next(t) ((struct tag *)((u32 *)(t) + (t)->hdr.size)) 178 + #define tag_next(t) ((struct tag *)((__u32 *)(t) + (t)->hdr.size)) 185 179 #define tag_size(type) ((sizeof(struct tag_header) + sizeof(struct type)) >> 2) 186 180 187 181 #define for_each_tag(t,base) \ 188 182 for (t = base; t->hdr.size; t = tag_next(t)) 183 + 184 + #ifdef __KERNEL__ 185 + 186 + #define __tag __attribute_used__ __attribute__((__section__(".taglist.init"))) 187 + #define __tagtable(tag, fn) \ 188 + static struct tagtable __tagtable_##fn __tag = { tag, fn } 189 189 190 190 /* 191 191 * Memory map description ··· 220 216 #define __early_param(name,fn) \ 221 217 static struct early_params __early_##fn __attribute_used__ \ 222 218 __attribute__((__section__(".early_param.init"))) = { name, fn } 219 + 220 + #endif /* __KERNEL__ */ 223 221 224 222 #endif
+4
include/asm-arm26/setup.h
··· 16 16 17 17 #define COMMAND_LINE_SIZE 1024 18 18 19 + #ifdef __KERNEL__ 20 + 19 21 /* The list ends with an ATAG_NONE node. */ 20 22 #define ATAG_NONE 0x00000000 21 23 ··· 203 201 }; 204 202 205 203 extern struct meminfo meminfo; 204 + 205 + #endif /* __KERNEL__ */ 206 206 207 207 #endif
+4
include/asm-avr32/setup.h
··· 13 13 14 14 #define COMMAND_LINE_SIZE 256 15 15 16 + #ifdef __KERNEL__ 17 + 16 18 /* Magic number indicating that a tag table is present */ 17 19 #define ATAG_MAGIC 0xa2a25441 18 20 ··· 139 137 void chip_enable_sdram(void); 140 138 141 139 #endif /* !__ASSEMBLY__ */ 140 + 141 + #endif /* __KERNEL__ */ 142 142 143 143 #endif /* __ASM_AVR32_SETUP_H__ */
-1
include/asm-frv/param.h
··· 18 18 #endif 19 19 20 20 #define MAXHOSTNAMELEN 64 /* max length of hostname */ 21 - #define COMMAND_LINE_SIZE 512 22 21 23 22 #endif /* _ASM_PARAM_H */
+6
include/asm-frv/setup.h
··· 12 12 #ifndef _ASM_SETUP_H 13 13 #define _ASM_SETUP_H 14 14 15 + #define COMMAND_LINE_SIZE 512 16 + 17 + #ifdef __KERNEL__ 18 + 15 19 #include <linux/init.h> 16 20 17 21 #ifndef __ASSEMBLY__ ··· 25 21 #endif 26 22 27 23 #endif /* !__ASSEMBLY__ */ 24 + 25 + #endif /* __KERNEL__ */ 28 26 29 27 #endif /* _ASM_SETUP_H */
+1
include/asm-generic/Kbuild.asm
··· 14 14 unifdef-y += ptrace.h 15 15 unifdef-y += resource.h 16 16 unifdef-y += sembuf.h 17 + unifdef-y += setup.h 17 18 unifdef-y += shmbuf.h 18 19 unifdef-y += sigcontext.h 19 20 unifdef-y += siginfo.h
-1
include/asm-i386/Kbuild
··· 7 7 header-y += ucontext.h 8 8 9 9 unifdef-y += mtrr.h 10 - unifdef-y += setup.h 11 10 unifdef-y += vm86.h
-1
include/asm-i386/param.h
··· 18 18 #endif 19 19 20 20 #define MAXHOSTNAMELEN 64 /* max length of hostname */ 21 - #define COMMAND_LINE_SIZE 256 22 21 23 22 #endif
+4 -2
include/asm-i386/setup.h
··· 6 6 #ifndef _i386_SETUP_H 7 7 #define _i386_SETUP_H 8 8 9 + #define COMMAND_LINE_SIZE 256 10 + 9 11 #ifdef __KERNEL__ 10 12 #include <linux/pfn.h> 11 13 ··· 16 14 */ 17 15 #define MAXMEM_PFN PFN_DOWN(MAXMEM) 18 16 #define MAX_NONPAE_PFN (1 << 20) 19 - #endif 20 17 21 18 #define PARAM_SIZE 4096 22 - #define COMMAND_LINE_SIZE 256 23 19 24 20 #define OLD_CL_MAGIC_ADDR 0x90020 25 21 #define OLD_CL_MAGIC 0xA33F ··· 77 77 unsigned long long size, int type); 78 78 79 79 #endif /* __ASSEMBLY__ */ 80 + 81 + #endif /* __KERNEL__ */ 80 82 81 83 #endif /* _i386_SETUP_H */
-1
include/asm-ia64/Kbuild
··· 10 10 header-y += perfmon_default_smpl.h 11 11 header-y += ptrace_offsets.h 12 12 header-y += rse.h 13 - header-y += setup.h 14 13 header-y += ucontext.h 15 14 16 15 unifdef-y += perfmon.h
+7 -2
include/asm-m32r/setup.h
··· 1 1 /* 2 2 * This is set up by the setup-routine at boot-time 3 3 */ 4 + 5 + #define COMMAND_LINE_SIZE 512 6 + 7 + #ifdef __KERNEL__ 8 + 4 9 #define PARAM ((unsigned char *)empty_zero_page) 5 10 6 11 #define MOUNT_ROOT_RDONLY (*(unsigned long *) (PARAM+0x000)) ··· 23 18 24 19 #define SCREEN_INFO (*(struct screen_info *) (PARAM+0x200)) 25 20 26 - #define COMMAND_LINE_SIZE (512) 27 - 28 21 #define RAMDISK_IMAGE_START_MASK (0x07FF) 29 22 #define RAMDISK_PROMPT_FLAG (0x8000) 30 23 #define RAMDISK_LOAD_FLAG (0x4000) 31 24 32 25 extern unsigned long memory_start; 33 26 extern unsigned long memory_end; 27 + 28 + #endif /* __KERNEL__ */ 34 29
+4 -2
include/asm-m68k/setup.h
··· 41 41 #define MACH_Q40 10 42 42 #define MACH_SUN3X 11 43 43 44 + #define COMMAND_LINE_SIZE 256 45 + 44 46 #ifdef __KERNEL__ 47 + 48 + #define CL_SIZE COMMAND_LINE_SIZE 45 49 46 50 #ifndef __ASSEMBLY__ 47 51 extern unsigned long m68k_machtype; ··· 359 355 */ 360 356 361 357 #define NUM_MEMINFO 4 362 - #define CL_SIZE 256 363 - #define COMMAND_LINE_SIZE CL_SIZE 364 358 365 359 #ifndef __ASSEMBLY__ 366 360 struct mem_info {
+5
include/asm-m68knommu/setup.h
··· 1 + #ifdef __KERNEL__ 2 + 1 3 #include <asm-m68k/setup.h> 2 4 3 5 /* We have a bigger command line buffer. */ 4 6 #undef COMMAND_LINE_SIZE 7 + 8 + #endif /* __KERNEL__ */ 9 + 5 10 #define COMMAND_LINE_SIZE 512
-2
include/asm-mips/setup.h
··· 1 - #ifdef __KERNEL__ 2 1 #ifndef _MIPS_SETUP_H 3 2 #define _MIPS_SETUP_H 4 3 5 4 #define COMMAND_LINE_SIZE 256 6 5 7 6 #endif /* __SETUP_H */ 8 - #endif /* __KERNEL__ */
-3
include/asm-powerpc/setup.h
··· 1 1 #ifndef _ASM_POWERPC_SETUP_H 2 2 #define _ASM_POWERPC_SETUP_H 3 3 4 - #ifdef __KERNEL__ 5 - 6 4 #define COMMAND_LINE_SIZE 512 7 5 8 - #endif /* __KERNEL__ */ 9 6 #endif /* _ASM_POWERPC_SETUP_H */
+2 -1
include/asm-s390/setup.h
··· 8 8 #ifndef _ASM_S390_SETUP_H 9 9 #define _ASM_S390_SETUP_H 10 10 11 + #define COMMAND_LINE_SIZE 896 12 + 11 13 #ifdef __KERNEL__ 12 14 13 15 #include <asm/types.h> 14 16 15 17 #define PARMAREA 0x10400 16 - #define COMMAND_LINE_SIZE 896 17 18 #define MEMORY_CHUNKS 16 /* max 0x7fff */ 18 19 #define IPL_PARMBLOCK_ORIGIN 0x2000 19 20
+4 -2
include/asm-sh/setup.h
··· 1 - #ifdef __KERNEL__ 2 1 #ifndef _SH_SETUP_H 3 2 #define _SH_SETUP_H 4 3 5 4 #define COMMAND_LINE_SIZE 256 6 5 6 + #ifdef __KERNEL__ 7 + 7 8 int setup_early_printk(char *); 8 9 9 - #endif /* _SH_SETUP_H */ 10 10 #endif /* __KERNEL__ */ 11 + 12 + #endif /* _SH_SETUP_H */
+6
include/asm-sh64/setup.h
··· 1 1 #ifndef __ASM_SH64_SETUP_H 2 2 #define __ASM_SH64_SETUP_H 3 3 4 + #define COMMAND_LINE_SIZE 256 5 + 6 + #ifdef __KERNEL__ 7 + 4 8 #define PARAM ((unsigned char *)empty_zero_page) 5 9 #define MOUNT_ROOT_RDONLY (*(unsigned long *) (PARAM+0x000)) 6 10 #define RAMDISK_FLAGS (*(unsigned long *) (PARAM+0x004)) ··· 15 11 16 12 #define COMMAND_LINE ((char *) (PARAM+256)) 17 13 #define COMMAND_LINE_SIZE 256 14 + 15 + #endif /* __KERNEL__ */ 18 16 19 17 #endif /* __ASM_SH64_SETUP_H */ 20 18
-1
include/asm-x86_64/Kbuild
··· 12 12 header-y += msr.h 13 13 header-y += prctl.h 14 14 header-y += ptrace-abi.h 15 - header-y += setup.h 16 15 header-y += sigcontext32.h 17 16 header-y += ucontext.h 18 17 header-y += vsyscall32.h