Skip to content

Commit

Permalink
qemu-io: Let command functions return error code
Browse files Browse the repository at this point in the history
This is basically what everything else in the qemu code base does, so we
can do it here, too.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-id: 20180509194302.21585-3-mreitz@redhat.com
Signed-off-by: Max Reitz <mreitz@redhat.com>
  • Loading branch information
XanClic committed Jun 11, 2018
1 parent b444d0e commit b32d7a3
Show file tree
Hide file tree
Showing 3 changed files with 232 additions and 157 deletions.
9 changes: 7 additions & 2 deletions include/qemu-io.h
Expand Up @@ -22,7 +22,12 @@

#define CMD_FLAG_GLOBAL ((int)0x80000000) /* don't iterate "args" */

typedef void (*cfunc_t)(BlockBackend *blk, int argc, char **argv);
/* Implement a qemu-io command.
* Operate on @blk using @argc/@argv as the command's arguments, and
* return 0 on success or negative errno on failure.
*/
typedef int (*cfunc_t)(BlockBackend *blk, int argc, char **argv);

typedef void (*helpfunc_t)(void);

typedef struct cmdinfo {
Expand All @@ -41,7 +46,7 @@ typedef struct cmdinfo {

extern bool qemuio_misalign;

void qemuio_command(BlockBackend *blk, const char *cmd);
int qemuio_command(BlockBackend *blk, const char *cmd);

void qemuio_add_command(const cmdinfo_t *ci);
void qemuio_command_usage(const cmdinfo_t *ci);
Expand Down

0 comments on commit b32d7a3

Please sign in to comment.