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