Tizen 2.1 base
[external/device-mapper.git] / libdm / ioctl / libdm-compat.h
1 /*
2  * Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
3  * Copyright (C) 2004-2006 Red Hat, Inc. All rights reserved.
4  *
5  * This file is part of the device-mapper userspace tools.
6  *
7  * This copyrighted material is made available to anyone wishing to use,
8  * modify, copy, or redistribute it subject to the terms and conditions
9  * of the GNU Lesser General Public License v.2.1.
10  *
11  * You should have received a copy of the GNU Lesser General Public License
12  * along with this program; if not, write to the Free Software Foundation,
13  * Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
14  */
15
16 #ifndef _LINUX_LIBDM_COMPAT_H
17 #define _LINUX_LIBDM_COMPAT_H
18
19 #include "kdev_t.h"
20 #include "dm-ioctl.h"
21 #include <inttypes.h>
22 #include <sys/ioctl.h>
23
24 struct dm_task;
25 struct dm_info;
26
27 /*
28  * Old versions of structures for backwards compatibility.
29  */
30
31 struct dm_ioctl_v1 {
32         uint32_t version[3];    /* in/out */
33         uint32_t data_size;     /* total size of data passed in
34                                  * including this struct */
35
36         uint32_t data_start;    /* offset to start of data
37                                  * relative to start of this struct */
38
39         int32_t target_count;   /* in/out */
40         int32_t open_count;     /* out */
41         uint32_t flags;         /* in/out */
42
43         __kernel_dev_t dev;     /* in/out */
44
45         char name[DM_NAME_LEN]; /* device name */
46         char uuid[DM_UUID_LEN]; /* unique identifier for
47                                  * the block device */
48 };
49
50 struct dm_target_spec_v1 {
51         int32_t status;         /* used when reading from kernel only */
52         uint64_t sector_start;
53         uint32_t length;
54         uint32_t next;
55
56         char target_type[DM_MAX_TYPE_NAME];
57
58 };
59
60 struct dm_target_deps_v1 {
61         uint32_t count;
62
63         __kernel_dev_t dev[0];  /* out */
64 };
65
66 enum {
67         /* Top level cmds */
68         DM_VERSION_CMD_V1 = 0,
69         DM_REMOVE_ALL_CMD_V1,
70
71         /* device level cmds */
72         DM_DEV_CREATE_CMD_V1,
73         DM_DEV_REMOVE_CMD_V1,
74         DM_DEV_RELOAD_CMD_V1,
75         DM_DEV_RENAME_CMD_V1,
76         DM_DEV_SUSPEND_CMD_V1,
77         DM_DEV_DEPS_CMD_V1,
78         DM_DEV_STATUS_CMD_V1,
79
80         /* target level cmds */
81         DM_TARGET_STATUS_CMD_V1,
82         DM_TARGET_WAIT_CMD_V1,
83 };
84
85 #define DM_VERSION_V1       _IOWR(DM_IOCTL, DM_VERSION_CMD_V1, struct dm_ioctl)
86 #define DM_REMOVE_ALL_V1    _IOWR(DM_IOCTL, DM_REMOVE_ALL_CMD_V1, struct dm_ioctl)
87
88 #define DM_DEV_CREATE_V1    _IOWR(DM_IOCTL, DM_DEV_CREATE_CMD_V1, struct dm_ioctl)
89 #define DM_DEV_REMOVE_V1    _IOWR(DM_IOCTL, DM_DEV_REMOVE_CMD_V1, struct dm_ioctl)
90 #define DM_DEV_RELOAD_V1    _IOWR(DM_IOCTL, DM_DEV_RELOAD_CMD_V1, struct dm_ioctl)
91 #define DM_DEV_SUSPEND_V1   _IOWR(DM_IOCTL, DM_DEV_SUSPEND_CMD_V1, struct dm_ioctl)
92 #define DM_DEV_RENAME_V1    _IOWR(DM_IOCTL, DM_DEV_RENAME_CMD_V1, struct dm_ioctl)
93 #define DM_DEV_DEPS_V1      _IOWR(DM_IOCTL, DM_DEV_DEPS_CMD_V1, struct dm_ioctl)
94 #define DM_DEV_STATUS_V1    _IOWR(DM_IOCTL, DM_DEV_STATUS_CMD_V1, struct dm_ioctl)
95
96 #define DM_TARGET_STATUS_V1 _IOWR(DM_IOCTL, DM_TARGET_STATUS_CMD_V1, struct dm_ioctl)
97 #define DM_TARGET_WAIT_V1   _IOWR(DM_IOCTL, DM_TARGET_WAIT_CMD_V1, struct dm_ioctl)
98
99 /* *INDENT-OFF* */
100 static struct cmd_data _cmd_data_v1[] = {
101         { "create",     DM_DEV_CREATE_V1,       {1, 0, 0} },
102         { "reload",     DM_DEV_RELOAD_V1,       {1, 0, 0} },
103         { "remove",     DM_DEV_REMOVE_V1,       {1, 0, 0} },
104         { "remove_all", DM_REMOVE_ALL_V1,       {1, 0, 0} },
105         { "suspend",    DM_DEV_SUSPEND_V1,      {1, 0, 0} },
106         { "resume",     DM_DEV_SUSPEND_V1,      {1, 0, 0} },
107         { "info",       DM_DEV_STATUS_V1,       {1, 0, 0} },
108         { "deps",       DM_DEV_DEPS_V1,         {1, 0, 0} },
109         { "rename",     DM_DEV_RENAME_V1,       {1, 0, 0} },
110         { "version",    DM_VERSION_V1,          {1, 0, 0} },
111         { "status",     DM_TARGET_STATUS_V1,    {1, 0, 0} },
112         { "table",      DM_TARGET_STATUS_V1,    {1, 0, 0} },
113         { "waitevent",  DM_TARGET_WAIT_V1,      {1, 0, 0} },
114         { "names",      0,                      {4, 0, 0} },
115         { "clear",      0,                      {4, 0, 0} },
116         { "mknodes",    0,                      {4, 0, 0} },
117         { "versions",   0,                      {4, 1, 0} },
118         { "message",    0,                      {4, 2, 0} },
119         { "setgeometry",0,                      {4, 6, 0} },
120 };
121 /* *INDENT-ON* */
122
123 #endif