]>
git.ipfire.org Git - thirdparty/xfsprogs-dev.git/blob - include/command.h
2 * Copyright (c) 2000-2005 Silicon Graphics, Inc.
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.
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.
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
24 * A "oneshot" command ony runs once per command execution. It does
25 * not iterate the command args function callout and so can be used
26 * for functions like "help" that should only ever be run once.
28 #define CMD_FLAG_ONESHOT (1<<31)
29 #define CMD_FLAG_FOREIGN_OK (1<<30) /* command not restricted to XFS */
30 #define CMD_FLAG_LIBRARY (1<<29) /* command provided by libxcmd */
32 typedef int (*cfunc_t
)(int argc
, char **argv
);
33 typedef void (*helpfunc_t
)(void);
35 typedef struct cmdinfo
{
48 extern cmdinfo_t
*cmdtab
;
51 extern void help_init(void);
52 extern void quit_init(void);
54 typedef int (*iterfunc_t
)(int index
);
55 typedef int (*checkfunc_t
)(const cmdinfo_t
*ci
);
57 extern void add_command(const cmdinfo_t
*ci
);
58 extern void add_user_command(char *optarg
);
59 extern void add_oneshot_user_command(char *optarg
);
60 extern void add_command_iterator(iterfunc_t func
);
61 extern void add_check_command(checkfunc_t cf
);
63 extern const cmdinfo_t
*find_command(const char *cmd
);
65 extern void command_loop(void);
66 extern int command_usage(const cmdinfo_t
*ci
);
67 extern int command(const cmdinfo_t
*ci
, int argc
, char **argv
);
69 extern void report_io_times(const char *verb
, struct timeval
*t2
,
70 long long offset
, long long count
,
71 long long total
, int ops
, int compact
);
73 #endif /* __COMMAND_H__ */