aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md/dm-uevent.c
diff options
context:
space:
mode:
authorMike Anderson <andmike@linux.vnet.ibm.com>2007-10-19 17:48:00 -0400
committerAlasdair G Kergon <agk@redhat.com>2007-10-19 21:01:24 -0400
commit51e5b2bd34ded40ef48cade8a6a8f1baa0b4275e (patch)
tree7c1650dcd2f53bed2c0b8c9538e8da2d2d1286c2 /drivers/md/dm-uevent.c
parent96a1f7dba6e464155c0d1dc69c6c2efa96b644ac (diff)
dm: add uevent to core
This patch adds a uevent skeleton to device-mapper. Signed-off-by: Mike Anderson <andmike@linux.vnet.ibm.com> Signed-off-by: Alasdair G Kergon <agk@redhat.com>
Diffstat (limited to 'drivers/md/dm-uevent.c')
-rw-r--r--drivers/md/dm-uevent.c72
1 files changed, 72 insertions, 0 deletions
diff --git a/drivers/md/dm-uevent.c b/drivers/md/dm-uevent.c
new file mode 100644
index 00000000000..53200c96bcb
--- /dev/null
+++ b/drivers/md/dm-uevent.c
@@ -0,0 +1,72 @@
1/*
2 * Device Mapper Uevent Support (dm-uevent)
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the
6 * Free Software Foundation; either version 2 of the License, or (at your
7 * option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 *
18 * Copyright IBM Corporation, 2007
19 * Author: Mike Anderson <andmike@linux.vnet.ibm.com>
20 */
21#include <linux/list.h>
22#include <linux/slab.h>
23#include <linux/kobject.h>
24
25#include "dm.h"
26#include "dm-uevent.h"
27
28#define DM_MSG_PREFIX "uevent"
29
30static struct kmem_cache *_dm_event_cache;
31
32struct dm_uevent {
33 struct mapped_device *md;
34 enum kobject_action action;
35 struct kobj_uevent_env ku_env;
36 struct list_head elist;
37};
38
39static void dm_uevent_free(struct dm_uevent *event)
40{
41 kmem_cache_free(_dm_event_cache, event);
42}
43
44static struct dm_uevent *dm_uevent_alloc(struct mapped_device *md)
45{
46 struct dm_uevent *event;
47
48 event = kmem_cache_zalloc(_dm_event_cache, GFP_ATOMIC);
49 if (!event)
50 return NULL;
51
52 INIT_LIST_HEAD(&event->elist);
53 event->md = md;
54
55 return event;
56}
57
58int dm_uevent_init(void)
59{
60 _dm_event_cache = KMEM_CACHE(dm_uevent, 0);
61 if (!_dm_event_cache)
62 return -ENOMEM;
63
64 DMINFO("version 1.0.3");
65
66 return 0;
67}
68
69void dm_uevent_exit(void)
70{
71 kmem_cache_destroy(_dm_event_cache);
72}