From: Pavel Machek <pavel@ucw.cz>
To: "Huang, Ying" <ying.huang@intel.com>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>,
nigel@nigel.suspend2.net,
Andrew Morton <akpm@linux-foundation.org>,
Jeremy Maitin-Shepard <jbms@cmu.edu>,
linux-kernel@vger.kernel.org,
linux-pm@lists.linux-foundation.org,
Kexec Mailing List <kexec@lists.infradead.org>
Subject: Re: [RFC][PATCH 2/2 -mm] kexec based hibernation: kexec restore
Date: Mon, 27 Aug 2007 23:31:34 +0200 [thread overview]
Message-ID: <20070827213134.GE3398@elf.ucw.cz> (raw)
In-Reply-To: <1188177296.3247.38.camel@caritas-dev.intel.com>
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@intel.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
next prev parent reply other threads:[~2007-08-27 21:44 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-08-27 1:14 [RFC][PATCH 2/2 -mm] kexec based hibernation: kexec restore Huang, Ying
2007-08-27 21:31 ` Pavel Machek [this message]
2007-08-28 1:14 ` Huang, Ying
2007-08-29 15:15 ` Pavel Machek
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20070827213134.GE3398@elf.ucw.cz \
--to=pavel@ucw.cz \
--cc=akpm@linux-foundation.org \
--cc=ebiederm@xmission.com \
--cc=jbms@cmu.edu \
--cc=kexec@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@lists.linux-foundation.org \
--cc=nigel@nigel.suspend2.net \
--cc=ying.huang@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox