]> Git Repo - qemu.git/blob - cmd.h
qemu-io: Split off commands to qemu-io-cmds.c
[qemu.git] / cmd.h
1 /*
2  * Copyright (c) 2000-2005 Silicon Graphics, Inc.
3  * All Rights Reserved.
4  *
5  * This program is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU General Public License as
7  * published by the Free Software Foundation.
8  *
9  * This program is distributed in the hope that it would be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, see <http://www.gnu.org/licenses/>.
16  */
17 #ifndef __COMMAND_H__
18 #define __COMMAND_H__
19
20 #include "qemu-common.h"
21
22 #define CMD_FLAG_GLOBAL ((int)0x80000000)       /* don't iterate "args" */
23
24 extern BlockDriverState *qemuio_bs;
25
26 typedef int (*cfunc_t)(BlockDriverState *bs, int argc, char **argv);
27 typedef void (*helpfunc_t)(void);
28
29 typedef struct cmdinfo {
30         const char      *name;
31         const char      *altname;
32         cfunc_t         cfunc;
33         int             argmin;
34         int             argmax;
35         int             canpush;
36         int             flags;
37         const char      *args;
38         const char      *oneline;
39         helpfunc_t      help;
40 } cmdinfo_t;
41
42 extern cmdinfo_t        *cmdtab;
43 extern int              ncmds;
44
45 void help_init(void);
46 void quit_init(void);
47
48 typedef int (*checkfunc_t)(BlockDriverState *bs, const cmdinfo_t *ci);
49
50 void add_command(const cmdinfo_t *ci);
51 void add_user_command(char *optarg);
52 void add_check_command(checkfunc_t cf);
53
54 const cmdinfo_t *find_command(const char *cmd);
55
56 void command_loop(void);
57 int command_usage(const cmdinfo_t *ci);
58 int command(const cmdinfo_t *ci, int argc, char **argv);
59
60 /* from input.h */
61 char **breakline(char *input, int *count);
62 void doneline(char *input, char **vec);
63 char *fetchline(void);
64
65 void cvtstr(double value, char *str, size_t sz);
66
67 struct timeval tsub(struct timeval t1, struct timeval t2);
68 double tdiv(double value, struct timeval tv);
69
70 enum {
71         DEFAULT_TIME            = 0x0,
72         TERSE_FIXED_TIME        = 0x1,
73         VERBOSE_FIXED_TIME      = 0x2
74 };
75
76 void timestr(struct timeval *tv, char *str, size_t sz, int flags);
77
78 extern char *progname;
79
80 #endif  /* __COMMAND_H__ */
This page took 0.025287 seconds and 4 git commands to generate.