]> git.proxmox.com Git - mirror_qemu.git/blame - include/qemu-io.h
vhost-user-blk: add discard/write zeroes features support
[mirror_qemu.git] / include / qemu-io.h
CommitLineData
e3aff4f6
AL
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
8167ee88 15 * along with this program; if not, see <http://www.gnu.org/licenses/>.
e3aff4f6 16 */
e3aff4f6 17
3d21994f
KW
18#ifndef QEMU_IO_H
19#define QEMU_IO_H
734c3b85 20
3d21994f 21#include "qemu-common.h"
e3aff4f6 22
3d21994f 23#define CMD_FLAG_GLOBAL ((int)0x80000000) /* don't iterate "args" */
734c3b85 24
b32d7a39
HR
25/* Implement a qemu-io command.
26 * Operate on @blk using @argc/@argv as the command's arguments, and
27 * return 0 on success or negative errno on failure.
28 */
29typedef int (*cfunc_t)(BlockBackend *blk, int argc, char **argv);
30
e3aff4f6
AL
31typedef void (*helpfunc_t)(void);
32
33typedef struct cmdinfo {
3d21994f
KW
34 const char* name;
35 const char* altname;
36 cfunc_t cfunc;
37 int argmin;
38 int argmax;
39 int canpush;
40 int flags;
41 const char *args;
42 const char *oneline;
43 helpfunc_t help;
887354bd 44 uint64_t perm;
e3aff4f6
AL
45} cmdinfo_t;
46
f9883880
SW
47extern bool qemuio_misalign;
48
b32d7a39 49int qemuio_command(BlockBackend *blk, const char *cmd);
e3aff4f6 50
3d21994f 51void qemuio_add_command(const cmdinfo_t *ci);
b444d0e9 52void qemuio_command_usage(const cmdinfo_t *ci);
4694020d
SH
53void qemuio_complete_command(const char *input,
54 void (*fn)(const char *cmd, void *opaque),
55 void *opaque);
e3aff4f6 56
3d21994f 57#endif /* QEMU_IO_H */