2 * lxc: linux Container library
4 * (C) Copyright IBM Corp. 2007, 2008
7 * Daniel Lezcano <daniel.lezcano at free.fr>
8 * Michel Normand <normand at fr.ibm.com>
10 * This library is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU Lesser General Public
12 * License as published by the Free Software Foundation; either
13 * version 2.1 of the License, or (at your option) any later version.
15 * This library is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 * Lesser General Public License for more details.
20 * You should have received a copy of the GNU Lesser General Public
21 * License along with this library; if not, write to the Free Software
22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
25 #ifndef __LXC_ARGUMENTS_H
26 #define __LXC_ARGUMENTS_H
31 #include <sys/types.h>
35 typedef int (*lxc_arguments_parser_t
)(struct lxc_arguments
*, int, char *);
36 typedef int (*lxc_arguments_checker_t
)(const struct lxc_arguments
*);
38 struct lxc_arguments
{
40 void (*helpfn
)(const struct lxc_arguments
*);
42 const struct option
*options
;
43 lxc_arguments_parser_t parser
;
44 lxc_arguments_checker_t checker
;
53 const char *console_log
;
57 /* set to 0 to accept only 1 lxcpath, -1 for unlimited */
58 int lxcpath_additional
;
61 const char *share_ns
[32]; /* size must be greater than LXC_NS_MAX */
71 /* for lxc-autostart */
84 /* close fds from parent? */
88 char *bdevtype
, *configfile
, *template;
91 char *lvname
, *vgname
, *thinpool
;
92 char *rbdname
, *rbdpool
;
93 char *zfsroot
, *lowerdir
, *dir
;
103 char *groups
; /* also used by lxc-ls */
105 /* lxc-snapshot and lxc-copy */
124 char *ls_fancy_format
;
126 unsigned int ls_nesting
; /* maximum allowed nesting level */
138 /* remaining arguments */
142 /* private arguments */
146 #define LXC_COMMON_OPTIONS \
147 { "name", required_argument, 0, 'n' }, \
148 { "help", no_argument, 0, 'h' }, \
149 { "usage", no_argument, 0, OPT_USAGE }, \
150 { "version", no_argument, 0, OPT_VERSION }, \
151 { "quiet", no_argument, 0, 'q' }, \
152 { "logfile", required_argument, 0, 'o' }, \
153 { "logpriority", required_argument, 0, 'l' }, \
154 { "lxcpath", required_argument, 0, 'P' }, \
155 { "rcfile", required_argument, 0, OPT_RCFILE }, \
158 /* option keys for long only options */
159 #define OPT_USAGE 0x1000
160 #define OPT_VERSION OPT_USAGE - 1
161 #define OPT_RCFILE OPT_USAGE - 2
163 extern int lxc_arguments_parse(struct lxc_arguments
*args
, int argc
,
166 extern int lxc_arguments_str_to_int(struct lxc_arguments
*args
,
169 #define lxc_error(arg, fmt, args...) \
171 fprintf(stderr, "%s: " fmt "\n", (arg)->progname, ##args)
173 #endif /* __LXC_ARGUMENTS_H */