1 /* $NetBSD: netbsd-dm.h,v 1.6 2009/12/05 11:30:26 haad Exp $ */
4 * Copyright (c) 2008 The NetBSD Foundation, Inc.
7 * This code is derived from software contributed to The NetBSD Foundation
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
19 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE.
32 #ifndef __NETBSD_DM_H__
33 #define __NETBSD_DM_H__
35 #include <libprop/proplib.h>
41 #define DM_IOCTL_CMD 0
43 #define NETBSD_DM_IOCTL _IOWR(DM_IOCTL, DM_IOCTL_CMD, struct plistref)
47 * DM-ioctl dictionary.
49 * This contains general information about dm device.
53 * <string>...</string>
56 * <integer>...</integer>
59 * <string>...</string>
62 * <string>...</string>
72 * <integer>...</integer>
73 * <integer>...</integer>
74 * <integer>...</integer>
79 * <!-- See below for command
80 * specific dictionaries -->
84 * Available commands from _cmd_data_v4.
86 * create, reload, remove, remove_all, suspend,
87 * resume, info, deps, rename, version, status,
88 * table, waitevent, names, clear, mknodes,
89 * targets, message, setgeometry
94 * DM_LIST_VERSIONS == "targets" command dictionary entry.
95 * Lists all available targets with their version.
100 * <string>...</string>
104 * <integer>...</integer>
105 * <integer>...</integer>
106 * <integer>...</integer>
114 * DM_DEV_LIST == "names"
115 * Request list of device-mapper created devices from kernel.
120 * <string>...</string>
123 * <integer>...</integer>
132 * DM_DEV_RENAME == "rename"
133 * Rename device to string.
136 * <string>...</string>
142 * DM_DEV_STATUS == "info, mknodes"
143 * Will change fields DM_IOCTL_OPEN, DM_IOCTL_DEV in received dictionary,
144 * with dm device values with name or uuid from list.
149 * DM_TABLE_STATUS == "status,table"
150 * Request list of device-mapper created devices from kernel.
155 * <string>...</string>
158 * <integer>...</integer>
161 * <integer>...</integer>
164 * <string>...</string>
168 * params is string which contains {device} {parameters}
173 * DM_TABLE_DEPS == "deps"
174 * Request list active table device dependiences.
176 * This command is also run to get dm-device
177 * dependiences for existing real block device.
179 * eg. vgcreate calls DM_TABLE_DEPS
182 * <integer>...</integer>
188 #define DM_IOCTL_COMMAND "command"
189 #define DM_IOCTL_VERSION "version"
190 #define DM_IOCTL_OPEN "open_count"
191 #define DM_IOCTL_MINOR "minor"
192 #define DM_IOCTL_NAME "name"
193 #define DM_IOCTL_UUID "uuid"
194 #define DM_IOCTL_TARGET_COUNT "target_count"
195 #define DM_IOCTL_EVENT "event_nr"
196 #define DM_IOCTL_FLAGS "flags"
197 #define DM_IOCTL_CMD_DATA "cmd_data"
199 #define DM_TARGETS_NAME "name"
200 #define DM_TARGETS_VERSION "ver"
202 #define DM_DEV_NEWNAME "newname"
203 #define DM_DEV_NAME "name"
204 #define DM_DEV_DEV "dev"
205 #define DM_DEV_UID "uid"
206 #define DM_DEV_GID "gid"
207 #define DM_DEV_MODE "mode"
209 #define DM_TABLE_TYPE "type"
210 #define DM_TABLE_START "start"
211 #define DM_TABLE_STAT "status"
212 #define DM_TABLE_LENGTH "length"
213 #define DM_TABLE_PARAMS "params"
215 #define DM_MESSAGE_SECTOR "sector"
216 #define DM_MESSAGE_STR "message"
220 /* IO mode of device */
221 #define DM_READONLY_FLAG (1 << 0) /* In/Out *//* to kernel/from kernel */
222 #define DM_SUSPEND_FLAG (1 << 1) /* In/Out */
223 /* XXX. This flag is undocumented. */
224 #define DM_EXISTS_FLAG (1 << 2) /* In/Out */
225 /* Minor number is persistent */
226 #define DM_PERSISTENT_DEV_FLAG (1 << 3) /* In */
229 * Flag passed into ioctl STATUS command to get table information
230 * rather than current status.
232 #define DM_STATUS_TABLE_FLAG (1 << 4) /* In */
235 * Flags that indicate whether a table is present in either of
236 * the two table slots that a device has.
238 #define DM_ACTIVE_PRESENT_FLAG (1 << 5) /* Out */
239 #define DM_INACTIVE_PRESENT_FLAG (1 << 6) /* Out */
242 * Indicates that the buffer passed in wasn't big enough for the
245 #define DM_BUFFER_FULL_FLAG (1 << 8) /* Out */
248 * This flag is now ignored.
250 #define DM_SKIP_BDGET_FLAG (1 << 9) /* In */
253 * Set this to avoid attempting to freeze any filesystem when suspending.
255 #define DM_SKIP_LOCKFS_FLAG (1 << 10) /* In */
258 * Set this to suspend without flushing queued ios.
260 #define DM_NOFLUSH_FLAG (1 << 11) /* In */
263 * If set, any table information returned will relate to the inactive
264 * table instead of the live one. Always check DM_INACTIVE_PRESENT_FLAG
265 * is set before using the data returned.
267 #define DM_QUERY_INACTIVE_TABLE_FLAG (1 << 12) /* In */
270 * If set, a rename affects the UUID instead of the name. Only valid
271 * if the UUID was empty before.
273 #define DM_UUID_FLAG (1 << 14) /* In */
276 * Set this flag for the ioctl buffers to be wiped.
278 #define DM_SECURE_DATA_FLAG (1 << 15) /* In */
280 #endif /* __NETBSD_DM_H__ */