resume: write offset in /sys/power/resume_offset
Doing this the kernel will hibernate and resume successfully from a swap file. Stop writing offset to /sys/power/resume, as this is not a parameter the kernel takes from this input. (Change added by Sven Mueller) function old new delta resume_main 522 561 +39 .rodata 103175 103182 +7 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 2/0 up/down: 46/0) Total: 46 bytes Signed-off-by: Jordi Pujol Palomer <jordipujolp@gmail.com> Signed-off-by: Sven Mueller <sven.mueller72+busybox@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
parent
2a2ca93530
commit
14ed4ec8a4
@ -103,10 +103,17 @@ int resume_main(int argc UNUSED_PARAM, char **argv)
|
|||||||
if (major(resume_device) == 0) {
|
if (major(resume_device) == 0) {
|
||||||
bb_error_msg_and_die("invalid resume device: %s", argv[0]);
|
bb_error_msg_and_die("invalid resume device: %s", argv[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
ofs = (argv[1] ? xstrtoull(argv[1], 0) : 0);
|
ofs = (argv[1] ? xstrtoull(argv[1], 0) : 0);
|
||||||
|
/* Old kernels have no /sys/power/resume_offset, set it only if necessary */
|
||||||
|
if (ofs != 0) {
|
||||||
|
fd = xopen("/sys/power/resume_offset", O_WRONLY);
|
||||||
|
s = xasprintf("%llu", ofs);
|
||||||
|
xwrite_str(fd, s);
|
||||||
|
}
|
||||||
|
|
||||||
fd = xopen("/sys/power/resume", O_WRONLY);
|
fd = xopen("/sys/power/resume", O_WRONLY);
|
||||||
s = xasprintf("%u:%u:%llu", major(resume_device), minor(resume_device), ofs);
|
s = xasprintf("%u:%u", major(resume_device), minor(resume_device));
|
||||||
|
|
||||||
xwrite_str(fd, s);
|
xwrite_str(fd, s);
|
||||||
/* if write() returns, resume did not succeed */
|
/* if write() returns, resume did not succeed */
|
||||||
|
Loading…
Reference in New Issue
Block a user