xref: /freebsd-src/sys/contrib/openzfs/include/sys/sysevent/dev.h (revision c7046f76c2c027b00c0e6ba57cfd28f1a78f5e23)
1eda14cbcSMatt Macy /*
2eda14cbcSMatt Macy  * CDDL HEADER START
3eda14cbcSMatt Macy  *
4eda14cbcSMatt Macy  * The contents of this file are subject to the terms of the
5eda14cbcSMatt Macy  * Common Development and Distribution License (the "License").
6eda14cbcSMatt Macy  * You may not use this file except in compliance with the License.
7eda14cbcSMatt Macy  *
8eda14cbcSMatt Macy  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9271171e0SMartin Matuska  * or https://opensource.org/licenses/CDDL-1.0.
10eda14cbcSMatt Macy  * See the License for the specific language governing permissions
11eda14cbcSMatt Macy  * and limitations under the License.
12eda14cbcSMatt Macy  *
13eda14cbcSMatt Macy  * When distributing Covered Code, include this CDDL HEADER in each
14eda14cbcSMatt Macy  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15eda14cbcSMatt Macy  * If applicable, add the following below this CDDL HEADER, with the
16eda14cbcSMatt Macy  * fields enclosed by brackets "[]" replaced with your own identifying
17eda14cbcSMatt Macy  * information: Portions Copyright [yyyy] [name of copyright owner]
18eda14cbcSMatt Macy  *
19eda14cbcSMatt Macy  * CDDL HEADER END
20eda14cbcSMatt Macy  */
21eda14cbcSMatt Macy /*
22eda14cbcSMatt Macy  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
23eda14cbcSMatt Macy  * Use is subject to license terms.
24eda14cbcSMatt Macy  */
25eda14cbcSMatt Macy 
26eda14cbcSMatt Macy #ifndef	_SYS_SYSEVENT_DEV_H
27eda14cbcSMatt Macy #define	_SYS_SYSEVENT_DEV_H
28eda14cbcSMatt Macy 
29eda14cbcSMatt Macy #include <sys/sysevent/eventdefs.h>
30eda14cbcSMatt Macy 
31eda14cbcSMatt Macy #ifdef	__cplusplus
32eda14cbcSMatt Macy extern "C" {
33eda14cbcSMatt Macy #endif
34eda14cbcSMatt Macy 
35eda14cbcSMatt Macy /*
36eda14cbcSMatt Macy  * Event schema for EC_DEV_ADD/ESC_DISK
37eda14cbcSMatt Macy  *
38eda14cbcSMatt Macy  *	Event Class 	- EC_DEV_ADD
39eda14cbcSMatt Macy  *	Event Sub-Class - ESC_DISK
40eda14cbcSMatt Macy  *
41eda14cbcSMatt Macy  *	Attribute Name	- EV_VERSION
42eda14cbcSMatt Macy  *	Attribute Type	- DATA_TYPE_INT32
43eda14cbcSMatt Macy  *	Attribute Value	- event version number
44eda14cbcSMatt Macy  *
45eda14cbcSMatt Macy  *	Attribute Name	- DEV_NAME
46eda14cbcSMatt Macy  *	Attribute Type	- DATA_TYPE_STRING
47eda14cbcSMatt Macy  *	Attribute Value	- /dev name to the raw device.
48eda14cbcSMatt Macy  *			  The name does not include the slice number component.
49eda14cbcSMatt Macy  *
50eda14cbcSMatt Macy  *	Attribute Name	- DEV_PHYS_PATH
51eda14cbcSMatt Macy  *	Attribute Type	- DATA_TYPE_STRING
52eda14cbcSMatt Macy  *	Attribute Value	- physical path of the device without the "/devices"
53eda14cbcSMatt Macy  *			  prefix.
54eda14cbcSMatt Macy  *
55eda14cbcSMatt Macy  *	Attribute Name	- DEV_DRIVER_NAME
56eda14cbcSMatt Macy  *	Attribute Type	- DATA_TYPE_STRING
57eda14cbcSMatt Macy  *	Attribute Value	- driver name
58eda14cbcSMatt Macy  *
59eda14cbcSMatt Macy  *	Attribute Name	- DEV_INSTANCE
60eda14cbcSMatt Macy  *	Attribute Type	- DATA_TYPE_INT32
61eda14cbcSMatt Macy  *	Attribute Value	- driver instance number
62eda14cbcSMatt Macy  *
63eda14cbcSMatt Macy  *	Attribute Name	- DEV_PROP_PREFIX<devinfo_node_property>
64eda14cbcSMatt Macy  *	Attribute Type	- data type of the devinfo_node_property
65eda14cbcSMatt Macy  *	Attribute Value	- value of the devinfo_node_property
66eda14cbcSMatt Macy  *
67eda14cbcSMatt Macy  *
68eda14cbcSMatt Macy  * Event schema for EC_DEV_ADD/ESC_NETWORK
69eda14cbcSMatt Macy  *
70eda14cbcSMatt Macy  *	Event Class 	- EC_DEV_ADD
71eda14cbcSMatt Macy  *	Event Sub-Class - ESC_NETWORK
72eda14cbcSMatt Macy  *
73eda14cbcSMatt Macy  *	Attribute Name	- EV_VERSION
74eda14cbcSMatt Macy  *	Attribute Type	- DATA_TYPE_INT32
75eda14cbcSMatt Macy  *	Attribute Value	- event version number
76eda14cbcSMatt Macy  *
77eda14cbcSMatt Macy  *	Attribute Name	- DEV_NAME
78eda14cbcSMatt Macy  *	Attribute Type	- DATA_TYPE_STRING
79eda14cbcSMatt Macy  *	Attribute Value	- /dev name associated with the device if exists.
80eda14cbcSMatt Macy  *			  /dev name associated with the driver for DLPI
81eda14cbcSMatt Macy  *			  Style-2 only drivers.
82eda14cbcSMatt Macy  *
83eda14cbcSMatt Macy  *	Attribute Name	- DEV_PHYS_PATH
84eda14cbcSMatt Macy  *	Attribute Type	- DATA_TYPE_STRING
85eda14cbcSMatt Macy  *	Attribute Value	- physical path of the device without the "/devices"
86eda14cbcSMatt Macy  *			  prefix.
87eda14cbcSMatt Macy  *
88eda14cbcSMatt Macy  *	Attribute Name	- DEV_DRIVER_NAME
89eda14cbcSMatt Macy  *	Attribute Type	- DATA_TYPE_STRING
90eda14cbcSMatt Macy  *	Attribute Value	- driver name
91eda14cbcSMatt Macy  *
92eda14cbcSMatt Macy  *	Attribute Name	- DEV_INSTANCE
93eda14cbcSMatt Macy  *	Attribute Type	- DATA_TYPE_INT32
94eda14cbcSMatt Macy  *	Attribute Value	- driver instance number
95eda14cbcSMatt Macy  *
96eda14cbcSMatt Macy  *	Attribute Name	- DEV_PROP_PREFIX<devinfo_node_property>
97eda14cbcSMatt Macy  *	Attribute Type	- data type of the devinfo_node_property
98eda14cbcSMatt Macy  *	Attribute Value	- value of the devinfo_node_property
99eda14cbcSMatt Macy  *
100eda14cbcSMatt Macy  *
101eda14cbcSMatt Macy  * Event schema for EC_DEV_ADD/ESC_PRINTER
102eda14cbcSMatt Macy  *
103eda14cbcSMatt Macy  *	Event Class 	- EC_DEV_ADD
104eda14cbcSMatt Macy  *	Event Sub-Class - ESC_PRINTER
105eda14cbcSMatt Macy  *
106eda14cbcSMatt Macy  *	Attribute Name	- EV_VERSION
107eda14cbcSMatt Macy  *	Attribute Type	- DATA_TYPE_INT32
108eda14cbcSMatt Macy  *	Attribute Value	- event version number
109eda14cbcSMatt Macy  *
110eda14cbcSMatt Macy  *	Attribute Name	- DEV_NAME
111eda14cbcSMatt Macy  *	Attribute Type	- DATA_TYPE_STRING
112eda14cbcSMatt Macy  *	Attribute Value	- /dev/printers name associated with the device
113eda14cbcSMatt Macy  *			  if exists.
114eda14cbcSMatt Macy  *			  /dev name associated with the device if it exists
115eda14cbcSMatt Macy  *
116eda14cbcSMatt Macy  *	Attribute Name	- DEV_PHYS_PATH
117eda14cbcSMatt Macy  *	Attribute Type	- DATA_TYPE_STRING
118eda14cbcSMatt Macy  *	Attribute Value	- physical path of the device without the "/devices"
119eda14cbcSMatt Macy  *			  prefix.
120eda14cbcSMatt Macy  *
121eda14cbcSMatt Macy  *	Attribute Name	- DEV_DRIVER_NAME
122eda14cbcSMatt Macy  *	Attribute Type	- DATA_TYPE_STRING
123eda14cbcSMatt Macy  *	Attribute Value	- driver name
124eda14cbcSMatt Macy  *
125eda14cbcSMatt Macy  *	Attribute Name	- DEV_INSTANCE
126eda14cbcSMatt Macy  *	Attribute Type	- DATA_TYPE_INT32
127eda14cbcSMatt Macy  *	Attribute Value	- driver instance number
128eda14cbcSMatt Macy  *
129eda14cbcSMatt Macy  *	Attribute Name	- DEV_PROP_PREFIX<devinfo_node_property>
130eda14cbcSMatt Macy  *	Attribute Type	- data type of the devinfo_node_property
131eda14cbcSMatt Macy  *	Attribute Value	- value of the devinfo_node_property
132eda14cbcSMatt Macy  *
133eda14cbcSMatt Macy  *
134eda14cbcSMatt Macy  * Event schema for EC_DEV_REMOVE/ESC_DISK
135eda14cbcSMatt Macy  *
136eda14cbcSMatt Macy  *	Event Class 	- EC_DEV_REMOVE
137eda14cbcSMatt Macy  *	Event Sub-Class - ESC_DISK
138eda14cbcSMatt Macy  *
139eda14cbcSMatt Macy  *	Attribute Name	- EV_VERSION
140eda14cbcSMatt Macy  *	Attribute Type	- DATA_TYPE_INT32
141eda14cbcSMatt Macy  *	Attribute Value	- event version number
142eda14cbcSMatt Macy  *
143eda14cbcSMatt Macy  *	Attribute Name	- DEV_NAME
144eda14cbcSMatt Macy  *	Attribute Type	- DATA_TYPE_STRING
145eda14cbcSMatt Macy  *	Attribute Value	- /dev name to the raw device.
146eda14cbcSMatt Macy  *			  The name does not include the slice number component.
147eda14cbcSMatt Macy  *
148eda14cbcSMatt Macy  *	Attribute Name	- DEV_PHYS_PATH
149eda14cbcSMatt Macy  *	Attribute Type	- DATA_TYPE_STRING
150eda14cbcSMatt Macy  *	Attribute Value	- physical path of the device without the "/devices"
151eda14cbcSMatt Macy  *			  prefix.
152eda14cbcSMatt Macy  *
153eda14cbcSMatt Macy  *	Attribute Name	- DEV_DRIVER_NAME
154eda14cbcSMatt Macy  *	Attribute Type	- DATA_TYPE_STRING
155eda14cbcSMatt Macy  *	Attribute Value	- driver name
156eda14cbcSMatt Macy  *
157eda14cbcSMatt Macy  *	Attribute Name	- DEV_INSTANCE
158eda14cbcSMatt Macy  *	Attribute Type	- DATA_TYPE_INT32
159eda14cbcSMatt Macy  *	Attribute Value	- driver instance number
160eda14cbcSMatt Macy  *
161eda14cbcSMatt Macy  *
162eda14cbcSMatt Macy  * Event schema for EC_DEV_REMOVE/ESC_NETWORK
163eda14cbcSMatt Macy  *
164eda14cbcSMatt Macy  *	Event Class 	- EC_DEV_REMOVE
165eda14cbcSMatt Macy  *	Event Sub-Class - ESC_NETWORK
166eda14cbcSMatt Macy  *
167eda14cbcSMatt Macy  *	Attribute Name	- EV_VERSION
168eda14cbcSMatt Macy  *	Attribute Type	- DATA_TYPE_INT32
169eda14cbcSMatt Macy  *	Attribute Value	- event version number
170eda14cbcSMatt Macy  *
171eda14cbcSMatt Macy  *	Attribute Name	- DEV_NAME
172eda14cbcSMatt Macy  *	Attribute Type	- DATA_TYPE_STRING
173eda14cbcSMatt Macy  *	Attribute Value	- /dev name associated with the device if exists.
174eda14cbcSMatt Macy  *			  /dev name associated with the driver for DLPI
175eda14cbcSMatt Macy  *			  Style-2 only drivers.
176eda14cbcSMatt Macy  *
177eda14cbcSMatt Macy  *	Attribute Name	- DEV_PHYS_PATH
178eda14cbcSMatt Macy  *	Attribute Type	- DATA_TYPE_STRING
179eda14cbcSMatt Macy  *	Attribute Value	- physical path of the device without the "/devices"
180eda14cbcSMatt Macy  *			  prefix.
181eda14cbcSMatt Macy  *
182eda14cbcSMatt Macy  *	Attribute Name	- DEV_DRIVER_NAME
183eda14cbcSMatt Macy  *	Attribute Type	- DATA_TYPE_STRING
184eda14cbcSMatt Macy  *	Attribute Value	- driver name
185eda14cbcSMatt Macy  *
186eda14cbcSMatt Macy  *	Attribute Name	- DEV_INSTANCE
187eda14cbcSMatt Macy  *	Attribute Type	- DATA_TYPE_INT32
188eda14cbcSMatt Macy  *	Attribute Value	- driver instance number
189eda14cbcSMatt Macy  *
190eda14cbcSMatt Macy  *
191eda14cbcSMatt Macy  * Event schema for EC_DEV_REMOVE/ESC_PRINTER
192eda14cbcSMatt Macy  *
193eda14cbcSMatt Macy  *	Event Class 	- EC_DEV_REMOVE
194eda14cbcSMatt Macy  *	Event Sub-Class - ESC_PRINTER
195eda14cbcSMatt Macy  *
196eda14cbcSMatt Macy  *	Attribute Name	- EV_VERSION
197eda14cbcSMatt Macy  *	Attribute Type	- DATA_TYPE_INT32
198eda14cbcSMatt Macy  *	Attribute Value	- event version number
199eda14cbcSMatt Macy  *
200eda14cbcSMatt Macy  *	Attribute Name	- DEV_NAME
201eda14cbcSMatt Macy  *	Attribute Type	- DATA_TYPE_STRING
202eda14cbcSMatt Macy  *	Attribute Value	- /dev/printers name associated with the device
203eda14cbcSMatt Macy  *			  if exists.
204eda14cbcSMatt Macy  *			  /dev name associated with the device if it exists
205eda14cbcSMatt Macy  *
206eda14cbcSMatt Macy  *	Attribute Name	- DEV_PHYS_PATH
207eda14cbcSMatt Macy  *	Attribute Type	- DATA_TYPE_STRING
208eda14cbcSMatt Macy  *	Attribute Value	- physical path of the device without the "/devices"
209eda14cbcSMatt Macy  *			  prefix.
210eda14cbcSMatt Macy  *
211eda14cbcSMatt Macy  *	Attribute Name	- DEV_DRIVER_NAME
212eda14cbcSMatt Macy  *	Attribute Type	- DATA_TYPE_STRING
213eda14cbcSMatt Macy  *	Attribute Value	- driver name
214eda14cbcSMatt Macy  *
215eda14cbcSMatt Macy  *	Attribute Name	- DEV_INSTANCE
216eda14cbcSMatt Macy  *	Attribute Type	- DATA_TYPE_INT32
217eda14cbcSMatt Macy  *	Attribute Value	- driver instance number
218eda14cbcSMatt Macy  *
219eda14cbcSMatt Macy  *
220eda14cbcSMatt Macy  * Event schema for EC_DEV_BRANCH/ESC_DEV_BRANCH_ADD or ESC_DEV_BRANCH_REMOVE
221eda14cbcSMatt Macy  *
222eda14cbcSMatt Macy  *	Event Class 	- EC_DEV_BRANCH
223eda14cbcSMatt Macy  *	Event Sub-Class - ESC_DEV_BRANCH_ADD or ESC_DEV_BRANCH_REMOVE
224eda14cbcSMatt Macy  *
225eda14cbcSMatt Macy  *	Attribute Name	- EV_VERSION
226eda14cbcSMatt Macy  *	Attribute Type	- DATA_TYPE_INT32
227eda14cbcSMatt Macy  *	Attribute Value	- event version number
228eda14cbcSMatt Macy  *
229eda14cbcSMatt Macy  *	Attribute Name	- DEV_PHYS_PATH
230eda14cbcSMatt Macy  *	Attribute Type	- DATA_TYPE_STRING
231eda14cbcSMatt Macy  *	Attribute Value	- physical path to the root node of the device subtree
232eda14cbcSMatt Macy  *			  without the "/devices" prefix.
233eda14cbcSMatt Macy  */
234eda14cbcSMatt Macy 
235eda14cbcSMatt Macy #define	EV_VERSION		"version"
236eda14cbcSMatt Macy #define	DEV_PHYS_PATH		"phys_path"
237eda14cbcSMatt Macy #define	DEV_NAME		"dev_name"
238eda14cbcSMatt Macy #define	DEV_DRIVER_NAME		"driver_name"
239eda14cbcSMatt Macy #define	DEV_INSTANCE		"instance"
240eda14cbcSMatt Macy #define	DEV_PROP_PREFIX		"prop-"
241eda14cbcSMatt Macy 
242eda14cbcSMatt Macy #ifdef __linux__
243eda14cbcSMatt Macy #define	DEV_IDENTIFIER		"devid"
244eda14cbcSMatt Macy #define	DEV_PATH		"path"
245eda14cbcSMatt Macy #define	DEV_IS_PART		"is_slice"
246eda14cbcSMatt Macy #define	DEV_SIZE		"dev_size"
247*c7046f76SMartin Matuska 
248*c7046f76SMartin Matuska /* Size of the whole parent block device (if dev is a partition) */
249*c7046f76SMartin Matuska #define	DEV_PARENT_SIZE		"dev_parent_size"
250eda14cbcSMatt Macy #endif /* __linux__ */
251eda14cbcSMatt Macy 
252eda14cbcSMatt Macy #define	EV_V1			1
253eda14cbcSMatt Macy 
254eda14cbcSMatt Macy /* maximum number of devinfo node properties added to the event */
255eda14cbcSMatt Macy #define	MAX_PROP_COUNT		100
256eda14cbcSMatt Macy 
257eda14cbcSMatt Macy /* only properties with size less than PROP_LEN_LIMIT are added to the event */
258eda14cbcSMatt Macy #define	PROP_LEN_LIMIT		1024
259eda14cbcSMatt Macy 
260eda14cbcSMatt Macy #ifdef	__cplusplus
261eda14cbcSMatt Macy }
262eda14cbcSMatt Macy #endif
263eda14cbcSMatt Macy 
264eda14cbcSMatt Macy #endif /* _SYS_SYSEVENT_DEV_H */
265