From: Chen Yu <yu.c.chen@intel.com>
To: snitzer@redhat.com, rafael.j.wysocki@intel.com
Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org,
rui.zhang@intel.com, Chen Yu <yu.c.chen@intel.com>
Subject: [RFC V2] init: support device of major:minor:offset format
Date: Wed, 6 May 2015 08:24:14 +0800 [thread overview]
Message-ID: <1430871854-7096-1-git-send-email-yu.c.chen@intel.com> (raw)
Distribution like Ubuntu uses klibc rather than uswsusp to resume
system from hibernation, which will treat swap partition/file in
the form of major:minor:offset. For example, 8:3:0 represents a
swap partition in klibc, and klibc's resume process in initrd will
finally echo 8:3:0 to /sys/power/resume for manually restoring.
However in current implementation, 8:3:0 will be treated as an invalid
device format, and it is found that manual resumming from hibernation
will fail on lastest kernel.
This patch adds support for device with major:minor:offset format
when resumming from hibernation.
Reported-by: Prigent Christophe <christophe.prigent@intel.com>
Reported-by: Martin Steigerwald <martin@lichtvoll.de>
Signed-off-by: Chen Yu <yu.c.chen@intel.com>
---
init/do_mounts.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/init/do_mounts.c b/init/do_mounts.c
index 8369ffa..e2e3538 100644
--- a/init/do_mounts.c
+++ b/init/do_mounts.c
@@ -225,10 +225,12 @@ dev_t name_to_dev_t(const char *name)
#endif
if (strncmp(name, "/dev/", 5) != 0) {
- unsigned maj, min;
+ unsigned maj, min, offset;
char dummy;
- if (sscanf(name, "%u:%u%c", &maj, &min, &dummy) == 2) {
+ if ((sscanf(name, "%u:%u%c", &maj, &min, &dummy) == 2) ||
+ (sscanf(name,
+ "%u:%u:%u:%c", &maj, &min, &offset, &dummy) == 3)) {
res = MKDEV(maj, min);
if (maj != MAJOR(res) || min != MINOR(res))
goto fail;
--
1.9.1
next reply other threads:[~2015-05-06 0:20 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-06 0:24 Chen Yu [this message]
2015-05-06 16:49 ` [RFC V2] init: support device of major:minor:offset format Geert Uytterhoeven
2015-05-07 1:42 ` Yu Chen
2015-05-07 7:04 ` Geert Uytterhoeven
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=1430871854-7096-1-git-send-email-yu.c.chen@intel.com \
--to=yu.c.chen@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=rafael.j.wysocki@intel.com \
--cc=rui.zhang@intel.com \
--cc=snitzer@redhat.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