Skip to contentSkip to conversation

dm: add uevent to core

PATCH New Alasdair G Kergon 1 participant 1 message Oct 17, 2007

Subsystems (2)
lore
Share & tools
lore

Alasdair G Kergon

author maintainer
#0 lore raw

PATCH 2/4 dm: add uevent to core

From: Mike Anderson <[email protected]>

This patch adds a uevent skeleton to device-mapper.

---

 drivers/md/Kconfig     |    6 ++++
 drivers/md/Makefile    |    4 ++
 drivers/md/dm-uevent.c |   72 +++++++++++++++++++++++++++++++++++++++++++++++++
 drivers/md/dm-uevent.h |   41 +++++++++++++++++++++++++++
 drivers/md/dm.c        |   10 ++++++
 5 files changed, 133 insertions(+)
drivers/md/Kconfig +6 -0
Index: linux-2.6.23/drivers/md/Kconfig
===================================================================
@@ -282,4 +282,10 @@ config DM_DELAY
 
 	If unsure, say N.
 
+config DM_UEVENT
+	bool "DM uevents (EXPERIMENTAL)"
+	depends on BLK_DEV_DM && EXPERIMENTAL
+	---help---
+	Generate udev events for DM events.
+
 endif # MD
drivers/md/Makefile +4 -0
Index: linux-2.6.23/drivers/md/Makefile
===================================================================
@@ -50,6 +50,10 @@ ifeq ($(CONFIG_ALTIVEC),y)
 altivec_flags := -maltivec -mabi=altivec
 endif
 
+ifeq ($(CONFIG_DM_UEVENT),y)
+dm-mod-objs			+= dm-uevent.o
+endif
+
 targets += raid6int1.c
 $(obj)/raid6int1.c:   UNROLL := 1
 $(obj)/raid6int1.c:   $(src)/raid6int.uc $(src)/unroll.pl FORCE
drivers/md/dm-uevent.c new file +72 -0

72 lines not on this page · raw message

drivers/md/dm-uevent.h new file +41 -0

41 lines not on this page · raw message

drivers/md/dm.c +10 -0
Index: linux-2.6.23/drivers/md/dm.c
===================================================================
@@ -7,6 +7,7 @@
 
 #include "dm.h"
 #include "dm-bio-list.h"
+#include "dm-uevent.h"
 
 #include <linux/init.h>
 #include <linux/module.h>
@@ -143,11 +144,19 @@ static int __init local_init(void)
 		return -ENOMEM;
 	}
 
+	r = dm_uevent_init();
+	if (r) {
+		kmem_cache_destroy(_tio_cache);
+		kmem_cache_destroy(_io_cache);
+		return r;
+	}
+
 	_major = major;
 	r = register_blkdev(_major, _name);
 	if (r < 0) {
 		kmem_cache_destroy(_tio_cache);
 		kmem_cache_destroy(_io_cache);
+		dm_uevent_exit();
 		return r;
 	}
 
@@ -162,6 +171,7 @@ static void local_exit(void)
 	kmem_cache_destroy(_tio_cache);
 	kmem_cache_destroy(_io_cache);
 	unregister_blkdev(_major, _name);
+	dm_uevent_exit();
 
 	_major = 0;