aboutsummaryrefslogtreecommitdiff
path: root/cmd.h
diff options
context:
space:
mode:
authorKevin Wolf <kwolf@redhat.com>2013-06-05 14:19:30 +0200
committerStefan Hajnoczi <stefanha@redhat.com>2013-06-06 11:27:04 +0200
commit734c3b85cb72d264ad2b38a87f30304e05de2cb1 (patch)
treeaad868657469551e947b5279a2d88bca03ddff9f /cmd.h
parentcf49a6a00c19cabf4006d4f82bef26345043e7b5 (diff)
qemu-io: Don't use global bs in command implementations
Pass in the BlockDriverState to the command handlers instead of using the global variable. This is an important step to make the commands usable outside of qemu-io. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Diffstat (limited to 'cmd.h')
-rw-r--r--cmd.h8
1 files changed, 6 insertions, 2 deletions
diff --git a/cmd.h b/cmd.h
index 4dcfe885a4..ccf6336e8e 100644
--- a/cmd.h
+++ b/cmd.h
@@ -17,9 +17,13 @@
#ifndef __COMMAND_H__
#define __COMMAND_H__
+#include "qemu-common.h"
+
#define CMD_FLAG_GLOBAL ((int)0x80000000) /* don't iterate "args" */
-typedef int (*cfunc_t)(int argc, char **argv);
+extern BlockDriverState *qemuio_bs;
+
+typedef int (*cfunc_t)(BlockDriverState *bs, int argc, char **argv);
typedef void (*helpfunc_t)(void);
typedef struct cmdinfo {
@@ -41,7 +45,7 @@ extern int ncmds;
void help_init(void);
void quit_init(void);
-typedef int (*checkfunc_t)(const cmdinfo_t *ci);
+typedef int (*checkfunc_t)(BlockDriverState *bs, const cmdinfo_t *ci);
void add_command(const cmdinfo_t *ci);
void add_user_command(char *optarg);