import source from lvm2 2.02.79
[external/device-mapper.git] / libdm / ioctl / libdm-targets.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 LIB_DMTARGETS_H
17 #define LIB_DMTARGETS_H
18
19 #include <inttypes.h>
20 #include <sys/types.h>
21
22 struct dm_ioctl;
23 struct dm_ioctl_v1;
24
25 struct target {
26         uint64_t start;
27         uint64_t length;
28         char *type;
29         char *params;
30
31         struct target *next;
32 };
33
34 struct dm_task {
35         int type;
36         char *dev_name;
37
38         struct target *head, *tail;
39
40         int read_only;
41         uint32_t event_nr;
42         int major;
43         int minor;
44         int allow_default_major_fallback;
45         uid_t uid;
46         gid_t gid;
47         mode_t mode;
48         uint32_t read_ahead;
49         uint32_t read_ahead_flags;
50         union {
51                 struct dm_ioctl *v4;
52                 struct dm_ioctl_v1 *v1;
53         } dmi;
54         char *newname;
55         char *message;
56         char *geometry;
57         uint64_t sector;
58         int no_flush;
59         int no_open_count;
60         int skip_lockfs;
61         int query_inactive_table;
62         int suppress_identical_reload;
63         uint64_t existing_table_size;
64         int cookie_set;
65         int new_uuid;
66
67         char *uuid;
68 };
69
70 struct cmd_data {
71         const char *name;
72         const int cmd;
73         const int version[3];
74 };
75
76 int dm_check_version(void);
77 uint64_t dm_task_get_existing_table_size(struct dm_task *dmt);
78
79 #endif