C99 patches for kernel files
PATCH 1/1 C99 patches for kernel files
Hi.
Here are three patches that convert files in kernel to use C99 initializers. I think earlier versions of these patches have been used in -ac kernels and maybe others. These patches are against the current 2.5 BK. I think these patches make the files much easier to read.
Art Haas
===== kernel/exec_domain.c 1.14 vs edited =====
kernel/exec_domain.c +62 -20
@@ -32,11 +32,12 @@ };struct exec_domain default_exec_domain = { -"Linux" ,/* name */ - default_handler,/* lcall7 causes a seg fault. */ -0 ,0 ,/* PER_LINUX personality. */ - ident_map,/* Identity map signals. */ - ident_map,/* - both ways. */ + .name ="Linux" ,/* name */ + .handler = default_handler,/* lcall7 causes a seg fault. */ + .pers_low =0 ,/* PER_LINUX personality. */ + .pers_high =0 ,/* PER_LINUX personality. */ + .signal_map = ident_map,/* Identity map signals. */ + .signal_invmap = ident_map,/* - both ways. */ };
@@ -247,24 +248,65 @@int abi_fake_utsname;static struct ctl_table abi_table[] = { - {ABI_DEFHANDLER_COFF ,"defhandler_coff" , &abi_defhandler_coff, -sizeof (int ),0644 ,NULL , &proc_doulongvec_minmax}, - {ABI_DEFHANDLER_ELF ,"defhandler_elf" , &abi_defhandler_elf, -sizeof (int ),0644 ,NULL , &proc_doulongvec_minmax}, - {ABI_DEFHANDLER_LCALL7 ,"defhandler_lcall7" , &abi_defhandler_lcall7, -sizeof (int ),0644 ,NULL , &proc_doulongvec_minmax}, - {ABI_DEFHANDLER_LIBCSO ,"defhandler_libcso" , &abi_defhandler_libcso, -sizeof (int ),0644 ,NULL , &proc_doulongvec_minmax}, - {ABI_TRACE ,"trace" , &abi_traceflg, -sizeof (u_int),0644 ,NULL , &proc_dointvec}, - {ABI_FAKE_UTSNAME ,"fake_utsname" , &abi_fake_utsname, -sizeof (int ),0644 ,NULL , &proc_dointvec}, - {0 } + { + .ctl_name =ABI_DEFHANDLER_COFF , + .procname ="defhandler_coff" , + .data = &abi_defhandler_coff, + .maxlen =sizeof (int ), + .mode =0644 , + .proc_handler = &proc_doulongvec_minmax, + }, + { + .ctl_name =ABI_DEFHANDLER_ELF , + .procname ="defhandler_elf" , + .data = &abi_defhandler_elf, + .maxlen =sizeof (int ), + .mode =0644 , + .proc_handler = &proc_doulongvec_minmax, + }, + { + .ctl_name =ABI_DEFHANDLER_LCALL7 , + .procname ="defhandler_lcall7" , + .data = &abi_defhandler_lcall7, + .maxlen =sizeof (int ), + .mode =0644 , + .proc_handler = &proc_doulongvec_minmax, + }, + { + .ctl_name =ABI_DEFHANDLER_LIBCSO , + .procname ="defhandler_libcso" , + .data = &abi_defhandler_libcso, + .maxlen =sizeof (int ), + .mode =0644 , + .proc_handler = &proc_doulongvec_minmax, + }, + { + .ctl_name =ABI_TRACE , + .procname ="trace" , + .data = &abi_traceflg, + .maxlen =sizeof (u_int), + .mode =0644 , + .proc_handler = &proc_dointvec, + }, + { + .ctl_name =ABI_FAKE_UTSNAME , + .procname ="fake_utsname" , + .data = &abi_fake_utsname, + .maxlen =sizeof (int ), + .mode =0644 , + .proc_handler = &proc_dointvec, + }, + { .ctl_name =0 } };static struct ctl_table abi_root_table[] = { - {CTL_ABI ,"abi" ,NULL ,0 ,0555 , abi_table}, - {0 } + { + .ctl_name =CTL_ABI , + .procname ="abi" , + .mode =0555 , + .child = abi_table, + }, + { .ctl_name =0 } }; static int __init
===== kernel/resource.c 1.10 vs edited =====
kernel/resource.c +13 -2
@@ -20,8 +20,19 @@#include <asm/io.h> -struct resource ioport_resource = {"PCI IO" ,0x0000 ,IO_SPACE_LIMIT ,IORESOURCE_IO }; -struct resource iomem_resource = {"PCI mem" ,0UL , ~0UL ,IORESOURCE_MEM }; +struct resource ioport_resource = { + .name ="PCI IO" , + .start =0x0000 , + .end =IO_SPACE_LIMIT , + .flags =IORESOURCE_IO , +}; + +struct resource iomem_resource = { + .name ="PCI mem" , + .start =0UL , + .end = ~0UL , + .flags =IORESOURCE_MEM , +};static rwlock_t resource_lock =RW_LOCK_UNLOCKED ;
===== kernel/sysctl.c 1.43 vs edited =====
kernel/sysctl.c +572 -156
774 lines not on this page · raw message
Signature · 4 lines
Man once surrendering his reason, has no remaining guard against absurdities the most monstrous, and like a ship without rudder, is the sport of every wind. -Thomas Jefferson to James Smith, 1822