4 * Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
5 * Copyright (C) 2004-2007 Red Hat, Inc. All rights reserved.
7 * This file is part of LVM2.
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.
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
22 #define _FILE_OFFSET_BITS 64
24 #include <configure.h>
26 #include <libdevmapper.h>
28 #include "lvm-types.h"
29 #include "lvm-logging.h"
35 #include "dev-cache.h"
40 #include "filter-composite.h"
41 #include "filter-persistent.h"
42 #include "filter-regex.h"
43 #include "metadata-exported.h"
47 #include "lvm-string.h"
50 #include "toolcontext.h"
58 #include <sys/types.h>
63 /* command functions */
64 typedef int (*command_fn
) (struct cmd_context
* cmd
, int argc
, char **argv
);
66 #define xx(a, b...) int a(struct cmd_context *cmd, int argc, char **argv);
70 /* define the enums for the command line switches */
72 #define arg(a, b, c, d, e) a ,
99 #define ARG_REPEATABLE 0x00000001
101 /* a global table of possible arguments */
103 const char short_arg
;
105 const char *long_arg
;
107 int (*fn
) (struct cmd_context
* cmd
, struct arg
* a
);
121 #define CACHE_VGMETADATA 0x00000001
123 /* a register of the lvm commands */
136 void usage(const char *name
);
138 /* the argument verify/normalise functions */
139 int yes_no_arg(struct cmd_context
*cmd
, struct arg
*a
);
140 int yes_no_excl_arg(struct cmd_context
*cmd
, struct arg
*a
);
141 int size_kb_arg(struct cmd_context
*cmd
, struct arg
*a
);
142 int size_mb_arg(struct cmd_context
*cmd
, struct arg
*a
);
143 int int_arg(struct cmd_context
*cmd
, struct arg
*a
);
144 int int_arg_with_sign(struct cmd_context
*cmd
, struct arg
*a
);
145 int int_arg_with_sign_and_percent(struct cmd_context
*cmd
, struct arg
*a
);
146 int major_arg(struct cmd_context
*cmd
, struct arg
*a
);
147 int minor_arg(struct cmd_context
*cmd
, struct arg
*a
);
148 int string_arg(struct cmd_context
*cmd
, struct arg
*a
);
149 int tag_arg(struct cmd_context
*cmd
, struct arg
*a
);
150 int permission_arg(struct cmd_context
*cmd
, struct arg
*a
);
151 int metadatatype_arg(struct cmd_context
*cmd
, struct arg
*a
);
152 int units_arg(struct cmd_context
*cmd
, struct arg
*a
);
153 int segtype_arg(struct cmd_context
*cmd
, struct arg
*a
);
154 int alloc_arg(struct cmd_context
*cmd
, struct arg
*a
);
155 int readahead_arg(struct cmd_context
*cmd
, struct arg
*a
);
157 /* we use the enums to access the switches */
158 unsigned arg_count(const struct cmd_context
*cmd
, int a
);
159 unsigned arg_is_set(const struct cmd_context
*cmd
, int a
);
160 const char *arg_value(struct cmd_context
*cmd
, int a
);
161 const char *arg_str_value(struct cmd_context
*cmd
, int a
, const char *def
);
162 int32_t arg_int_value(struct cmd_context
*cmd
, int a
, const int32_t def
);
163 uint32_t arg_uint_value(struct cmd_context
*cmd
, int a
, const uint32_t def
);
164 int64_t arg_int64_value(struct cmd_context
*cmd
, int a
, const int64_t def
);
165 uint64_t arg_uint64_value(struct cmd_context
*cmd
, int a
, const uint64_t def
);
166 const void *arg_ptr_value(struct cmd_context
*cmd
, int a
, const void *def
);
167 sign_t
arg_sign_value(struct cmd_context
*cmd
, int a
, const sign_t def
);
168 percent_t
arg_percent_value(struct cmd_context
*cmd
, int a
, const percent_t def
);
169 int arg_count_increment(struct cmd_context
*cmd
, int a
);
171 const char *command_name(struct cmd_context
*cmd
);
173 int pvmove_poll(struct cmd_context
*cmd
, const char *pv
, unsigned background
);
174 int lvconvert_poll(struct cmd_context
*cmd
, struct logical_volume
*lv
, unsigned background
);