[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAMuHMdVFt-dCnmf3KH6HABdBvN7pzND_vOzpCGvnW9em22LWxw@mail.gmail.com>
Date: Mon, 23 Jun 2014 11:30:19 +0200
From: Geert Uytterhoeven <geert@...ux-m68k.org>
To: Yinghai Lu <yinghai@...nel.org>
Cc: Andrew Morton <akpm@...ux-foundation.org>,
"H. Peter Anvin" <hpa@...or.com>, Ingo Molnar <mingo@...e.hu>,
Tetsuo Handa <penguin-kernel@...ove.sakura.ne.jp>,
"Daniel M. Weeks" <dan@...weeks.net>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v2] initramfs: Support initrd that is bigger than 2GiB
On Sat, Jun 21, 2014 at 4:29 AM, Yinghai Lu <yinghai@...nel.org> wrote:
> --- linux-2.6.orig/init/initramfs.c
> +++ linux-2.6/init/initramfs.c
> @@ -19,6 +19,26 @@
> #include <linux/syscalls.h>
> #include <linux/utime.h>
>
> +static long __init xwrite(unsigned int fd, char *p,
> + size_t count)
Shouldn't this return ssize_t instead of long?
> +{
> + ssize_t left = count;
> + long written;
ssize_t written
> +
> + /* sys_write only can write MAX_RW_COUNT aka 2G-4K bytes at most */
> + while (left > 0) {
> + written = sys_write(fd, p, left);
> +
> + if (written <= 0)
> + break;
> +
> + left -= written;
> + p += written;
> + }
> +
> + return (written < 0) ? written : count;
> +}
> +
> static __initdata char *message;
> static void __init error(char *x)
> {
> @@ -604,8 +624,13 @@ static int __init populate_rootfs(void)
> fd = sys_open("/initrd.image",
> O_WRONLY|O_CREAT, 0700);
> if (fd >= 0) {
> - sys_write(fd, (char *)initrd_start,
> - initrd_end - initrd_start);
> + long written = xwrite(fd, (char *)initrd_start,
ssize_t written
> + initrd_end - initrd_start);
> +
> + if (written != initrd_end - initrd_start)
> + pr_err("/initrd.image: incomplete write (%ld != %ld)\n",
"%zd", once written is ssize_t.
> + written, initrd_end - initrd_start);
> +
> sys_close(fd);
> free_initrd();
> }
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@...ux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists