diff -rU3 suspend-utils.orig/dmidecode.c suspend-utils-v1/dmidecode.c --- suspend-utils.orig/dmidecode.c 2010-01-29 10:41:17.000000000 +0100 +++ suspend-utils-v1/dmidecode.c 2010-01-29 13:55:37.000000000 +0100 @@ -11,6 +11,8 @@ * Licensed under the GNU General Public license v2. */ +#ifdef KERNEL_VER_OLD + #include "config.h" #include #include @@ -205,3 +207,5 @@ dmi_scan(); } #endif + +#endif /* KERNEL_VER_OLD */ diff -rU3 suspend-utils.orig/Makefile.am suspend-utils-v1/Makefile.am --- suspend-utils.orig/Makefile.am 2010-01-29 10:41:17.000000000 +0100 +++ suspend-utils-v1/Makefile.am 2010-01-29 13:48:01.000000000 +0100 @@ -67,6 +67,7 @@ AM_CFLAGS=\ -DS2RAM \ + -DKERNEL_VER_NEW \ -D_LARGEFILE64_SOURCE \ $(LZO_CFLAGS) \ $(LIBGCRYPT_CFLAGS) diff -rU3 suspend-utils.orig/s2ram.c suspend-utils-v1/s2ram.c --- suspend-utils.orig/s2ram.c 2010-01-29 10:41:17.000000000 +0100 +++ suspend-utils-v1/s2ram.c 2010-01-29 14:06:32.000000000 +0100 @@ -16,7 +16,11 @@ #define S2RAM #endif #include "vt.h" + +#ifdef KERNEL_VER_OLD #include "s2ram.h" +#endif + #include "config_parser.h" diff -rU3 suspend-utils.orig/s2ram-main.c suspend-utils-v1/s2ram-main.c --- suspend-utils.orig/s2ram-main.c 2010-01-29 10:41:17.000000000 +0100 +++ suspend-utils-v1/s2ram-main.c 2010-01-29 14:08:14.000000000 +0100 @@ -17,10 +17,13 @@ #define S2RAM #endif #include "vt.h" -#include "whitelist.h" -#include "s2ram.h" #include "config_parser.h" +#ifdef KERNEL_VER_OLD +#include "s2ram.h" +#include "whitelist.h" +#endif + int main(int argc, char *argv[]) { int i, ret = 0; @@ -34,6 +37,7 @@ "version\0\t\t\tversion information", no_argument, NULL, 'V' }, +#ifdef KERNEL_VER_OLD { "test\0\ttest if the machine is in the database.", no_argument, NULL, 'n' @@ -43,9 +47,14 @@ no_argument, NULL, 'i' }, HACKS_LONG_OPTS +#endif /* KERNEL_VER_OLD */ { NULL, 0, NULL, 0 } }; +#ifdef KERNEL_VER_OLD const char *optstring = "hVni" "fspmrva:"; +#else + const char *optstring = "hV"; +#endif /* KERNEL_VER_OLD */ while ((i = getopt_long(argc, argv, optstring, options, NULL)) != -1) { switch (i) { @@ -53,8 +62,13 @@ usage("s2ram", options, optstring); exit(0); case 'V': +#ifdef KERNEL_VER_OLD version("s2ram", whitelist_version); +#else + version("s2ram", ""); +#endif exit(EXIT_SUCCESS); +#ifdef KERNEL_VER_OLD case 'i': identify_machine(); exit(0); @@ -67,10 +81,14 @@ break; default: s2ram_add_flag(i,optarg); +#else + default: +#endif /* KERNEL_VER_OLD */ break; } } +#ifdef KERNEL_VER_OLD ret = s2ram_is_supported(); if (ret == S2RAM_UNKNOWN) { @@ -84,6 +102,7 @@ if (ret) goto out; +#endif /* KERNEL_VER_OLD */ /* switch to console 1 first, since we might be in X */ active_console = fgconsole(); @@ -93,12 +112,17 @@ else printf("failed\n"); - +#ifdef KERNEL_VER_OLD ret = s2ram_hacks(); if (ret) goto out; + ret = s2ram_do(); s2ram_resume(); +#else /* KERNEL_VER_OLD */ + + ret = s2ram_generic_do(); +#endif /* KERNEL_VER_OLD */ out: /* if we switched consoles before suspend, switch back */ diff -rU3 suspend-utils.orig/s2ram-ppc.c suspend-utils-v1/s2ram-ppc.c --- suspend-utils.orig/s2ram-ppc.c 2010-01-29 10:41:17.000000000 +0100 +++ suspend-utils-v1/s2ram-ppc.c 2010-01-29 13:48:01.000000000 +0100 @@ -3,8 +3,10 @@ * * Copyright 2006 Tim Dijkstra * Copyright 2006 Luca Tettamanti + * Copyright 2010 Rafael, kix * Distribute under GPLv2. */ +#ifdef KERNEL_VER_OLD #include "config.h" #include @@ -109,3 +111,5 @@ return s2ram_generic_do(); } + +#endif /* KERNEL_VER_OLD */ diff -rU3 suspend-utils.orig/s2ram-x86.c suspend-utils-v1/s2ram-x86.c --- suspend-utils.orig/s2ram-x86.c 2010-01-29 10:41:17.000000000 +0100 +++ suspend-utils-v1/s2ram-x86.c 2010-01-29 13:48:01.000000000 +0100 @@ -3,9 +3,12 @@ * * Copyright 2006 Pavel Machek * 2007 Stefan, Rafael, Tim, Luca + * 2010 Rafael, kix * Distribute under GPLv2. */ +#ifdef KERNEL_VER_OLD + #include "config.h" #include #include @@ -394,3 +397,5 @@ break; } } + +#endif /* KERNEL_VER_OLD */ diff -rU3 suspend-utils.orig/suspend.c suspend-utils-v1/suspend.c --- suspend-utils.orig/suspend.c 2010-01-29 10:41:17.000000000 +0100 +++ suspend-utils-v1/suspend.c 2010-01-29 14:15:11.000000000 +0100 @@ -46,9 +46,12 @@ #include "splash.h" #include "vt.h" #include "loglevel.h" + #ifdef CONFIG_BOTH +#ifdef KERNEL_VER_OLD #include "s2ram.h" #endif +#endif static char test_file_name[MAX_STR_LEN] = ""; static loff_t test_image_size; @@ -1774,7 +1777,11 @@ reset_signature(resume_fd); free_swap_pages(snapshot_fd); free_snapshot(snapshot_fd); +#ifdef KERNEL_VER_OLD s2ram_resume(); +#else + s2ram_generic_do(); +#endif goto Unfreeze; } Shutdown: @@ -2165,8 +2172,10 @@ required_argument, NULL, 'P' }, #ifdef CONFIG_BOTH +#ifdef KERNEL_VER_OLD HACKS_LONG_OPTS #endif +#endif { NULL, 0, NULL, 0 } }; int i, error; @@ -2230,7 +2239,9 @@ break; default: #ifdef CONFIG_BOTH +#ifdef KERNEL_VER_OLD s2ram_add_flag(i, optarg); +#endif break; #else usage(my_name, options, optstring); @@ -2243,6 +2254,7 @@ strncpy(resume_dev_name, argv[optind], MAX_STR_LEN - 1); #ifdef CONFIG_BOTH +#ifdef KERNEL_VER_OLD s2ram = s2ram_is_supported(); /* s2ram_is_supported returns EINVAL if there was something wrong * with the options that where added with s2ram_add_flag. @@ -2252,6 +2264,9 @@ return -EINVAL; s2ram = !s2ram; +#else /* KERNEL_VER_OLD */ + s2ram = 0; +#endif /* KERNEL_VER_OLD */ #endif return 0; @@ -2496,10 +2511,12 @@ splash.progress(5); #ifdef CONFIG_BOTH +#ifdef KERNEL_VER_OLD /* If s2ram_hacks returns != 0, better not try to suspend to RAM */ if (s2ram) s2ram = !s2ram_hacks(); #endif +#endif #ifdef CONFIG_ENCRYPT if (do_encrypt && ! use_RSA) splash.read_password(password, 1);