[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1430871854-7096-1-git-send-email-yu.c.chen@intel.com>
Date: Wed, 6 May 2015 08:24:14 +0800
From: Chen Yu <yu.c.chen@...el.com>
To: snitzer@...hat.com, rafael.j.wysocki@...el.com
Cc: linux-pm@...r.kernel.org, linux-kernel@...r.kernel.org,
rui.zhang@...el.com, Chen Yu <yu.c.chen@...el.com>
Subject: [RFC V2] init: support device of major:minor:offset format
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@...el.com>
Reported-by: Martin Steigerwald <martin@...htvoll.de>
Signed-off-by: Chen Yu <yu.c.chen@...el.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
--
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