Package: klibc-utils
Version: 1.4.30-1
Severity: normal
Tags: patch

Hi,

the attached patch adds swsusp, suspend2 and uswsusp image detection to fstype.

Signed-off-by: David Härdeman <[EMAIL PROTECTED]>

--
fstype.c  |   15 +++++++++++++++
swap_fs.h |    7 +++++++
2 files changed, 22 insertions(+)

diff -ur ./klibc-1.4.30.orig/usr/kinit/fstype/fstype.c 
./klibc-1.4.30/usr/kinit/fstype/fstype.c
--- ./klibc-1.4.30.orig/usr/kinit/fstype/fstype.c       2006-10-31 
23:28:12.000000000 +0100
+++ ./klibc-1.4.30/usr/kinit/fstype/fstype.c    2006-11-12 23:57:42.000000000 
+0100
@@ -202,6 +202,20 @@
        return 0;
 }
 
+static int suspend_image(const void *buf, unsigned long long *blocks)
+{
+       const struct swap_super_block *ssb =
+           (const struct swap_super_block *)buf;
+
+       if (!memcmp(ssb->magic, SUSP_MAGIC_1, SUSP_MAGIC_L) ||
+           !memcmp(ssb->magic, SUSP_MAGIC_2, SUSP_MAGIC_L) ||
+           !memcmp(ssb->magic, SUSP_MAGIC_U, SUSP_MAGIC_L)) {
+               *blocks = 0;
+               return 1;
+       }
+       return 0;
+}
+
 static int lvm2_image(const void *buf, unsigned long long *blocks)
 {
        const struct lvm2_super_block *lsb;
@@ -271,6 +285,7 @@
        {0, "lvm2", lvm2_image},
        {1, "lvm2", lvm2_image},
        {-1, "swap", swap_image},
+       {-1, "suspend", suspend_image},
        {0, "", NULL}
 };
 
diff -ur ./klibc-1.4.30.orig/usr/kinit/fstype/swap_fs.h 
./klibc-1.4.30/usr/kinit/fstype/swap_fs.h
--- ./klibc-1.4.30.orig/usr/kinit/fstype/swap_fs.h      2006-10-31 
23:28:12.000000000 +0100
+++ ./klibc-1.4.30/usr/kinit/fstype/swap_fs.h   2006-11-12 23:54:23.000000000 
+0100
@@ -6,6 +6,13 @@
 #define SWAP_RESERVED_L                (1024 - SWAP_MAGIC_L)
 #define SWAP_MAGIC_1           "SWAP-SPACE"
 #define SWAP_MAGIC_2           "SWAPSPACE2"
+
+/* Suspend signatures, located at same addr as swap magic */
+#define SUSP_MAGIC_L           9
+#define SUSP_MAGIC_1           "S1SUSPEND"
+#define SUSP_MAGIC_2           "S2SUSPEND"
+#define SUSP_MAGIC_U           "ULSUSPEND"
+
 /* The superblock is the last block in the first page */
 #define SWAP_OFFSET()          ((getpagesize() - 1024) >> 10)
 

Reply via email to