13d21994fSKevin Wolf /* 23d21994fSKevin Wolf * Copyright (c) 2000-2005 Silicon Graphics, Inc. 33d21994fSKevin Wolf * All Rights Reserved. 43d21994fSKevin Wolf * 53d21994fSKevin Wolf * This program is free software; you can redistribute it and/or 63d21994fSKevin Wolf * modify it under the terms of the GNU General Public License as 73d21994fSKevin Wolf * published by the Free Software Foundation. 83d21994fSKevin Wolf * 93d21994fSKevin Wolf * This program is distributed in the hope that it would be useful, 103d21994fSKevin Wolf * but WITHOUT ANY WARRANTY; without even the implied warranty of 113d21994fSKevin Wolf * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 123d21994fSKevin Wolf * GNU General Public License for more details. 133d21994fSKevin Wolf * 143d21994fSKevin Wolf * You should have received a copy of the GNU General Public License 153d21994fSKevin Wolf * along with this program; if not, see <http://www.gnu.org/licenses/>. 163d21994fSKevin Wolf */ 173d21994fSKevin Wolf 183d21994fSKevin Wolf #ifndef QEMU_IO_H 193d21994fSKevin Wolf #define QEMU_IO_H 203d21994fSKevin Wolf 213d21994fSKevin Wolf 223d21994fSKevin Wolf #define CMD_FLAG_GLOBAL ((int)0x80000000) /* don't iterate "args" */ 233d21994fSKevin Wolf 24*b32d7a39SMax Reitz /* Implement a qemu-io command. 25*b32d7a39SMax Reitz * Operate on @blk using @argc/@argv as the command's arguments, and 26*b32d7a39SMax Reitz * return 0 on success or negative errno on failure. 27*b32d7a39SMax Reitz */ 28*b32d7a39SMax Reitz typedef int (*cfunc_t)(BlockBackend *blk, int argc, char **argv); 29*b32d7a39SMax Reitz 303d21994fSKevin Wolf typedef void (*helpfunc_t)(void); 313d21994fSKevin Wolf 323d21994fSKevin Wolf typedef struct cmdinfo { 333d21994fSKevin Wolf const char* name; 343d21994fSKevin Wolf const char* altname; 353d21994fSKevin Wolf cfunc_t cfunc; 363d21994fSKevin Wolf int argmin; 373d21994fSKevin Wolf int argmax; 383d21994fSKevin Wolf int canpush; 393d21994fSKevin Wolf int flags; 403d21994fSKevin Wolf const char *args; 413d21994fSKevin Wolf const char *oneline; 423d21994fSKevin Wolf helpfunc_t help; 43887354bdSKevin Wolf uint64_t perm; 443d21994fSKevin Wolf } cmdinfo_t; 453d21994fSKevin Wolf 46f9883880SStefan Weil extern bool qemuio_misalign; 47f9883880SStefan Weil 48*b32d7a39SMax Reitz int qemuio_command(BlockBackend *blk, const char *cmd); 493d21994fSKevin Wolf 503d21994fSKevin Wolf void qemuio_add_command(const cmdinfo_t *ci); 51b444d0e9SMax Reitz void qemuio_command_usage(const cmdinfo_t *ci); 524694020dSStefan Hajnoczi void qemuio_complete_command(const char *input, 534694020dSStefan Hajnoczi void (*fn)(const char *cmd, void *opaque), 544694020dSStefan Hajnoczi void *opaque); 553d21994fSKevin Wolf 563d21994fSKevin Wolf #endif /* QEMU_IO_H */ 57