qemu-io.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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
  15. * along with this program; if not, see <http://www.gnu.org/licenses/>.
  16. */
  17. #ifndef QEMU_IO_H
  18. #define QEMU_IO_H
  19. #define CMD_FLAG_GLOBAL ((int)0x80000000) /* don't iterate "args" */
  20. /* Implement a qemu-io command.
  21. * Operate on @blk using @argc/@argv as the command's arguments, and
  22. * return 0 on success or negative errno on failure.
  23. */
  24. typedef int (*cfunc_t)(BlockBackend *blk, int argc, char **argv);
  25. typedef void (*helpfunc_t)(void);
  26. typedef struct cmdinfo {
  27. const char* name;
  28. const char* altname;
  29. cfunc_t cfunc;
  30. int argmin;
  31. int argmax;
  32. int canpush;
  33. int flags;
  34. const char *args;
  35. const char *oneline;
  36. helpfunc_t help;
  37. uint64_t perm;
  38. } cmdinfo_t;
  39. extern bool qemuio_misalign;
  40. int qemuio_command(BlockBackend *blk, const char *cmd);
  41. void qemuio_add_command(const cmdinfo_t *ci);
  42. void qemuio_command_usage(const cmdinfo_t *ci);
  43. void qemuio_complete_command(const char *input,
  44. void (*fn)(const char *cmd, void *opaque),
  45. void *opaque);
  46. #endif /* QEMU_IO_H */