diff options
Diffstat (limited to 'init')
| -rw-r--r-- | init/Kconfig | 5 | ||||
| -rw-r--r-- | init/do_mounts.c | 12 | ||||
| -rw-r--r-- | init/do_mounts_rd.c | 10 | ||||
| -rw-r--r-- | init/initramfs.c | 60 | ||||
| -rw-r--r-- | init/main.c | 23 |
5 files changed, 73 insertions, 37 deletions
diff --git a/init/Kconfig b/init/Kconfig index a291b7ef4738..44f9ed3dae22 100644 --- a/init/Kconfig +++ b/init/Kconfig | |||
| @@ -783,8 +783,13 @@ endchoice | |||
| 783 | 783 | ||
| 784 | endmenu # "RCU Subsystem" | 784 | endmenu # "RCU Subsystem" |
| 785 | 785 | ||
| 786 | config BUILD_BIN2C | ||
| 787 | bool | ||
| 788 | default n | ||
| 789 | |||
| 786 | config IKCONFIG | 790 | config IKCONFIG |
| 787 | tristate "Kernel .config support" | 791 | tristate "Kernel .config support" |
| 792 | select BUILD_BIN2C | ||
| 788 | ---help--- | 793 | ---help--- |
| 789 | This option enables the complete Linux kernel ".config" file | 794 | This option enables the complete Linux kernel ".config" file |
| 790 | contents to be saved in the kernel. It provides documentation | 795 | contents to be saved in the kernel. It provides documentation |
diff --git a/init/do_mounts.c b/init/do_mounts.c index 82f22885c87e..b6237c31b0e2 100644 --- a/init/do_mounts.c +++ b/init/do_mounts.c | |||
| @@ -539,12 +539,6 @@ void __init prepare_namespace(void) | |||
| 539 | { | 539 | { |
| 540 | int is_floppy; | 540 | int is_floppy; |
| 541 | 541 | ||
| 542 | if (root_delay) { | ||
| 543 | printk(KERN_INFO "Waiting %d sec before mounting root device...\n", | ||
| 544 | root_delay); | ||
| 545 | ssleep(root_delay); | ||
| 546 | } | ||
| 547 | |||
| 548 | /* | 542 | /* |
| 549 | * wait for the known devices to complete their probing | 543 | * wait for the known devices to complete their probing |
| 550 | * | 544 | * |
| @@ -571,6 +565,12 @@ void __init prepare_namespace(void) | |||
| 571 | if (initrd_load()) | 565 | if (initrd_load()) |
| 572 | goto out; | 566 | goto out; |
| 573 | 567 | ||
| 568 | if (root_delay) { | ||
| 569 | pr_info("Waiting %d sec before mounting root device...\n", | ||
| 570 | root_delay); | ||
| 571 | ssleep(root_delay); | ||
| 572 | } | ||
| 573 | |||
| 574 | /* wait for any asynchronous scanning to complete */ | 574 | /* wait for any asynchronous scanning to complete */ |
| 575 | if ((ROOT_DEV == 0) && root_wait) { | 575 | if ((ROOT_DEV == 0) && root_wait) { |
| 576 | printk(KERN_INFO "Waiting for root device %s...\n", | 576 | printk(KERN_INFO "Waiting for root device %s...\n", |
diff --git a/init/do_mounts_rd.c b/init/do_mounts_rd.c index a8227022e3a0..e5d059e8aa11 100644 --- a/init/do_mounts_rd.c +++ b/init/do_mounts_rd.c | |||
| @@ -311,9 +311,9 @@ static int exit_code; | |||
| 311 | static int decompress_error; | 311 | static int decompress_error; |
| 312 | static int crd_infd, crd_outfd; | 312 | static int crd_infd, crd_outfd; |
| 313 | 313 | ||
| 314 | static int __init compr_fill(void *buf, unsigned int len) | 314 | static long __init compr_fill(void *buf, unsigned long len) |
| 315 | { | 315 | { |
| 316 | int r = sys_read(crd_infd, buf, len); | 316 | long r = sys_read(crd_infd, buf, len); |
| 317 | if (r < 0) | 317 | if (r < 0) |
| 318 | printk(KERN_ERR "RAMDISK: error while reading compressed data"); | 318 | printk(KERN_ERR "RAMDISK: error while reading compressed data"); |
| 319 | else if (r == 0) | 319 | else if (r == 0) |
| @@ -321,13 +321,13 @@ static int __init compr_fill(void *buf, unsigned int len) | |||
| 321 | return r; | 321 | return r; |
| 322 | } | 322 | } |
| 323 | 323 | ||
| 324 | static int __init compr_flush(void *window, unsigned int outcnt) | 324 | static long __init compr_flush(void *window, unsigned long outcnt) |
| 325 | { | 325 | { |
| 326 | int written = sys_write(crd_outfd, window, outcnt); | 326 | long written = sys_write(crd_outfd, window, outcnt); |
| 327 | if (written != outcnt) { | 327 | if (written != outcnt) { |
| 328 | if (decompress_error == 0) | 328 | if (decompress_error == 0) |
| 329 | printk(KERN_ERR | 329 | printk(KERN_ERR |
| 330 | "RAMDISK: incomplete write (%d != %d)\n", | 330 | "RAMDISK: incomplete write (%ld != %ld)\n", |
| 331 | written, outcnt); | 331 | written, outcnt); |
| 332 | decompress_error = 1; | 332 | decompress_error = 1; |
| 333 | return -1; | 333 | return -1; |
diff --git a/init/initramfs.c b/init/initramfs.c index a8497fab1c3d..bece48c3461e 100644 --- a/init/initramfs.c +++ b/init/initramfs.c | |||
| @@ -19,6 +19,29 @@ | |||
| 19 | #include <linux/syscalls.h> | 19 | #include <linux/syscalls.h> |
| 20 | #include <linux/utime.h> | 20 | #include <linux/utime.h> |
| 21 | 21 | ||
| 22 | static ssize_t __init xwrite(int fd, const char *p, size_t count) | ||
| 23 | { | ||
| 24 | ssize_t out = 0; | ||
| 25 | |||
| 26 | /* sys_write only can write MAX_RW_COUNT aka 2G-4K bytes at most */ | ||
| 27 | while (count) { | ||
| 28 | ssize_t rv = sys_write(fd, p, count); | ||
| 29 | |||
| 30 | if (rv < 0) { | ||
| 31 | if (rv == -EINTR || rv == -EAGAIN) | ||
| 32 | continue; | ||
| 33 | return out ? out : rv; | ||
| 34 | } else if (rv == 0) | ||
| 35 | break; | ||
| 36 | |||
| 37 | p += rv; | ||
| 38 | out += rv; | ||
| 39 | count -= rv; | ||
| 40 | } | ||
| 41 | |||
| 42 | return out; | ||
| 43 | } | ||
| 44 | |||
| 22 | static __initdata char *message; | 45 | static __initdata char *message; |
| 23 | static void __init error(char *x) | 46 | static void __init error(char *x) |
| 24 | { | 47 | { |
| @@ -174,7 +197,7 @@ static __initdata enum state { | |||
| 174 | } state, next_state; | 197 | } state, next_state; |
| 175 | 198 | ||
| 176 | static __initdata char *victim; | 199 | static __initdata char *victim; |
| 177 | static __initdata unsigned count; | 200 | static unsigned long count __initdata; |
| 178 | static __initdata loff_t this_header, next_header; | 201 | static __initdata loff_t this_header, next_header; |
| 179 | 202 | ||
| 180 | static inline void __init eat(unsigned n) | 203 | static inline void __init eat(unsigned n) |
| @@ -186,7 +209,7 @@ static inline void __init eat(unsigned n) | |||
| 186 | 209 | ||
| 187 | static __initdata char *vcollected; | 210 | static __initdata char *vcollected; |
| 188 | static __initdata char *collected; | 211 | static __initdata char *collected; |
| 189 | static __initdata int remains; | 212 | static long remains __initdata; |
| 190 | static __initdata char *collect; | 213 | static __initdata char *collect; |
| 191 | 214 | ||
| 192 | static void __init read_into(char *buf, unsigned size, enum state next) | 215 | static void __init read_into(char *buf, unsigned size, enum state next) |
| @@ -213,7 +236,7 @@ static int __init do_start(void) | |||
| 213 | 236 | ||
| 214 | static int __init do_collect(void) | 237 | static int __init do_collect(void) |
| 215 | { | 238 | { |
| 216 | unsigned n = remains; | 239 | unsigned long n = remains; |
| 217 | if (count < n) | 240 | if (count < n) |
| 218 | n = count; | 241 | n = count; |
| 219 | memcpy(collect, victim, n); | 242 | memcpy(collect, victim, n); |
| @@ -346,7 +369,8 @@ static int __init do_name(void) | |||
| 346 | static int __init do_copy(void) | 369 | static int __init do_copy(void) |
| 347 | { | 370 | { |
| 348 | if (count >= body_len) { | 371 | if (count >= body_len) { |
| 349 | sys_write(wfd, victim, body_len); | 372 | if (xwrite(wfd, victim, body_len) != body_len) |
| 373 | error("write error"); | ||
| 350 | sys_close(wfd); | 374 | sys_close(wfd); |
| 351 | do_utime(vcollected, mtime); | 375 | do_utime(vcollected, mtime); |
| 352 | kfree(vcollected); | 376 | kfree(vcollected); |
| @@ -354,7 +378,8 @@ static int __init do_copy(void) | |||
| 354 | state = SkipIt; | 378 | state = SkipIt; |
| 355 | return 0; | 379 | return 0; |
| 356 | } else { | 380 | } else { |
| 357 | sys_write(wfd, victim, count); | 381 | if (xwrite(wfd, victim, count) != count) |
| 382 | error("write error"); | ||
| 358 | body_len -= count; | 383 | body_len -= count; |
| 359 | eat(count); | 384 | eat(count); |
| 360 | return 1; | 385 | return 1; |
| @@ -384,7 +409,7 @@ static __initdata int (*actions[])(void) = { | |||
| 384 | [Reset] = do_reset, | 409 | [Reset] = do_reset, |
| 385 | }; | 410 | }; |
| 386 | 411 | ||
| 387 | static int __init write_buffer(char *buf, unsigned len) | 412 | static long __init write_buffer(char *buf, unsigned long len) |
| 388 | { | 413 | { |
| 389 | count = len; | 414 | count = len; |
| 390 | victim = buf; | 415 | victim = buf; |
| @@ -394,11 +419,11 @@ static int __init write_buffer(char *buf, unsigned len) | |||
| 394 | return len - count; | 419 | return len - count; |
| 395 | } | 420 | } |
| 396 | 421 | ||
| 397 | static int __init flush_buffer(void *bufv, unsigned len) | 422 | static long __init flush_buffer(void *bufv, unsigned long len) |
| 398 | { | 423 | { |
| 399 | char *buf = (char *) bufv; | 424 | char *buf = (char *) bufv; |
| 400 | int written; | 425 | long written; |
| 401 | int origLen = len; | 426 | long origLen = len; |
| 402 | if (message) | 427 | if (message) |
| 403 | return -1; | 428 | return -1; |
| 404 | while ((written = write_buffer(buf, len)) < len && !message) { | 429 | while ((written = write_buffer(buf, len)) < len && !message) { |
| @@ -417,13 +442,13 @@ static int __init flush_buffer(void *bufv, unsigned len) | |||
| 417 | return origLen; | 442 | return origLen; |
| 418 | } | 443 | } |
| 419 | 444 | ||
| 420 | static unsigned my_inptr; | ||
