1The device-mapper uevent code adds the capability to device-mapper to create
2and send kobject uevents (uevents).  Previously device-mapper events were only
3available through the ioctl interface.  The advantage of the uevents interface
4is the event contains environment attributes providing increased context for
5the event avoiding the need to query the state of the device-mapper device after
6the event is received.
7
8There are two functions currently for device-mapper events.  The first function
9listed creates the event and the second function sends the event(s).
10
11void dm_path_uevent(enum dm_uevent_type event_type, struct dm_target *ti,
12                    const char *path, unsigned nr_valid_paths)
13
14void dm_send_uevents(struct list_head *events, struct kobject *kobj)
15
16
17The variables added to the uevent environment are:
18
19Variable Name: DM_TARGET
20Uevent Action(s): KOBJ_CHANGE
21Type: string
22Description:
23Value: Name of device-mapper target that generated the event.
24
25Variable Name: DM_ACTION
26Uevent Action(s): KOBJ_CHANGE
27Type: string
28Description:
29Value: Device-mapper specific action that caused the uevent action.
30	PATH_FAILED - A path has failed.
31	PATH_REINSTATED - A path has been reinstated.
32
33Variable Name: DM_SEQNUM
34Uevent Action(s): KOBJ_CHANGE
35Type: unsigned integer
36Description: A sequence number for this specific device-mapper device.
37Value: Valid unsigned integer range.
38
39Variable Name: DM_PATH
40Uevent Action(s): KOBJ_CHANGE
41Type: string
42Description: Major and minor number of the path device pertaining to this
43event.
44Value: Path name in the form of "Major:Minor"
45
46Variable Name: DM_NR_VALID_PATHS
47Uevent Action(s): KOBJ_CHANGE
48Type: unsigned integer
49Description:
50Value: Valid unsigned integer range.
51
52Variable Name: DM_NAME
53Uevent Action(s): KOBJ_CHANGE
54Type: string
55Description: Name of the device-mapper device.
56Value: Name
57
58Variable Name: DM_UUID
59Uevent Action(s): KOBJ_CHANGE
60Type: string
61Description: UUID of the device-mapper device.
62Value: UUID. (Empty string if there isn't one.)
63
64An example of the uevents generated as captured by udevmonitor is shown
65below.
66
671.) Path failure.
68UEVENT[1192521009.711215] change@/block/dm-3
69ACTION=change
70DEVPATH=/block/dm-3
71SUBSYSTEM=block
72DM_TARGET=multipath
73DM_ACTION=PATH_FAILED
74DM_SEQNUM=1
75DM_PATH=8:32
76DM_NR_VALID_PATHS=0
77DM_NAME=mpath2
78DM_UUID=mpath-35333333000002328
79MINOR=3
80MAJOR=253
81SEQNUM=1130
82
832.) Path reinstate.
84UEVENT[1192521132.989927] change@/block/dm-3
85ACTION=change
86DEVPATH=/block/dm-3
87SUBSYSTEM=block
88DM_TARGET=multipath
89DM_ACTION=PATH_REINSTATED
90DM_SEQNUM=2
91DM_PATH=8:32
92DM_NR_VALID_PATHS=1
93DM_NAME=mpath2
94DM_UUID=mpath-35333333000002328
95MINOR=3
96MAJOR=253
97SEQNUM=1131
98