Rev 422 | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
422 | giacomo | 1 | /* |
2 | * Copyright (C) 2001 Sistina Software (UK) Limited. |
||
3 | * |
||
4 | * This file is released under the LGPL. |
||
5 | */ |
||
6 | |||
7 | #ifndef _LINUX_DM_IOCTL_V1_H |
||
8 | #define _LINUX_DM_IOCTL_V1_H |
||
9 | |||
10 | #include <linux/types.h> |
||
11 | |||
12 | #define DM_DIR "mapper" /* Slashes not supported */ |
||
13 | #define DM_MAX_TYPE_NAME 16 |
||
14 | #define DM_NAME_LEN 128 |
||
15 | #define DM_UUID_LEN 129 |
||
16 | |||
17 | /* |
||
18 | * Implements a traditional ioctl interface to the device mapper. |
||
19 | */ |
||
20 | |||
21 | /* |
||
22 | * All ioctl arguments consist of a single chunk of memory, with |
||
23 | * this structure at the start. If a uuid is specified any |
||
24 | * lookup (eg. for a DM_INFO) will be done on that, *not* the |
||
25 | * name. |
||
26 | */ |
||
27 | struct dm_ioctl { |
||
28 | /* |
||
29 | * The version number is made up of three parts: |
||
30 | * major - no backward or forward compatibility, |
||
31 | * minor - only backwards compatible, |
||
32 | * patch - both backwards and forwards compatible. |
||
33 | * |
||
34 | * All clients of the ioctl interface should fill in the |
||
35 | * version number of the interface that they were |
||
36 | * compiled with. |
||
37 | * |
||
38 | * All recognised ioctl commands (ie. those that don't |
||
39 | * return -ENOTTY) fill out this field, even if the |
||
40 | * command failed. |
||
41 | */ |
||
42 | uint32_t version[3]; /* in/out */ |
||
43 | uint32_t data_size; /* total size of data passed in |
||
44 | * including this struct */ |
||
45 | |||
46 | uint32_t data_start; /* offset to start of data |
||
47 | * relative to start of this struct */ |
||
48 | |||
49 | uint32_t target_count; /* in/out */ |
||
50 | uint32_t open_count; /* out */ |
||
51 | uint32_t flags; /* in/out */ |
||
52 | |||
53 | __kernel_old_dev_t dev; /* in/out */ |
||
54 | |||
55 | char name[DM_NAME_LEN]; /* device name */ |
||
56 | char uuid[DM_UUID_LEN]; /* unique identifier for |
||
57 | * the block device */ |
||
58 | }; |
||
59 | |||
60 | /* |
||
61 | * Used to specify tables. These structures appear after the |
||
62 | * dm_ioctl. |
||
63 | */ |
||
64 | struct dm_target_spec { |
||
65 | int32_t status; /* used when reading from kernel only */ |
||
66 | uint64_t sector_start; |
||
67 | uint32_t length; |
||
68 | |||
69 | /* |
||
70 | * Offset in bytes (from the start of this struct) to |
||
71 | * next target_spec. |
||
72 | */ |
||
73 | uint32_t next; |
||
74 | |||
75 | char target_type[DM_MAX_TYPE_NAME]; |
||
76 | |||
77 | /* |
||
78 | * Parameter string starts immediately after this object. |
||
79 | * Be careful to add padding after string to ensure correct |
||
80 | * alignment of subsequent dm_target_spec. |
||
81 | */ |
||
82 | }; |
||
83 | |||
84 | /* |
||
85 | * Used to retrieve the target dependencies. |
||
86 | */ |
||
87 | struct dm_target_deps { |
||
88 | uint32_t count; |
||
89 | |||
90 | __kernel_old_dev_t dev[0]; /* out */ |
||
91 | }; |
||
92 | |||
93 | /* |
||
94 | * If you change this make sure you make the corresponding change |
||
95 | * to dm-ioctl.c:lookup_ioctl() |
||
96 | */ |
||
97 | enum { |
||
98 | /* Top level cmds */ |
||
99 | DM_VERSION_CMD = 0, |
||
100 | DM_REMOVE_ALL_CMD, |
||
101 | |||
102 | /* device level cmds */ |
||
103 | DM_DEV_CREATE_CMD, |
||
104 | DM_DEV_REMOVE_CMD, |
||
105 | DM_DEV_RELOAD_CMD, |
||
106 | DM_DEV_RENAME_CMD, |
||
107 | DM_DEV_SUSPEND_CMD, |
||
108 | DM_DEV_DEPS_CMD, |
||
109 | DM_DEV_STATUS_CMD, |
||
110 | |||
111 | /* target level cmds */ |
||
112 | DM_TARGET_STATUS_CMD, |
||
113 | DM_TARGET_WAIT_CMD |
||
114 | }; |
||
115 | |||
116 | #define DM_IOCTL 0xfd |
||
117 | |||
118 | #define DM_VERSION _IOWR(DM_IOCTL, DM_VERSION_CMD, struct dm_ioctl) |
||
119 | #define DM_REMOVE_ALL _IOWR(DM_IOCTL, DM_REMOVE_ALL_CMD, struct dm_ioctl) |
||
120 | |||
121 | #define DM_DEV_CREATE _IOWR(DM_IOCTL, DM_DEV_CREATE_CMD, struct dm_ioctl) |
||
122 | #define DM_DEV_REMOVE _IOWR(DM_IOCTL, DM_DEV_REMOVE_CMD, struct dm_ioctl) |
||
123 | #define DM_DEV_RELOAD _IOWR(DM_IOCTL, DM_DEV_RELOAD_CMD, struct dm_ioctl) |
||
124 | #define DM_DEV_SUSPEND _IOWR(DM_IOCTL, DM_DEV_SUSPEND_CMD, struct dm_ioctl) |
||
125 | #define DM_DEV_RENAME _IOWR(DM_IOCTL, DM_DEV_RENAME_CMD, struct dm_ioctl) |
||
126 | #define DM_DEV_DEPS _IOWR(DM_IOCTL, DM_DEV_DEPS_CMD, struct dm_ioctl) |
||
127 | #define DM_DEV_STATUS _IOWR(DM_IOCTL, DM_DEV_STATUS_CMD, struct dm_ioctl) |
||
128 | |||
129 | #define DM_TARGET_STATUS _IOWR(DM_IOCTL, DM_TARGET_STATUS_CMD, struct dm_ioctl) |
||
130 | #define DM_TARGET_WAIT _IOWR(DM_IOCTL, DM_TARGET_WAIT_CMD, struct dm_ioctl) |
||
131 | |||
132 | #define DM_VERSION_MAJOR 1 |
||
133 | #define DM_VERSION_MINOR 0 |
||
134 | #define DM_VERSION_PATCHLEVEL 6 |
||
135 | #define DM_VERSION_EXTRA "-ioctl (2002-10-15)" |
||
136 | |||
137 | /* Status bits */ |
||
138 | #define DM_READONLY_FLAG 0x00000001 |
||
139 | #define DM_SUSPEND_FLAG 0x00000002 |
||
140 | #define DM_EXISTS_FLAG 0x00000004 |
||
141 | #define DM_PERSISTENT_DEV_FLAG 0x00000008 |
||
142 | |||
143 | /* |
||
144 | * Flag passed into ioctl STATUS command to get table information |
||
145 | * rather than current status. |
||
146 | */ |
||
147 | #define DM_STATUS_TABLE_FLAG 0x00000010 |
||
148 | |||
149 | #endif /* _LINUX_DM_IOCTL_H */ |