[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20070827213134.GE3398@elf.ucw.cz>
Date: Mon, 27 Aug 2007 23:31:34 +0200
From: Pavel Machek <pavel@....cz>
To: "Huang, Ying" <ying.huang@...el.com>
Cc: "Eric W. Biederman" <ebiederm@...ssion.com>,
nigel@...el.suspend2.net,
Andrew Morton <akpm@...ux-foundation.org>,
Jeremy Maitin-Shepard <jbms@....edu>,
linux-kernel@...r.kernel.org, linux-pm@...ts.linux-foundation.org,
Kexec Mailing List <kexec@...ts.infradead.org>
Subject: Re: [RFC][PATCH 2/2 -mm] kexec based hibernation: kexec restore
Hi!
> This patch adds writing support for /dev/oldmem. This is used to
> restore the memory contents of hibernated system.
>
> Signed-off-by: Huang Ying <ying.huang@...el.com>
> +ssize_t write_oldmem_page(unsigned long pfn, const char *buf,
> + size_t csize, unsigned long offset, int userbuf)
Hmm, int userbuf is only ever set to one... Does it make sense to have
write_oldmem_page in the separate file? The onl user is mem.c, perhaps
it should go there?
> +
> +/*
> + * Write memory corresponding to the old kernel.
> + */
> +static ssize_t write_oldmem(struct file *file, const char __user *buf,
> + size_t count, loff_t *ppos)
> +{
> + unsigned long pfn, offset;
> + size_t write = 0, csize;
> + int rc = 0;
> +
> + while (count) {
> + pfn = *ppos / PAGE_SIZE;
> + if (pfn > saved_max_pfn)
> + return write;
> +
> + offset = (unsigned long)(*ppos % PAGE_SIZE);
> + if (count > PAGE_SIZE - offset)
> + csize = PAGE_SIZE - offset;
> + else
> + csize = count;
> + rc = write_oldmem_page(pfn, buf, csize, offset, 1);
> + if (rc < 0)
> + return rc;
> + buf += csize;
> + *ppos += csize;
> + write += csize;
> + count -= csize;
> + }
> + return write;
> +}
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
-
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