dmraid/dmraid-add_uuid.patch

46 lines
1.4 KiB
Diff

Index: 1.0.0.rc13/lib/activate/devmapper.c
===================================================================
--- 1.0.0.rc13.orig/lib/activate/devmapper.c
+++ 1.0.0.rc13/lib/activate/devmapper.c
@@ -153,9 +153,17 @@ static int run_task(struct lib_context *
{
int ret;
struct dm_task *dmt;
+ char *uuid;
+
+ /* Generate UUID */
+ uuid = malloc(strlen(rs->name) + UUID_PREFIX_LEN + 1);
+ if (!uuid) return 0;
+
+ sprintf(uuid, UUID_PREFIX "%s", rs->name);
_init_dm();
- ret = (dmt = dm_task_create(type)) && dm_task_set_name(dmt, rs->name);
+ ret = (dmt = dm_task_create(type)) && dm_task_set_name(dmt, rs->name) &&
+ dm_task_set_uuid(dmt, uuid);
if (ret && table)
ret = parse_table(lc, dmt, table);
@@ -163,6 +171,7 @@ static int run_task(struct lib_context *
ret = dm_task_run(dmt);
_exit_dm(dmt);
+ free(uuid);
return ret;
}
/* Create a mapped device. */
Index: 1.0.0.rc13/lib/activate/devmapper.h
===================================================================
--- 1.0.0.rc13.orig/lib/activate/devmapper.h
+++ 1.0.0.rc13/lib/activate/devmapper.h
@@ -8,6 +8,9 @@
#ifndef _DEVMAPPER_H_
#define _DEVMAPPER_H
+#define UUID_PREFIX "dmraid-"
+#define UUID_PREFIX_LEN 7
+
char *mkdm_path(struct lib_context *lc, const char *name);
int dm_create(struct lib_context *lc, struct raid_set *rs, char *table);
int dm_remove(struct lib_context *lc, struct raid_set *rs);