[klibc] [patch] kinit/resume.c split big do_resume()

maximilian attems maks at sternwelten.at
Mon Jul 10 17:05:46 PDT 2006


do_resume() checks and needs the /proc/cmdline args.
split it up in 2 smaller functions.
resume("/dev/<resumedev>") may be later called from an
standalone klibc bin. 
add a small resume.h for that effect.

Signed-off-by: maximilian attems <maks at sternwelten.at>

---
 kinit.c  |    1 +
 kinit.h  |    1 -
 resume.c |   14 ++++++++++----
 resume.h |    8 +++++++-
 4 files changed, 18 insertions(+), 6 deletions(-)

diff --git a/usr/kinit/kinit.c b/usr/kinit/kinit.c
index ce4725c..a4be8bc 100644
--- a/usr/kinit/kinit.c
+++ b/usr/kinit/kinit.c
@@ -13,6 +13,7 @@ #include <termios.h>
 #include "kinit.h"
 #include "ipconfig.h"
 #include "run-init.h"
+#include "resume.h"
 
 const char *progname = "kinit";
 int mnt_procfs;
diff --git a/usr/kinit/kinit.h b/usr/kinit/kinit.h
index 23d974b..03cc358 100644
--- a/usr/kinit/kinit.h
+++ b/usr/kinit/kinit.h
@@ -13,7 +13,6 @@ int do_mounts(int argc, char *argv[]);
 int mount_nfs_root(int argc, char *argv[], int flags);
 int ramdisk_load(int argc, char *argv[], dev_t root_dev);
 void md_run(int argc, char *argv[]);
-int do_resume(int argc, char *argv[]);
 const char *bdevname(dev_t dev);
 
 extern int mnt_procfs;
diff --git a/usr/kinit/resume.c b/usr/kinit/resume.c
index 12963ca..952af96 100644
--- a/usr/kinit/resume.c
+++ b/usr/kinit/resume.c
@@ -16,6 +16,7 @@ #include <linux/config.h>	/* For CONFIG_
 
 #include "kinit.h"
 #include "do_mounts.h"
+#include "resume.h"
 
 #ifndef CONFIG_PM_STD_PARTITION
 # define CONFIG_PM_STD_PARTITION ""
@@ -25,10 +26,6 @@ int do_resume(int argc, char *argv[])
 {
 	const char *resume_file = CONFIG_PM_STD_PARTITION;
 	const char *resume_arg;
-	dev_t resume_device;
-	int powerfd = -1;
-	char device_string[64];
-	int len;
 
 	resume_arg = get_arg(argc, argv, "resume=");
 	resume_file = resume_arg ? resume_arg : resume_file;
@@ -41,6 +38,15 @@ int do_resume(int argc, char *argv[])
 	/* Noresume requested */
 	if (get_flag(argc, argv, "noresume"))
 		return 0;
+	return	resume(resume_file);
+}
+
+int resume(const char *resume_file)
+{
+	char device_string[64];
+	int powerfd = -1;
+	dev_t resume_device;
+	int len;
 
 	resume_device = name_to_dev_t(resume_file);

diff --git a/usr/kinit/resume.h b/usr/kinit/resume.h
new file mode 100644
index 0000000..04b8df8
--- /dev/null
+++ b/usr/kinit/resume.h
@@ -0,0 +1,7 @@
+#ifndef RESUME_H
+#define RESUME_H
+
+int do_resume(int argc, char *argv[]);
+int resume(const char *resume_file);
+
+#endif /* RESUME_H */

 
-- 
maks



More information about the klibc mailing list