diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2021-03-20 14:01:04 +0100 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2021-03-20 14:01:04 +0100 |
commit | 14ed4ec8a416a60a214bf40f9185aa227ac44598 (patch) | |
tree | ae440de8397ccb9e26d444e24ff5c283cd12d55e | |
parent | 2a2ca935309bfacbc7f87de752f869a89748052c (diff) | |
download | busybox-w32-14ed4ec8a416a60a214bf40f9185aa227ac44598.tar.gz busybox-w32-14ed4ec8a416a60a214bf40f9185aa227ac44598.tar.bz2 busybox-w32-14ed4ec8a416a60a214bf40f9185aa227ac44598.zip |
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>
-rw-r--r-- | klibc-utils/resume.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/klibc-utils/resume.c b/klibc-utils/resume.c index 2bf50f9b8..8c4ab26c4 100644 --- a/klibc-utils/resume.c +++ b/klibc-utils/resume.c | |||
@@ -103,10 +103,17 @@ int resume_main(int argc UNUSED_PARAM, char **argv) | |||
103 | if (major(resume_device) == 0) { | 103 | if (major(resume_device) == 0) { |
104 | bb_error_msg_and_die("invalid resume device: %s", argv[0]); | 104 | bb_error_msg_and_die("invalid resume device: %s", argv[0]); |
105 | } | 105 | } |
106 | |||
106 | ofs = (argv[1] ? xstrtoull(argv[1], 0) : 0); | 107 | ofs = (argv[1] ? xstrtoull(argv[1], 0) : 0); |
108 | /* Old kernels have no /sys/power/resume_offset, set it only if necessary */ | ||
109 | if (ofs != 0) { | ||
110 | fd = xopen("/sys/power/resume_offset", O_WRONLY); | ||
111 | s = xasprintf("%llu", ofs); | ||
112 | xwrite_str(fd, s); | ||
113 | } | ||
107 | 114 | ||
108 | fd = xopen("/sys/power/resume", O_WRONLY); | 115 | fd = xopen("/sys/power/resume", O_WRONLY); |
109 | s = xasprintf("%u:%u:%llu", major(resume_device), minor(resume_device), ofs); | 116 | s = xasprintf("%u:%u", major(resume_device), minor(resume_device)); |
110 | 117 | ||
111 | xwrite_str(fd, s); | 118 | xwrite_str(fd, s); |
112 | /* if write() returns, resume did not succeed */ | 119 | /* if write() returns, resume did not succeed */ |