]>
git.ipfire.org Git - thirdparty/xfsprogs-dev.git/blob - include/command.h
1 // SPDX-License-Identifier: GPL-2.0
3 * Copyright (c) 2000-2005 Silicon Graphics, Inc.
12 * A "oneshot" command ony runs once per command execution. It does
13 * not iterate the command args function callout and so can be used
14 * for functions like "help" that should only ever be run once.
16 #define CMD_FLAG_ONESHOT (1u << 31)
17 #define CMD_FLAG_FOREIGN_OK (1u << 30) /* command not restricted to XFS */
18 #define CMD_FLAG_LIBRARY (1u << 29) /* command provided by libxcmd */
20 typedef int (*cfunc_t
)(int argc
, char **argv
);
21 typedef void (*helpfunc_t
)(void);
23 typedef struct cmdinfo
{
36 extern cmdinfo_t
*cmdtab
;
39 extern void help_init(void);
40 extern void quit_init(void);
42 typedef int (*iterfunc_t
)(int index
);
43 typedef int (*checkfunc_t
)(const cmdinfo_t
*ci
);
45 extern void add_command(const cmdinfo_t
*ci
);
46 extern void add_user_command(char *optarg
);
47 extern void add_oneshot_user_command(char *optarg
);
48 extern void add_command_iterator(iterfunc_t func
);
49 extern void add_check_command(checkfunc_t cf
);
51 extern const cmdinfo_t
*find_command(const char *cmd
);
53 extern void command_loop(void);
54 extern int command_usage(const cmdinfo_t
*ci
);
55 extern int command(const cmdinfo_t
*ci
, int argc
, char **argv
);
57 extern void report_io_times(const char *verb
, struct timeval
*t2
,
58 long long offset
, long long count
,
59 long long total
, int ops
, int compact
);
61 #endif /* __COMMAND_H__ */