@@ -69,11 +69,13 @@ AM_CFLAGS=\
-DS2RAM \
-D_LARGEFILE64_SOURCE \
$(LZO_CFLAGS) \
+ $(LIBBLKID_LIBS_CFLAGS) \
$(LIBGCRYPT_CFLAGS)
common_s2disk_libs=\
$(LZO_LIBS) \
$(LIBGCRYPT_LIBS) \
+ $(LIBBLKID_LIBS) \
$(PTHREAD_LIBS)
common_s2ram_libs=
@@ -188,6 +188,17 @@ else
AC_MSG_ERROR([Unsupported architecture ${host}])
fi
+if test -z "${LIBBLKID_LIBS}"; then
+ AC_ARG_VAR([LIBBLKID_CFLAGS], [C compiler flags for libblkid])
+ AC_ARG_VAR([LIBBLKID_LIBS], [linker flags for libblkid])
+ AC_CHECK_LIB(
+ [blkid],
+ [blkid_new_probe],
+ [LIBBLKID_LIBS="-lblkid"],
+ [AC_MSG_ERROR([Required libblkid was not found])]
+ )
+fi
+
if test "${enable_compress}" = "yes"; then
CONFIG_FEATURES="${CONFIG_FEATURES} compress"
AC_DEFINE([CONFIG_COMPRESS], [1], [Define if compression enabled])
@@ -38,6 +38,7 @@
#ifdef CONFIG_COMPRESS
#include <lzo/lzo1x.h>
#endif
+#include <blkid/blkid.h>
#include "swsusp.h"
#include "memalloc.h"
@@ -229,6 +230,8 @@ static struct config_par parameters[] = {
}
};
+static char *fsprobe_get_devname_by_uuid(const char *uuid);
+
static loff_t check_free_swap(int dev)
{
int error;
@@ -2414,6 +2417,21 @@ int main(int argc, char *argv[])
}
ret = 0;
+
+ /* If device is UUID, convert it to dev file */
+ if (!strncmp(resume_dev_name, "UUID=", 5)) {
+ char *tmpdev = NULL;
+
+ tmpdev = (char *) fsprobe_get_devname_by_uuid(resume_dev_name);
+ if (!tmpdev) {
+ ret = ENODEV;
+ goto Umount;
+ }
+
+ snprintf(resume_dev_name, MAX_STR_LEN -1, "%s", tmpdev);
+ free(tmpdev);
+ }
+
if (stat(resume_dev_name, &stat_buf)) {
suspend_error("Could not stat the resume device file.");
ret = ENODEV;
@@ -2561,3 +2579,17 @@ Umount:
return ret;
}
+
+static char *fsprobe_get_devname_by_uuid(const char *uuid)
+{
+ char *tmp_uuid = NULL, *ptr = NULL, *ret = NULL;
+
+ tmp_uuid = strdup(uuid);
+ ptr = strtok(tmp_uuid, "="); /* string UUID */
+ ptr = strtok(NULL, "="); /* UUID value */
+
+ if (ptr)
+ ret = blkid_evaluate_tag("UUID", ptr, NULL);
+
+ return ret;
+}