[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#984816:



Tags 984816 + fixed-upstream
Thanks 
 
The attached patch is what upstream applied. (But didn't release yet)
Author: Jordi Pujol Palomer <jordipujolp@gmail.com>
Date:   Fri, 19 Mar 2021 09:20:12 +0100

    busybox:

    - klibc-utils/resume.c
      hibernate-resume from swap file.
      - write offset in /sys/power/resume_offset according to the
        kernel's document uswsusp.txt
      - 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)

    Signed-off-by: Sven Mueller <sven.mueller72+busybox@gmail.com>

--- busybox_1.30.1/klibc-utils/resume.c
+++ busybox_1.30.1-new/klibc-utils/resume.c
@@ -105,6 +105,13 @@
 	}
 	ofs = (argv[1] ? xstrtoull(argv[1], 0) : 0);
 
+	if (ofs != 0ULL &&
+	(fd = xopen("/sys/power/resume_offset", O_WRONLY)) != -1) {
+		s = xasprintf("%llu", ofs);
+		xwrite_str(fd, s);
+		close(fd);
+	}
+
 	fd = xopen("/sys/power/resume", O_WRONLY);
 	s = xasprintf("%u:%u:%llu", major(resume_device), minor(resume_device), ofs);
 

--- klibc-utils/resume.c	2021-03-19 09:18:13.302296333 +0100
+++ klibc-utils-new/resume.c	2021-03-19 09:18:57.221518768 +0100
@@ -105,8 +105,15 @@
 	}
 	ofs = (argv[1] ? xstrtoull(argv[1], 0) : 0);
 
+	if (ofs != 0ULL &&
+	(fd = xopen("/sys/power/resume_offset", O_WRONLY)) != -1) {
+		s = xasprintf("%llu", ofs);
+		xwrite_str(fd, s);
+		close(fd);
+	}
+
 	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);
 	/* if write() returns, resume did not succeed */

Reply to: