summaryrefslogtreecommitdiff
path: root/libdm/ioctl/libdm-compat.h
blob: 5ba63ce7706be343c8c64c70a13f98011672f2ec (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
/*
 * Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
 * Copyright (C) 2004-2006 Red Hat, Inc. All rights reserved.
 *
 * This file is part of the device-mapper userspace tools.
 *
 * This copyrighted material is made available to anyone wishing to use,
 * modify, copy, or redistribute it subject to the terms and conditions
 * of the GNU Lesser General Public License v.2.1.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this program; if not, write to the Free Software Foundation,
 * Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

#ifndef _LINUX_LIBDM_COMPAT_H
#define _LINUX_LIBDM_COMPAT_H

#include "kdev_t.h"
#include "dm-ioctl.h"
#include <inttypes.h>
#include <sys/ioctl.h>

struct dm_task;
struct dm_info;

/*
 * Old versions of structures for backwards compatibility.
 */

struct dm_ioctl_v1 {
	uint32_t version[3];	/* in/out */
	uint32_t data_size;	/* total size of data passed in
				 * including this struct */

	uint32_t data_start;	/* offset to start of data
				 * relative to start of this struct */

	int32_t target_count;	/* in/out */
	int32_t open_count;	/* out */
	uint32_t flags;		/* in/out */

	__kernel_dev_t dev;	/* in/out */

	char name[DM_NAME_LEN];	/* device name */
	char uuid[DM_UUID_LEN];	/* unique identifier for
				 * the block device */
};

struct dm_target_spec_v1 {
	int32_t status;		/* used when reading from kernel only */
	uint64_t sector_start;
	uint32_t length;
	uint32_t next;

	char target_type[DM_MAX_TYPE_NAME];

};

struct dm_target_deps_v1 {
	uint32_t count;

	__kernel_dev_t dev[0];	/* out */
};

enum {
	/* Top level cmds */
	DM_VERSION_CMD_V1 = 0,
	DM_REMOVE_ALL_CMD_V1,

	/* device level cmds */
	DM_DEV_CREATE_CMD_V1,
	DM_DEV_REMOVE_CMD_V1,
	DM_DEV_RELOAD_CMD_V1,
	DM_DEV_RENAME_CMD_V1,
	DM_DEV_SUSPEND_CMD_V1,
	DM_DEV_DEPS_CMD_V1,
	DM_DEV_STATUS_CMD_V1,

	/* target level cmds */
	DM_TARGET_STATUS_CMD_V1,
	DM_TARGET_WAIT_CMD_V1,
};

#define DM_VERSION_V1       _IOWR(DM_IOCTL, DM_VERSION_CMD_V1, struct dm_ioctl)
#define DM_REMOVE_ALL_V1    _IOWR(DM_IOCTL, DM_REMOVE_ALL_CMD_V1, struct dm_ioctl)

#define DM_DEV_CREATE_V1    _IOWR(DM_IOCTL, DM_DEV_CREATE_CMD_V1, struct dm_ioctl)
#define DM_DEV_REMOVE_V1    _IOWR(DM_IOCTL, DM_DEV_REMOVE_CMD_V1, struct dm_ioctl)
#define DM_DEV_RELOAD_V1    _IOWR(DM_IOCTL, DM_DEV_RELOAD_CMD_V1, struct dm_ioctl)
#define DM_DEV_SUSPEND_V1   _IOWR(DM_IOCTL, DM_DEV_SUSPEND_CMD_V1, struct dm_ioctl)
#define DM_DEV_RENAME_V1    _IOWR(DM_IOCTL, DM_DEV_RENAME_CMD_V1, struct dm_ioctl)
#define DM_DEV_DEPS_V1      _IOWR(DM_IOCTL, DM_DEV_DEPS_CMD_V1, struct dm_ioctl)
#define DM_DEV_STATUS_V1    _IOWR(DM_IOCTL, DM_DEV_STATUS_CMD_V1, struct dm_ioctl)

#define DM_TARGET_STATUS_V1 _IOWR(DM_IOCTL, DM_TARGET_STATUS_CMD_V1, struct dm_ioctl)
#define DM_TARGET_WAIT_V1   _IOWR(DM_IOCTL, DM_TARGET_WAIT_CMD_V1, struct dm_ioctl)

/* *INDENT-OFF* */
static struct cmd_data _cmd_data_v1[] = {
	{ "create",	DM_DEV_CREATE_V1,	{1, 0, 0} },
	{ "reload",	DM_DEV_RELOAD_V1,	{1, 0, 0} },
	{ "remove",	DM_DEV_REMOVE_V1,	{1, 0, 0} },
	{ "remove_all",	DM_REMOVE_ALL_V1,	{1, 0, 0} },
	{ "suspend",	DM_DEV_SUSPEND_V1,	{1, 0, 0} },
	{ "resume",	DM_DEV_SUSPEND_V1,	{1, 0, 0} },
	{ "info",	DM_DEV_STATUS_V1,	{1, 0, 0} },
	{ "deps",	DM_DEV_DEPS_V1,		{1, 0, 0} },
	{ "rename",	DM_DEV_RENAME_V1,	{1, 0, 0} },
	{ "version",	DM_VERSION_V1,		{1, 0, 0} },
	{ "status",	DM_TARGET_STATUS_V1,	{1, 0, 0} },
	{ "table",	DM_TARGET_STATUS_V1,	{1, 0, 0} },
	{ "waitevent",	DM_TARGET_WAIT_V1,	{1, 0, 0} },
	{ "names",	0,			{4, 0, 0} },
	{ "clear",	0,			{4, 0, 0} },
	{ "mknodes",	0,			{4, 0, 0} },
	{ "versions",	0,			{4, 1, 0} },
	{ "message",	0,			{4, 2, 0} },
	{ "setgeometry",0,			{4, 6, 0} },
};
/* *INDENT-ON* */

#endif