aboutsummaryrefslogtreecommitdiffstats
path: root/init
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2008-10-19 13:04:47 -0400
committerIngo Molnar <mingo@elte.hu>2008-10-19 13:04:47 -0400
commit3e10e879a8c334a5927d800a3663a24d562cfa31 (patch)
tree5d18bc7e38c986a044e99aa0d0a4aff4931ec7d0 /init
parent98d9c66ab07471006fd7910cb16453581c41a3e7 (diff)
parent0cfd81031a26717fe14380d18275f8e217571615 (diff)
Merge branch 'linus' into tracing-v28-for-linus-v3
Conflicts: init/main.c kernel/module.c scripts/bootgraph.pl
Diffstat (limited to 'init')
-rw-r--r--init/Kconfig18
-rw-r--r--init/do_mounts_md.c41
-rw-r--r--init/do_mounts_rd.c2
-rw-r--r--init/initramfs.c53
4 files changed, 94 insertions, 20 deletions
diff --git a/init/Kconfig b/init/Kconfig
index 031344f954fd..c258a41c8330 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -713,6 +713,14 @@ config SHMEM
713 option replaces shmem and tmpfs with the much simpler ramfs code, 713 option replaces shmem and tmpfs with the much simpler ramfs code,
714 which may be appropriate on small systems without swap. 714 which may be appropriate on small systems without swap.
715 715
716config AIO
717 bool "Enable AIO support" if EMBEDDED
718 default y
719 help
720 This option enables POSIX asynchronous I/O which may by used
721 by some high performance threaded applications. Disabling
722 this option saves about 7k.
723
716config VM_EVENT_COUNTERS 724config VM_EVENT_COUNTERS
717 default y 725 default y
718 bool "Enable VM event counters for /proc/vmstat" if EMBEDDED 726 bool "Enable VM event counters for /proc/vmstat" if EMBEDDED
@@ -786,16 +794,6 @@ config MARKERS
786 794
787source "arch/Kconfig" 795source "arch/Kconfig"
788 796
789config PROC_PAGE_MONITOR
790 default y
791 depends on PROC_FS && MMU
792 bool "Enable /proc page monitoring" if EMBEDDED
793 help
794 Various /proc files exist to monitor process memory utilization:
795 /proc/pid/smaps, /proc/pid/clear_refs, /proc/pid/pagemap,
796 /proc/kpagecount, and /proc/kpageflags. Disabling these
797 interfaces will reduce the size of the kernel by approximately 4kb.
798
799endmenu # General setup 797endmenu # General setup
800 798
801config HAVE_GENERIC_DMA_COHERENT 799config HAVE_GENERIC_DMA_COHERENT
diff --git a/init/do_mounts_md.c b/init/do_mounts_md.c
index 693d24694a6c..4c87ee1fe5d3 100644
--- a/init/do_mounts_md.c
+++ b/init/do_mounts_md.c
@@ -1,5 +1,6 @@
1 1
2#include <linux/raid/md.h> 2#include <linux/raid/md.h>
3#include <linux/delay.h>
3 4
4#include "do_mounts.h" 5#include "do_mounts.h"
5 6
@@ -12,7 +13,12 @@
12 * The code for that is here. 13 * The code for that is here.
13 */ 14 */
14 15
15static int __initdata raid_noautodetect, raid_autopart; 16#ifdef CONFIG_MD_AUTODETECT
17static int __initdata raid_noautodetect;
18#else
19static int __initdata raid_noautodetect=1;
20#endif
21static int __initdata raid_autopart;
16 22
17static struct { 23static struct {
18 int minor; 24 int minor;
@@ -252,6 +258,8 @@ static int __init raid_setup(char *str)
252 258
253 if (!strncmp(str, "noautodetect", wlen)) 259 if (!strncmp(str, "noautodetect", wlen))
254 raid_noautodetect = 1; 260 raid_noautodetect = 1;
261 if (!strncmp(str, "autodetect", wlen))
262 raid_noautodetect = 0;
255 if (strncmp(str, "partitionable", wlen)==0) 263 if (strncmp(str, "partitionable", wlen)==0)
256 raid_autopart = 1; 264 raid_autopart = 1;
257 if (strncmp(str, "part", wlen)==0) 265 if (strncmp(str, "part", wlen)==0)
@@ -264,17 +272,32 @@ static int __init raid_setup(char *str)
264__setup("raid=", raid_setup); 272__setup("raid=", raid_setup);
265__setup("md=", md_setup); 273__setup("md=", md_setup);
266 274
275static void autodetect_raid(void)
276{
277 int fd;
278
279 /*
280 * Since we don't want to detect and use half a raid array, we need to
281 * wait for the known devices to complete their probing
282 */
283 printk(KERN_INFO "md: Waiting for all devices to be available before autodetect\n");
284 printk(KERN_INFO "md: If you don't use raid, use raid=noautodetect\n");
285 while (driver_probe_done() < 0)
286 msleep(100);
287 fd = sys_open("/dev/md0", 0, 0);
288 if (fd >= 0) {
289 sys_ioctl(fd, RAID_AUTORUN, raid_autopart);
290 sys_close(fd);
291 }
292}
293
267void __init md_run_setup(void) 294void __init md_run_setup(void)
268{ 295{
269 create_dev("/dev/md0", MKDEV(MD_MAJOR, 0)); 296 create_dev("/dev/md0", MKDEV(MD_MAJOR, 0));
297
270 if (raid_noautodetect) 298 if (raid_noautodetect)
271 printk(KERN_INFO "md: Skipping autodetection of RAID arrays. (raid=noautodetect)\n"); 299 printk(KERN_INFO "md: Skipping autodetection of RAID arrays. (raid=autodetect will force)\n");
272 else { 300 else
273 int fd = sys_open("/dev/md0", 0, 0); 301 autodetect_raid();
274 if (fd >= 0) {
275 sys_ioctl(fd, RAID_AUTORUN, raid_autopart);
276 sys_close(fd);
277 }
278 }
279 md_setup_drive(); 302 md_setup_drive();
280} 303}
diff --git a/init/do_mounts_rd.c b/init/do_mounts_rd.c
index fedef93b586f..a7c748fa977a 100644
--- a/init/do_mounts_rd.c
+++ b/init/do_mounts_rd.c
@@ -71,7 +71,7 @@ identify_ramdisk_image(int fd, int start_block)
71 sys_read(fd, buf, size); 71 sys_read(fd, buf, size);
72 72
73 /* 73 /*
74 * If it matches the gzip magic numbers, return -1 74 * If it matches the gzip magic numbers, return 0
75 */ 75 */
76 if (buf[0] == 037 && ((buf[1] == 0213) || (buf[1] == 0236))) { 76 if (buf[0] == 037 && ((buf[1] == 0213) || (buf[1] == 0236))) {
77 printk(KERN_NOTICE 77 printk(KERN_NOTICE
diff --git a/init/initramfs.c b/init/initramfs.c
index 644fc01ad5f0..4f5ba75aaa7c 100644
--- a/init/initramfs.c
+++ b/init/initramfs.c
@@ -6,6 +6,7 @@
6#include <linux/delay.h> 6#include <linux/delay.h>
7#include <linux/string.h> 7#include <linux/string.h>
8#include <linux/syscalls.h> 8#include <linux/syscalls.h>
9#include <linux/utime.h>
9 10
10static __initdata char *message; 11static __initdata char *message;
11static void __init error(char *x) 12static void __init error(char *x)
@@ -72,6 +73,49 @@ static void __init free_hash(void)
72 } 73 }
73} 74}
74 75
76static long __init do_utime(char __user *filename, time_t mtime)
77{
78 struct timespec t[2];
79
80 t[0].tv_sec = mtime;
81 t[0].tv_nsec = 0;
82 t[1].tv_sec = mtime;
83 t[1].tv_nsec = 0;
84
85 return do_utimes(AT_FDCWD, filename, t, AT_SYMLINK_NOFOLLOW);
86}
87
88static __initdata LIST_HEAD(dir_list);
89struct dir_entry {
90 struct list_head list;
91 char *name;
92 time_t mtime;
93};
94
95static void __init dir_add(const char *name, time_t mtime)
96{
97 struct dir_entry *de = kmalloc(sizeof(struct dir_entry), GFP_KERNEL);
98 if (!de)
99 panic("can't allocate dir_entry buffer");
100 INIT_LIST_HEAD(&de->list);
101 de->name = kstrdup(name, GFP_KERNEL);
102 de->mtime = mtime;
103 list_add(&de->list, &dir_list);
104}
105
106static void __init dir_utime(void)
107{
108 struct dir_entry *de, *tmp;
109 list_for_each_entry_safe(de, tmp, &dir_list, list) {
110 list_del(&de->list);
111 do_utime(de->name, de->mtime);
112 kfree(de->name);
113 kfree(de);
114 }
115}
116
117static __initdata time_t mtime;
118
75/* cpio header parsing */ 119/* cpio header parsing */
76 120
77static __initdata unsigned long ino, major, minor, nlink; 121static __initdata unsigned long ino, major, minor, nlink;
@@ -97,6 +141,7 @@ static void __init parse_header(char *s)
97 uid = parsed[2]; 141 uid = parsed[2];
98 gid = parsed[3]; 142 gid = parsed[3];
99 nlink = parsed[4]; 143 nlink = parsed[4];
144 mtime = parsed[5];
100 body_len = parsed[6]; 145 body_len = parsed[6];
101 major = parsed[7]; 146 major = parsed[7];
102 minor = parsed[8]; 147 minor = parsed[8];
@@ -130,6 +175,7 @@ static inline void __init eat(unsigned n)
130 count -= n; 175 count -= n;
131} 176}
132 177
178static __initdata char *vcollected;
133static __initdata char *collected; 179static __initdata char *collected;
134static __initdata int remains; 180static __initdata int remains;
135static __initdata char *collect; 181static __initdata char *collect;
@@ -271,6 +317,7 @@ static int __init do_name(void)
271 if (wfd >= 0) { 317 if (wfd >= 0) {
272 sys_fchown(wfd, uid, gid); 318 sys_fchown(wfd, uid, gid);
273 sys_fchmod(wfd, mode); 319 sys_fchmod(wfd, mode);
320 vcollected = kstrdup(collected, GFP_KERNEL);
274 state = CopyFile; 321 state = CopyFile;
275 } 322 }
276 } 323 }
@@ -278,12 +325,14 @@ static int __init do_name(void)
278 sys_mkdir(collected, mode); 325 sys_mkdir(collected, mode);
279 sys_chown(collected, uid, gid); 326 sys_chown(collected, uid, gid);
280 sys_chmod(collected, mode); 327 sys_chmod(collected, mode);
328 dir_add(collected, mtime);
281 } else if (S_ISBLK(mode) || S_ISCHR(mode) || 329 } else if (S_ISBLK(mode) || S_ISCHR(mode) ||
282 S_ISFIFO(mode) || S_ISSOCK(mode)) { 330 S_ISFIFO(mode) || S_ISSOCK(mode)) {
283 if (maybe_link() == 0) { 331 if (maybe_link() == 0) {
284 sys_mknod(collected, mode, rdev); 332 sys_mknod(collected, mode, rdev);
285 sys_chown(collected, uid, gid); 333 sys_chown(collected, uid, gid);
286 sys_chmod(collected, mode); 334 sys_chmod(collected, mode);
335 do_utime(collected, mtime);
287 } 336 }
288 } 337 }
289 return 0; 338 return 0;
@@ -294,6 +343,8 @@ static int __init do_copy(void)
294 if (count >= body_len) { 343 if (count >= body_len) {
295 sys_write(wfd, victim, body_len); 344 sys_write(wfd, victim, body_len);
296 sys_close(wfd); 345 sys_close(wfd);
346 do_utime(vcollected, mtime);
347 kfree(vcollected);
297 eat(body_len); 348 eat(body_len);
298 state = SkipIt; 349 state = SkipIt;
299 return 0; 350 return 0;
@@ -311,6 +362,7 @@ static int __init do_symlink(void)
311 clean_path(collected, 0); 362 clean_path(collected, 0);
312 sys_symlink(collected + N_ALIGN(name_len), collected); 363 sys_symlink(collected + N_ALIGN(name_len), collected);
313 sys_lchown(collected, uid, gid); 364 sys_lchown(collected, uid, gid);
365 do_utime(collected, mtime);
314 state = SkipIt; 366 state = SkipIt;
315 next_state = Reset; 367 next_state = Reset;
316 return 0; 368 return 0;
@@ -466,6 +518,7 @@ static char * __init unpack_to_rootfs(char *buf, unsigned len, int check_only)
466 buf += inptr; 518 buf += inptr;
467 len -= inptr; 519 len -= inptr;
468 } 520 }
521 dir_utime();
469 kfree(window); 522 kfree(window);
470 kfree(name_buf); 523 kfree(name_buf);
471 kfree(symlink_buf); 524 kfree(symlink_buf);