]> bbs.cooldavid.org Git - net-next-2.6.git/blame - include/linux/dm-ioctl.h
IPv6: Add dontfrag argument to relevant functions
[net-next-2.6.git] / include / linux / dm-ioctl.h
CommitLineData
1da177e4
LT
1/*
2 * Copyright (C) 2001 - 2003 Sistina Software (UK) Limited.
1d0f3ce8 3 * Copyright (C) 2004 - 2009 Red Hat, Inc. All rights reserved.
1da177e4
LT
4 *
5 * This file is released under the LGPL.
6 */
7
8#ifndef _LINUX_DM_IOCTL_V4_H
9#define _LINUX_DM_IOCTL_V4_H
10
11#include <linux/types.h>
12
13#define DM_DIR "mapper" /* Slashes not supported */
14#define DM_MAX_TYPE_NAME 16
15#define DM_NAME_LEN 128
16#define DM_UUID_LEN 129
17
18/*
19 * A traditional ioctl interface for the device mapper.
20 *
21 * Each device can have two tables associated with it, an
22 * 'active' table which is the one currently used by io passing
23 * through the device, and an 'inactive' one which is a table
24 * that is being prepared as a replacement for the 'active' one.
25 *
26 * DM_VERSION:
27 * Just get the version information for the ioctl interface.
28 *
29 * DM_REMOVE_ALL:
30 * Remove all dm devices, destroy all tables. Only really used
31 * for debug.
32 *
33 * DM_LIST_DEVICES:
34 * Get a list of all the dm device names.
35 *
36 * DM_DEV_CREATE:
37 * Create a new device, neither the 'active' or 'inactive' table
38 * slots will be filled. The device will be in suspended state
39 * after creation, however any io to the device will get errored
40 * since it will be out-of-bounds.
41 *
42 * DM_DEV_REMOVE:
43 * Remove a device, destroy any tables.
44 *
45 * DM_DEV_RENAME:
46 * Rename a device.
47 *
48 * DM_SUSPEND:
49 * This performs both suspend and resume, depending which flag is
50 * passed in.
51 * Suspend: This command will not return until all pending io to
52 * the device has completed. Further io will be deferred until
53 * the device is resumed.
54 * Resume: It is no longer an error to issue this command on an
55 * unsuspended device. If a table is present in the 'inactive'
56 * slot, it will be moved to the active slot, then the old table
57 * from the active slot will be _destroyed_. Finally the device
58 * is resumed.
59 *
60 * DM_DEV_STATUS:
61 * Retrieves the status for the table in the 'active' slot.
62 *
63 * DM_DEV_WAIT:
64 * Wait for a significant event to occur to the device. This
65 * could either be caused by an event triggered by one of the
66 * targets of the table in the 'active' slot, or a table change.
67 *
68 * DM_TABLE_LOAD:
69 * Load a table into the 'inactive' slot for the device. The
70 * device does _not_ need to be suspended prior to this command.
71 *
72 * DM_TABLE_CLEAR:
73 * Destroy any table in the 'inactive' slot (ie. abort).
74 *
75 * DM_TABLE_DEPS:
76 * Return a set of device dependencies for the 'active' table.
77 *
78 * DM_TABLE_STATUS:
79 * Return the targets status for the 'active' table.
80 *
81 * DM_TARGET_MSG:
82 * Pass a message string to the target at a specific offset of a device.
3ac51e74
DW
83 *
84 * DM_DEV_SET_GEOMETRY:
85 * Set the geometry of a device by passing in a string in this format:
86 *
87 * "cylinders heads sectors_per_track start_sector"
88 *
89 * Beware that CHS geometry is nearly obsolete and only provided
90 * for compatibility with dm devices that can be booted by a PC
91 * BIOS. See struct hd_geometry for range limits. Also note that
92 * the geometry is erased if the device size changes.
1da177e4
LT
93 */
94
95/*
96 * All ioctl arguments consist of a single chunk of memory, with
97 * this structure at the start. If a uuid is specified any
98 * lookup (eg. for a DM_INFO) will be done on that, *not* the
99 * name.
100 */
101struct dm_ioctl {
102 /*
103 * The version number is made up of three parts:
104 * major - no backward or forward compatibility,
105 * minor - only backwards compatible,
106 * patch - both backwards and forwards compatible.
107 *
108 * All clients of the ioctl interface should fill in the
109 * version number of the interface that they were
110 * compiled with.
111 *
112 * All recognised ioctl commands (ie. those that don't
113 * return -ENOTTY) fill out this field, even if the
114 * command failed.
115 */
9adfbfb6
AB
116 __u32 version[3]; /* in/out */
117 __u32 data_size; /* total size of data passed in
1da177e4
LT
118 * including this struct */
119
9adfbfb6 120 __u32 data_start; /* offset to start of data
1da177e4
LT
121 * relative to start of this struct */
122
9adfbfb6
AB
123 __u32 target_count; /* in/out */
124 __s32 open_count; /* out */
125 __u32 flags; /* in/out */
60935eb2
MB
126
127 /*
128 * event_nr holds either the event number (input and output) or the
129 * udev cookie value (input only).
130 * The DM_DEV_WAIT ioctl takes an event number as input.
131 * The DM_SUSPEND, DM_DEV_REMOVE and DM_DEV_RENAME ioctls
132 * use the field as a cookie to return in the DM_COOKIE
133 * variable with the uevents they issue.
134 * For output, the ioctls return the event number, not the cookie.
135 */
9adfbfb6
AB
136 __u32 event_nr; /* in/out */
137 __u32 padding;
1da177e4 138
9adfbfb6 139 __u64 dev; /* in/out */
1da177e4
LT
140
141 char name[DM_NAME_LEN]; /* device name */
142 char uuid[DM_UUID_LEN]; /* unique identifier for
143 * the block device */
027d50f9 144 char data[7]; /* padding or data */
1da177e4
LT
145};
146
147/*
148 * Used to specify tables. These structures appear after the
149 * dm_ioctl.
150 */
151struct dm_target_spec {
9adfbfb6
AB
152 __u64 sector_start;
153 __u64 length;
154 __s32 status; /* used when reading from kernel only */
1da177e4
LT
155
156 /*
157 * Location of the next dm_target_spec.
158 * - When specifying targets on a DM_TABLE_LOAD command, this value is
159 * the number of bytes from the start of the "current" dm_target_spec
160 * to the start of the "next" dm_target_spec.
161 * - When retrieving targets on a DM_TABLE_STATUS command, this value
162 * is the number of bytes from the start of the first dm_target_spec
163 * (that follows the dm_ioctl struct) to the start of the "next"
164 * dm_target_spec.
165 */
9adfbfb6 166 __u32 next;
1da177e4
LT
167
168 char target_type[DM_MAX_TYPE_NAME];
169
170 /*
171 * Parameter string starts immediately after this object.
172 * Be careful to add padding after string to ensure correct
173 * alignment of subsequent dm_target_spec.
174 */
175};
176
177/*
178 * Used to retrieve the target dependencies.
179 */
180struct dm_target_deps {
9adfbfb6
AB
181 __u32 count; /* Array size */
182 __u32 padding; /* unused */
183 __u64 dev[0]; /* out */
1da177e4
LT
184};
185
186/*
187 * Used to get a list of all dm devices.
188 */
189struct dm_name_list {
9adfbfb6
AB
190 __u64 dev;
191 __u32 next; /* offset to the next record from
1da177e4
LT
192 the _start_ of this */
193 char name[0];
194};
195
196/*
197 * Used to retrieve the target versions
198 */
199struct dm_target_versions {
9adfbfb6
AB
200 __u32 next;
201 __u32 version[3];
1da177e4
LT
202
203 char name[0];
204};
205
206/*
207 * Used to pass message to a target
208 */
209struct dm_target_msg {
9adfbfb6 210 __u64 sector; /* Device sector */
1da177e4
LT
211
212 char message[0];
213};
214
215/*
216 * If you change this make sure you make the corresponding change
217 * to dm-ioctl.c:lookup_ioctl()
218 */
219enum {
220 /* Top level cmds */
221 DM_VERSION_CMD = 0,
222 DM_REMOVE_ALL_CMD,
223 DM_LIST_DEVICES_CMD,
224
225 /* device level cmds */
226 DM_DEV_CREATE_CMD,
227 DM_DEV_REMOVE_CMD,
228 DM_DEV_RENAME_CMD,
229 DM_DEV_SUSPEND_CMD,
230 DM_DEV_STATUS_CMD,
231 DM_DEV_WAIT_CMD,
232
233 /* Table level cmds */
234 DM_TABLE_LOAD_CMD,
235 DM_TABLE_CLEAR_CMD,
236 DM_TABLE_DEPS_CMD,
237 DM_TABLE_STATUS_CMD,
238
239 /* Added later */
240 DM_LIST_VERSIONS_CMD,
241 DM_TARGET_MSG_CMD,
3ac51e74 242 DM_DEV_SET_GEOMETRY_CMD
1da177e4
LT
243};
244
1da177e4
LT
245#define DM_IOCTL 0xfd
246
247#define DM_VERSION _IOWR(DM_IOCTL, DM_VERSION_CMD, struct dm_ioctl)
248#define DM_REMOVE_ALL _IOWR(DM_IOCTL, DM_REMOVE_ALL_CMD, struct dm_ioctl)
249#define DM_LIST_DEVICES _IOWR(DM_IOCTL, DM_LIST_DEVICES_CMD, struct dm_ioctl)
250
251#define DM_DEV_CREATE _IOWR(DM_IOCTL, DM_DEV_CREATE_CMD, struct dm_ioctl)
252#define DM_DEV_REMOVE _IOWR(DM_IOCTL, DM_DEV_REMOVE_CMD, struct dm_ioctl)
253#define DM_DEV_RENAME _IOWR(DM_IOCTL, DM_DEV_RENAME_CMD, struct dm_ioctl)
254#define DM_DEV_SUSPEND _IOWR(DM_IOCTL, DM_DEV_SUSPEND_CMD, struct dm_ioctl)
255#define DM_DEV_STATUS _IOWR(DM_IOCTL, DM_DEV_STATUS_CMD, struct dm_ioctl)
256#define DM_DEV_WAIT _IOWR(DM_IOCTL, DM_DEV_WAIT_CMD, struct dm_ioctl)
257
258#define DM_TABLE_LOAD _IOWR(DM_IOCTL, DM_TABLE_LOAD_CMD, struct dm_ioctl)
259#define DM_TABLE_CLEAR _IOWR(DM_IOCTL, DM_TABLE_CLEAR_CMD, struct dm_ioctl)
260#define DM_TABLE_DEPS _IOWR(DM_IOCTL, DM_TABLE_DEPS_CMD, struct dm_ioctl)
261#define DM_TABLE_STATUS _IOWR(DM_IOCTL, DM_TABLE_STATUS_CMD, struct dm_ioctl)
262
263#define DM_LIST_VERSIONS _IOWR(DM_IOCTL, DM_LIST_VERSIONS_CMD, struct dm_ioctl)
264
265#define DM_TARGET_MSG _IOWR(DM_IOCTL, DM_TARGET_MSG_CMD, struct dm_ioctl)
3ac51e74 266#define DM_DEV_SET_GEOMETRY _IOWR(DM_IOCTL, DM_DEV_SET_GEOMETRY_CMD, struct dm_ioctl)
1da177e4
LT
267
268#define DM_VERSION_MAJOR 4
3abf85b5 269#define DM_VERSION_MINOR 17
1da177e4 270#define DM_VERSION_PATCHLEVEL 0
3abf85b5 271#define DM_VERSION_EXTRA "-ioctl (2010-03-05)"
1da177e4
LT
272
273/* Status bits */
274#define DM_READONLY_FLAG (1 << 0) /* In/Out */
275#define DM_SUSPEND_FLAG (1 << 1) /* In/Out */
276#define DM_PERSISTENT_DEV_FLAG (1 << 3) /* In */
277
278/*
279 * Flag passed into ioctl STATUS command to get table information
280 * rather than current status.
281 */
282#define DM_STATUS_TABLE_FLAG (1 << 4) /* In */
283
284/*
285 * Flags that indicate whether a table is present in either of
286 * the two table slots that a device has.
287 */
288#define DM_ACTIVE_PRESENT_FLAG (1 << 5) /* Out */
289#define DM_INACTIVE_PRESENT_FLAG (1 << 6) /* Out */
290
291/*
292 * Indicates that the buffer passed in wasn't big enough for the
293 * results.
294 */
295#define DM_BUFFER_FULL_FLAG (1 << 8) /* Out */
296
297/*
5c6bd75d 298 * This flag is now ignored.
1da177e4
LT
299 */
300#define DM_SKIP_BDGET_FLAG (1 << 9) /* In */
301
6da487dc
AK
302/*
303 * Set this to avoid attempting to freeze any filesystem when suspending.
304 */
305#define DM_SKIP_LOCKFS_FLAG (1 << 10) /* In */
306
81fdb096
KU
307/*
308 * Set this to suspend without flushing queued ios.
309 */
310#define DM_NOFLUSH_FLAG (1 << 11) /* In */
311
1d0f3ce8
MS
312/*
313 * If set, any table information returned will relate to the inactive
314 * table instead of the live one. Always check DM_INACTIVE_PRESENT_FLAG
315 * is set before using the data returned.
316 */
317#define DM_QUERY_INACTIVE_TABLE_FLAG (1 << 12) /* In */
318
3abf85b5
PR
319/*
320 * If set, a uevent was generated for which the caller may need to wait.
321 */
322#define DM_UEVENT_GENERATED_FLAG (1 << 13) /* Out */
323
1da177e4 324#endif /* _LINUX_DM_IOCTL_H */