aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2009-03-28 17:00:33 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2009-03-28 17:00:33 -0400
commiteedf2c5296a8dfaaf9aec1a938c1d3bd73159a30 (patch)
treea02e5ef1f2ae46c6328a6744e806c9e7dbff7327
parent0151f94f2e61c39858e714a5d92244b0e5a7fdf5 (diff)
parentdf52092f3c97788592ef72501a43fb7ac6a3cfe0 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/arjan/linux-2.6-async-for-30
* git://git.kernel.org/pub/scm/linux/kernel/git/arjan/linux-2.6-async-for-30: fastboot: remove duplicate unpack_to_rootfs() ide/net: flip the order of SATA and network init async: remove the temporary (2.6.29) "async is off by default" code Fix up conflicts in init/initramfs.c manually
-rw-r--r--drivers/Makefile5
-rw-r--r--init/initramfs.c71
-rw-r--r--kernel/async.c18
3 files changed, 64 insertions, 30 deletions
diff --git a/drivers/Makefile b/drivers/Makefile
index c1bf41737936..2618a6169a13 100644
--- a/drivers/Makefile
+++ b/drivers/Makefile
@@ -36,13 +36,14 @@ obj-$(CONFIG_FB_INTEL) += video/intelfb/
36 36
37obj-y += serial/ 37obj-y += serial/
38obj-$(CONFIG_PARPORT) += parport/ 38obj-$(CONFIG_PARPORT) += parport/
39obj-y += base/ block/ misc/ mfd/ net/ media/ 39obj-y += base/ block/ misc/ mfd/ media/
40obj-$(CONFIG_NUBUS) += nubus/ 40obj-$(CONFIG_NUBUS) += nubus/
41obj-$(CONFIG_ATM) += atm/
42obj-y += macintosh/ 41obj-y += macintosh/
43obj-$(CONFIG_IDE) += ide/ 42obj-$(CONFIG_IDE) += ide/
44obj-$(CONFIG_SCSI) += scsi/ 43obj-$(CONFIG_SCSI) += scsi/
45obj-$(CONFIG_ATA) += ata/ 44obj-$(CONFIG_ATA) += ata/
45obj-y += net/
46obj-$(CONFIG_ATM) += atm/
46obj-$(CONFIG_FUSION) += message/ 47obj-$(CONFIG_FUSION) += message/
47obj-$(CONFIG_FIREWIRE) += firewire/ 48obj-$(CONFIG_FIREWIRE) += firewire/
48obj-y += ieee1394/ 49obj-y += ieee1394/
diff --git a/init/initramfs.c b/init/initramfs.c
index 7dcde7ea6603..619c1baf7701 100644
--- a/init/initramfs.c
+++ b/init/initramfs.c
@@ -5,6 +5,7 @@
5#include <linux/fcntl.h> 5#include <linux/fcntl.h>
6#include <linux/delay.h> 6#include <linux/delay.h>
7#include <linux/string.h> 7#include <linux/string.h>
8#include <linux/dirent.h>
8#include <linux/syscalls.h> 9#include <linux/syscalls.h>
9#include <linux/utime.h> 10#include <linux/utime.h>
10 11
@@ -166,8 +167,6 @@ static __initdata char *victim;
166static __initdata unsigned count; 167static __initdata unsigned count;
167static __initdata loff_t this_header, next_header; 168static __initdata loff_t this_header, next_header;
168 169
169static __initdata int dry_run;
170
171static inline void __init eat(unsigned n) 170static inline void __init eat(unsigned n)
172{ 171{
173 victim += n; 172 victim += n;
@@ -229,10 +228,6 @@ static int __init do_header(void)
229 parse_header(collected); 228 parse_header(collected);
230 next_header = this_header + N_ALIGN(name_len) + body_len; 229 next_header = this_header + N_ALIGN(name_len) + body_len;
231 next_header = (next_header + 3) & ~3; 230 next_header = (next_header + 3) & ~3;
232 if (dry_run) {
233 read_into(name_buf, N_ALIGN(name_len), GotName);
234 return 0;
235 }
236 state = SkipIt; 231 state = SkipIt;
237 if (name_len <= 0 || name_len > PATH_MAX) 232 if (name_len <= 0 || name_len > PATH_MAX)
238 return 0; 233 return 0;
@@ -303,8 +298,6 @@ static int __init do_name(void)
303 free_hash(); 298 free_hash();
304 return 0; 299 return 0;
305 } 300 }
306 if (dry_run)
307 return 0;
308 clean_path(collected, mode); 301 clean_path(collected, mode);
309 if (S_ISREG(mode)) { 302 if (S_ISREG(mode)) {
310 int ml = maybe_link(); 303 int ml = maybe_link();
@@ -417,14 +410,13 @@ static unsigned my_inptr; /* index of next byte to be processed in inbuf */
417 410
418#include <linux/decompress/generic.h> 411#include <linux/decompress/generic.h>
419 412
420static char * __init unpack_to_rootfs(char *buf, unsigned len, int check_only) 413static char * __init unpack_to_rootfs(char *buf, unsigned len)
421{ 414{
422 int written; 415 int written;
423 decompress_fn decompress; 416 decompress_fn decompress;
424 const char *compress_name; 417 const char *compress_name;
425 static __initdata char msg_buf[64]; 418 static __initdata char msg_buf[64];
426 419
427 dry_run = check_only;
428 header_buf = kmalloc(110, GFP_KERNEL); 420 header_buf = kmalloc(110, GFP_KERNEL);
429 symlink_buf = kmalloc(PATH_MAX + N_ALIGN(PATH_MAX) + 1, GFP_KERNEL); 421 symlink_buf = kmalloc(PATH_MAX + N_ALIGN(PATH_MAX) + 1, GFP_KERNEL);
430 name_buf = kmalloc(N_ALIGN(PATH_MAX), GFP_KERNEL); 422 name_buf = kmalloc(N_ALIGN(PATH_MAX), GFP_KERNEL);
@@ -523,10 +515,57 @@ skip:
523 initrd_end = 0; 515 initrd_end = 0;
524} 516}
525 517
518#define BUF_SIZE 1024
519static void __init clean_rootfs(void)
520{
521 int fd;
522 void *buf;
523 struct linux_dirent64 *dirp;
524 int count;
525
526 fd = sys_open("/", O_RDONLY, 0);
527 WARN_ON(fd < 0);
528 if (fd < 0)
529 return;
530 buf = kzalloc(BUF_SIZE, GFP_KERNEL);
531 WARN_ON(!buf);
532 if (!buf) {
533 sys_close(fd);
534 return;
535 }
536
537 dirp = buf;
538 count = sys_getdents64(fd, dirp, BUF_SIZE);
539 while (count > 0) {
540 while (count > 0) {
541 struct stat st;
542 int ret;
543
544 ret = sys_newlstat(dirp->d_name, &st);
545 WARN_ON_ONCE(ret);
546 if (!ret) {
547 if (S_ISDIR(st.st_mode))
548 sys_rmdir(dirp->d_name);
549 else
550 sys_unlink(dirp->d_name);
551 }
552
553 count -= dirp->d_reclen;
554 dirp = (void *)dirp + dirp->d_reclen;
555 }
556 dirp = buf;
557 memset(buf, 0, BUF_SIZE);
558 count = sys_getdents64(fd, dirp, BUF_SIZE);
559 }
560
561 sys_close(fd);
562 kfree(buf);
563}
564
526static int __init populate_rootfs(void) 565static int __init populate_rootfs(void)
527{ 566{
528 char *err = unpack_to_rootfs(__initramfs_start, 567 char *err = unpack_to_rootfs(__initramfs_start,
529 __initramfs_end - __initramfs_start, 0); 568 __initramfs_end - __initramfs_start);
530 if (err) 569 if (err)
531 panic(err); /* Failed to decompress INTERNAL initramfs */ 570 panic(err); /* Failed to decompress INTERNAL initramfs */
532 if (initrd_start) { 571 if (initrd_start) {
@@ -534,13 +573,15 @@ static int __init populate_rootfs(void)
534 int fd; 573 int fd;
535 printk(KERN_INFO "checking if image is initramfs..."); 574 printk(KERN_INFO "checking if image is initramfs...");
536 err = unpack_to_rootfs((char *)initrd_start, 575 err = unpack_to_rootfs((char *)initrd_start,
537 initrd_end - initrd_start, 1); 576 initrd_end - initrd_start);
538 if (!err) { 577 if (!err) {
539 printk(" it is\n"); 578 printk(" it is\n");
540 unpack_to_rootfs((char *)initrd_start,
541 initrd_end - initrd_start, 0);
542 free_initrd(); 579 free_initrd();
543 return 0; 580 return 0;
581 } else {
582 clean_rootfs();
583 unpack_to_rootfs(__initramfs_start,
584 __initramfs_end - __initramfs_start);
544 } 585 }
545 printk("it isn't (%s); looks like an initrd\n", err); 586 printk("it isn't (%s); looks like an initrd\n", err);
546 fd = sys_open("/initrd.image", O_WRONLY|O_CREAT, 0700); 587 fd = sys_open("/initrd.image", O_WRONLY|O_CREAT, 0700);
@@ -553,7 +594,7 @@ static int __init populate_rootfs(void)
553#else 594#else
554 printk(KERN_INFO "Unpacking initramfs..."); 595 printk(KERN_INFO "Unpacking initramfs...");
555 err = unpack_to_rootfs((char *)initrd_start, 596 err = unpack_to_rootfs((char *)initrd_start,
556 initrd_end - initrd_start, 0); 597 initrd_end - initrd_start);
557 if (err) { 598 if (err) {
558 printk(" failed!\n"); 599 printk(" failed!\n");
559 printk(KERN_EMERG "%s\n", err); 600 printk(KERN_EMERG "%s\n", err);
diff --git a/kernel/async.c b/kernel/async.c
index f565891f2c9b..968ef9457d4e 100644
--- a/kernel/async.c
+++ b/kernel/async.c
@@ -49,6 +49,7 @@ asynchronous and synchronous parts of the kernel.
49*/ 49*/
50 50
51#include <linux/async.h> 51#include <linux/async.h>
52#include <linux/bug.h>
52#include <linux/module.h> 53#include <linux/module.h>
53#include <linux/wait.h> 54#include <linux/wait.h>
54#include <linux/sched.h> 55#include <linux/sched.h>
@@ -387,20 +388,11 @@ static int async_manager_thread(void *unused)
387 388
388static int __init async_init(void) 389static int __init async_init(void)
389{ 390{
390 if (async_enabled) 391 async_enabled =
391 if (IS_ERR(kthread_run(async_manager_thread, NULL, 392 !IS_ERR(kthread_run(async_manager_thread, NULL, "async/mgr"));
392 "async/mgr")))
393 async_enabled = 0;
394 return 0;
395}
396 393
397static int __init setup_async(char *str) 394 WARN_ON(!async_enabled);
398{ 395 return 0;
399 async_enabled = 1;
400 return 1;
401} 396}
402 397
403__setup("fastboot", setup_async);
404
405
406core_initcall(async_init); 398core_initcall(async_init);