On Thu, Dec 14, 2006 at 10:59:13PM -0800, Andrew Morton wrote:
> ftp://ftp.kernel.org/pub/linux/kernel/people/akpm/patches/2.6/2.6.20-rc1/2.6.20-rc1-mm1/
>
> +disable-init-initramfsc-updated.patch
Jean-Paul,
The following patch silences the following compile time warning introduced
by the disable-init-initramfsc-updated patch:
CC init/noinitramfs.o
init/noinitramfs.c:42: warning : initialization from incompatible pointer type
In addition, I've cleaned up the headers and added some error handling.
Regards,
Frederik
Signed-off-by: Frederik Deweerdt <[email protected]>
diff --git a/init/noinitramfs.c b/init/noinitramfs.c
index 01f88c3..f4c1a3a 100644
--- a/init/noinitramfs.c
+++ b/init/noinitramfs.c
@@ -18,25 +18,35 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <linux/init.h>
-#include <linux/fs.h>
-#include <linux/slab.h>
-#include <linux/types.h>
-#include <linux/fcntl.h>
-#include <linux/delay.h>
-#include <linux/string.h>
+#include <linux/stat.h>
+#include <linux/kdev_t.h>
#include <linux/syscalls.h>
/*
* Create a simple rootfs that is similar to the default initramfs
*/
-static void __init default_rootfs(void)
+static int __init default_rootfs(void)
{
- int mkdir_err = sys_mkdir("/dev", 0755);
- int err = sys_mknod((const char __user *) "/dev/console",
- S_IFCHR | S_IRUSR | S_IWUSR,
- new_encode_dev(MKDEV(5, 1)));
- if (err == -EROFS)
- printk("Warning: Failed to create a rootfs\n");
- mkdir_err = sys_mkdir("/root", 0700);
+ int err;
+
+ err = sys_mkdir("/dev", 0755);
+ if (err < 0)
+ goto out;
+
+ err = sys_mknod((const char __user *) "/dev/console",
+ S_IFCHR | S_IRUSR | S_IWUSR,
+ new_encode_dev(MKDEV(5, 1)));
+ if (err < 0)
+ goto out;
+
+ err = sys_mkdir("/root", 0700);
+ if (err < 0)
+ goto out;
+
+ return 0;
+
+out:
+ printk(KERN_WARNING "Failed to create a rootfs\n");
+ return err;
}
rootfs_initcall(default_rootfs);
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[Index of Archives]
[Kernel Newbies]
[Netfilter]
[Bugtraq]
[Photo]
[Stuff]
[Gimp]
[Yosemite News]
[MIPS Linux]
[ARM Linux]
[Linux Security]
[Linux RAID]
[Video 4 Linux]
[Linux for the blind]
[Linux Resources]