Signed-off-by: Chen Hanxiao <chenhanxiao(a)cn.fujitsu.com>
---
daemon/daemon.h | 1 +
daemon/ext2.c | 15 +++++++++++++++
2 files changed, 16 insertions(+)
diff --git a/daemon/daemon.h b/daemon/daemon.h
index 5087327..9c8476c 100644
--- a/daemon/daemon.h
+++ b/daemon/daemon.h
@@ -219,6 +219,7 @@ extern int sync_disks (void);
/* Confirmed this is true up to ext4 from the Linux sources. */
#define EXT2_LABEL_MAX 16
extern int fstype_is_extfs (const char *fstype);
+extern int set_e2uuid_random (const char *device);
/*-- in blkid.c --*/
extern char *get_blkid_tag (const char *device, const char *tag);
diff --git a/daemon/ext2.c b/daemon/ext2.c
index 8ef6d5f..625e5ae 100644
--- a/daemon/ext2.c
+++ b/daemon/ext2.c
@@ -159,6 +159,21 @@ do_set_e2uuid (const char *device, const char *uuid)
return 0;
}
+int
+set_e2uuid_random (const char *device)
+{
+ int r;
+ CLEANUP_FREE char *err = NULL;
+
+ r = command (NULL, &err, str_tune2fs, "-U", "random", device,
NULL);
+ if (r == -1) {
+ reply_with_error ("%s", err);
+ return -1;
+ }
+
+ return 0;
+}
+
char *
do_get_e2uuid (const char *device)
{
--
2.1.0