[PATCH] Add uuid to dmraid tables

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Heinz,

by convention most programs add a UUID to the device-mapper table
they/ve created. This allows of the intended usage of the table.

This patch adds the generation of UUIDs to dmraid. Tables UUIDs are
prefixed with 'dmraid-'.

Cheers,

Hannes
-- 
Dr. Hannes Reinecke			hare@xxxxxxx
SuSE Linux Products GmbH		S390 & zSeries
Maxfeldstraße 5				+49 911 74053 688
90409 Nürnberg				http://www.suse.de
diff -pur 1.0.0.rc11.orig/lib/activate/devmapper.c 1.0.0.rc11/lib/activate/devmapper.c
--- 1.0.0.rc11.orig/lib/activate/devmapper.c	2006-03-29 15:18:43.000000000 +0200
+++ 1.0.0.rc11/lib/activate/devmapper.c	2006-08-28 12:55:32.000000000 +0200
@@ -153,12 +153,20 @@ int dm_create(struct lib_context *lc, st
 {
 	int ret = 0;
 	struct dm_task *dmt;
+	char *uuid;
+
+	/* Generate UUID */
+	uuid = malloc(strlen(rs->name) + UUID_PREFIX_LEN + 1);
+	if (!uuid) return 1;
+
+	sprintf(uuid,UUID_PREFIX "%s",rs->name);
 
 	_init_dm();
 
 	/* Create <dev_name> */
 	ret = (dmt = dm_task_create(DM_DEVICE_CREATE)) &&
 	       dm_task_set_name(dmt, rs->name) &&
+	       dm_task_set_uuid(dmt, uuid) &&
 	       parse_table(lc, dmt, table) &&
 	       dm_task_run(dmt);
 
@@ -171,6 +179,8 @@ int dm_create(struct lib_context *lc, st
 
 	_exit_dm(dmt);
 
+	free(uuid);
+
 	return ret;
 }
 
diff -pur 1.0.0.rc11.orig/lib/activate/devmapper.h 1.0.0.rc11/lib/activate/devmapper.h
--- 1.0.0.rc11.orig/lib/activate/devmapper.h	2005-05-23 14:39:55.000000000 +0200
+++ 1.0.0.rc11/lib/activate/devmapper.h	2006-08-28 12:55:01.000000000 +0200
@@ -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);
_______________________________________________
Ataraid-list mailing list
Ataraid-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/ataraid-list

[Index of Archives]     [Linux RAID]     [Linux Device Mapper]     [Linux IDE]     [Linux SCSI]     [Kernel]     [Linux Books]     [Linux Admin]     [GFS]     [RPM]     [Yosemite Campgrounds]     [AMD 64]

  Powered by Linux