block/export: avoid g_return_val_if() input validation
[qemu/kevin.git] / include / qemu-io.h
blob3af513004a686bc67f18f9b0be3760c1246a7038
1 /*
2 * Copyright (c) 2000-2005 Silicon Graphics, Inc.
3 * All Rights Reserved.
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, see <http://www.gnu.org/licenses/>.
18 #ifndef QEMU_IO_H
19 #define QEMU_IO_H
22 #define CMD_FLAG_GLOBAL ((int)0x80000000) /* don't iterate "args" */
24 /* Implement a qemu-io command.
25 * Operate on @blk using @argc/@argv as the command's arguments, and
26 * return 0 on success or negative errno on failure.
28 typedef int (*cfunc_t)(BlockBackend *blk, int argc, char **argv);
30 typedef void (*helpfunc_t)(void);
32 typedef struct cmdinfo {
33 const char* name;
34 const char* altname;
35 cfunc_t cfunc;
36 int argmin;
37 int argmax;
38 int canpush;
39 int flags;
40 const char *args;
41 const char *oneline;
42 helpfunc_t help;
43 uint64_t perm;
44 } cmdinfo_t;
46 extern bool qemuio_misalign;
48 int qemuio_command(BlockBackend *blk, const char *cmd);
50 void qemuio_add_command(const cmdinfo_t *ci);
51 void qemuio_command_usage(const cmdinfo_t *ci);
52 void qemuio_complete_command(const char *input,
53 void (*fn)(const char *cmd, void *opaque),
54 void *opaque);
56 #endif /* QEMU_IO_H */