]>
Commit | Line | Data |
---|---|---|
e246ba5f | 1 | /* |
f302e9e4 NS |
2 | * Copyright (c) 2000-2005 Silicon Graphics, Inc. |
3 | * All Rights Reserved. | |
dfc130f3 | 4 | * |
f302e9e4 NS |
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 | |
e246ba5f | 7 | * published by the Free Software Foundation. |
dfc130f3 | 8 | * |
f302e9e4 NS |
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. | |
dfc130f3 | 13 | * |
f302e9e4 NS |
14 | * You should have received a copy of the GNU General Public License |
15 | * along with this program; if not, write the Free Software Foundation, | |
16 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | |
e246ba5f | 17 | */ |
3d93ccb7 NS |
18 | #ifndef __COMMAND_H__ |
19 | #define __COMMAND_H__ | |
e246ba5f | 20 | |
a9b61ce9 DW |
21 | #include <sys/time.h> |
22 | ||
29647c8d BD |
23 | #define CMD_FLAG_GLOBAL (1<<31) /* don't iterate "args" */ |
24 | #define CMD_FLAG_FOREIGN_OK (1<<30) /* command not restricted to XFS */ | |
802d66e3 | 25 | |
e246ba5f NS |
26 | typedef int (*cfunc_t)(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; | |
48c46ee3 | 36 | int flags; |
e246ba5f NS |
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 | ||
3d93ccb7 NS |
45 | extern void help_init(void); |
46 | extern void quit_init(void); | |
47 | ||
48 | typedef int (*argsfunc_t)(int index); | |
49 | typedef int (*checkfunc_t)(const cmdinfo_t *ci); | |
50 | ||
e246ba5f | 51 | extern void add_command(const cmdinfo_t *ci); |
3d93ccb7 NS |
52 | extern void add_user_command(char *optarg); |
53 | extern void add_args_command(argsfunc_t af); | |
54 | extern void add_check_command(checkfunc_t cf); | |
55 | ||
56 | extern const cmdinfo_t *find_command(const char *cmd); | |
57 | ||
58 | extern void command_loop(void); | |
48c46ee3 | 59 | extern int command_usage(const cmdinfo_t *ci); |
802d66e3 | 60 | extern int command(const cmdinfo_t *ci, int argc, char **argv); |
e246ba5f | 61 | |
a9b61ce9 DW |
62 | extern void report_io_times(const char *verb, struct timeval *t2, |
63 | long long offset, long long count, | |
64 | long long total, int ops, int compact); | |
65 | ||
3d93ccb7 | 66 | #endif /* __COMMAND_H__ */ |