]>
sourceware.org Git - lvm2.git/blob - tools/tools.h
2 * Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
3 * Copyright (C) 2004-2007 Red Hat, Inc. All rights reserved.
5 * This file is part of LVM2.
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.
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
20 #define _FILE_OFFSET_BITS 64
22 #include "configure.h"
24 #include "libdevmapper.h"
26 #include "lvm-types.h"
27 #include "lvm-logging.h"
34 #include "dev-cache.h"
39 #include "filter-composite.h"
40 #include "filter-persistent.h"
41 #include "filter-regex.h"
42 #include "metadata-exported.h"
46 #include "lvm-string.h"
49 #include "toolcontext.h"
57 #include <sys/types.h>
62 /* command functions */
63 typedef int (*command_fn
) (struct cmd_context
* cmd
, int argc
, char **argv
);
65 #define xx(a, b...) int a(struct cmd_context *cmd, int argc, char **argv);
69 /* define the enums for the command line switches */
71 #define arg(a, b, c, d, e) a ,
91 #define ARG_COUNTABLE 0x00000001 /* E.g. -vvvv */
92 #define ARG_GROUPABLE 0x00000002 /* E.g. --addtag */
102 percent_type_t percent
;
103 /* void *ptr; // Currently not used. */
106 /* a global table of possible arguments */
108 const char short_arg
;
110 const char *long_arg
;
112 int (*fn
) (struct cmd_context
*cmd
, struct arg_values
*av
);
116 struct arg_value_group_list
{
118 struct arg_values arg_values
[0];
121 #define CACHE_VGMETADATA 0x00000001
122 #define PERMITTED_READ_ONLY 0x00000002
124 /* a register of the lvm commands */
137 void usage(const char *name
);
139 /* the argument verify/normalise functions */
140 int yes_no_arg(struct cmd_context
*cmd
, struct arg_values
*av
);
141 int yes_no_excl_arg(struct cmd_context
*cmd
, struct arg_values
*av
);
142 int size_kb_arg(struct cmd_context
*cmd
, struct arg_values
*av
);
143 int size_mb_arg(struct cmd_context
*cmd
, struct arg_values
*av
);
144 int int_arg(struct cmd_context
*cmd
, struct arg_values
*av
);
145 int int_arg_with_sign(struct cmd_context
*cmd
, struct arg_values
*av
);
146 int int_arg_with_sign_and_percent(struct cmd_context
*cmd
, struct arg_values
*av
);
147 int major_arg(struct cmd_context
*cmd
, struct arg_values
*av
);
148 int minor_arg(struct cmd_context
*cmd
, struct arg_values
*av
);
149 int string_arg(struct cmd_context
*cmd
, struct arg_values
*av
);
150 int tag_arg(struct cmd_context
*cmd
, struct arg_values
*av
);
151 int permission_arg(struct cmd_context
*cmd
, struct arg_values
*av
);
152 int metadatatype_arg(struct cmd_context
*cmd
, struct arg_values
*av
);
153 int units_arg(struct cmd_context
*cmd
, struct arg_values
*av
);
154 int segtype_arg(struct cmd_context
*cmd
, struct arg_values
*av
);
155 int alloc_arg(struct cmd_context
*cmd
, struct arg_values
*av
);
156 int readahead_arg(struct cmd_context
*cmd
, struct arg_values
*av
);
157 int metadatacopies_arg(struct cmd_context
*cmd
__attribute__((unused
)), struct arg_values
*av
);
159 /* we use the enums to access the switches */
160 unsigned arg_count(const struct cmd_context
*cmd
, int a
);
161 unsigned arg_is_set(const struct cmd_context
*cmd
, int a
);
162 const char *arg_value(struct cmd_context
*cmd
, int a
);
163 const char *arg_str_value(struct cmd_context
*cmd
, int a
, const char *def
);
164 int32_t arg_int_value(struct cmd_context
*cmd
, int a
, const int32_t def
);
165 uint32_t arg_uint_value(struct cmd_context
*cmd
, int a
, const uint32_t def
);
166 int64_t arg_int64_value(struct cmd_context
*cmd
, int a
, const int64_t def
);
167 uint64_t arg_uint64_value(struct cmd_context
*cmd
, int a
, const uint64_t def
);
168 const void *arg_ptr_value(struct cmd_context
*cmd
, int a
, const void *def
);
169 sign_t
arg_sign_value(struct cmd_context
*cmd
, int a
, const sign_t def
);
170 percent_type_t
arg_percent_value(struct cmd_context
*cmd
, int a
, const percent_type_t def
);
171 int arg_count_increment(struct cmd_context
*cmd
, int a
);
173 unsigned grouped_arg_count(const struct arg_values
*av
, int a
);
174 unsigned grouped_arg_is_set(const struct arg_values
*av
, int a
);
175 const char *grouped_arg_str_value(const struct arg_values
*av
, int a
, const char *def
);
177 const char *command_name(struct cmd_context
*cmd
);
179 int pvmove_poll(struct cmd_context
*cmd
, const char *pv
, unsigned background
);
180 int lvconvert_poll(struct cmd_context
*cmd
, struct logical_volume
*lv
, unsigned background
);
182 int mirror_remove_missing(struct cmd_context
*cmd
,
183 struct logical_volume
*lv
, int force
);
185 uint32_t percent_of_extents(uint32_t percents
, uint32_t count
, int roundup
);
This page took 0.043907 seconds and 5 git commands to generate.