|
|
9ae3a8 |
From 6ea43a1599b4abdfe480d6e963dbbafa9339601a Mon Sep 17 00:00:00 2001
|
|
|
9ae3a8 |
From: John Snow <jsnow@redhat.com>
|
|
|
9ae3a8 |
Date: Mon, 23 Nov 2015 17:38:28 +0100
|
|
|
9ae3a8 |
Subject: [PATCH 09/27] qemu-io: Move 'quit' function
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
RH-Author: John Snow <jsnow@redhat.com>
|
|
|
9ae3a8 |
Message-id: <1448300320-7772-10-git-send-email-jsnow@redhat.com>
|
|
|
9ae3a8 |
Patchwork-id: 68436
|
|
|
9ae3a8 |
O-Subject: [RHEL-7.3 qemu-kvm PATCH v2 09/21] qemu-io: Move 'quit' function
|
|
|
9ae3a8 |
Bugzilla: 1272523
|
|
|
9ae3a8 |
RH-Acked-by: Thomas Huth <thuth@redhat.com>
|
|
|
9ae3a8 |
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
|
|
|
9ae3a8 |
RH-Acked-by: Max Reitz <mreitz@redhat.com>
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
From: Kevin Wolf <kwolf@redhat.com>
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
This one only makes sense in the context of the qemu-io tool, so move it
|
|
|
9ae3a8 |
to qemu-io.c. Adapt coding style and register it like other commands.
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
|
|
9ae3a8 |
Reviewed-by: Eric Blake <eblake@redhat.com>
|
|
|
9ae3a8 |
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
|
|
|
9ae3a8 |
(cherry picked from commit e681be7eca0143fe7259ce8233fe5dd8898d072f)
|
|
|
9ae3a8 |
Signed-off-by: John Snow <jsnow@redhat.com>
|
|
|
9ae3a8 |
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
9ae3a8 |
---
|
|
|
9ae3a8 |
cmd.c | 29 -----------------------------
|
|
|
9ae3a8 |
cmd.h | 2 --
|
|
|
9ae3a8 |
qemu-io.c | 17 ++++++++++++++++-
|
|
|
9ae3a8 |
3 files changed, 16 insertions(+), 32 deletions(-)
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
diff --git a/cmd.c b/cmd.c
|
|
|
9ae3a8 |
index 2941ad3..8496e74 100644
|
|
|
9ae3a8 |
--- a/cmd.c
|
|
|
9ae3a8 |
+++ b/cmd.c
|
|
|
9ae3a8 |
@@ -410,32 +410,3 @@ timestr(
|
|
|
9ae3a8 |
snprintf(ts, size, "0.%04u sec", (unsigned int) (usec * 10000));
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
-
|
|
|
9ae3a8 |
-
|
|
|
9ae3a8 |
-/* from libxcmd/quit.c */
|
|
|
9ae3a8 |
-
|
|
|
9ae3a8 |
-static cmdinfo_t quit_cmd;
|
|
|
9ae3a8 |
-
|
|
|
9ae3a8 |
-/* ARGSUSED */
|
|
|
9ae3a8 |
-static int
|
|
|
9ae3a8 |
-quit_f(
|
|
|
9ae3a8 |
- BlockDriverState *bs,
|
|
|
9ae3a8 |
- int argc,
|
|
|
9ae3a8 |
- char **argv)
|
|
|
9ae3a8 |
-{
|
|
|
9ae3a8 |
- return 1;
|
|
|
9ae3a8 |
-}
|
|
|
9ae3a8 |
-
|
|
|
9ae3a8 |
-void
|
|
|
9ae3a8 |
-quit_init(void)
|
|
|
9ae3a8 |
-{
|
|
|
9ae3a8 |
- quit_cmd.name = _("quit");
|
|
|
9ae3a8 |
- quit_cmd.altname = _("q");
|
|
|
9ae3a8 |
- quit_cmd.cfunc = quit_f;
|
|
|
9ae3a8 |
- quit_cmd.argmin = -1;
|
|
|
9ae3a8 |
- quit_cmd.argmax = -1;
|
|
|
9ae3a8 |
- quit_cmd.flags = CMD_FLAG_GLOBAL;
|
|
|
9ae3a8 |
- quit_cmd.oneline = _("exit the program");
|
|
|
9ae3a8 |
-
|
|
|
9ae3a8 |
- add_command(&quit_cmd);
|
|
|
9ae3a8 |
-}
|
|
|
9ae3a8 |
diff --git a/cmd.h b/cmd.h
|
|
|
9ae3a8 |
index 89e7c6e..5b6f61b 100644
|
|
|
9ae3a8 |
--- a/cmd.h
|
|
|
9ae3a8 |
+++ b/cmd.h
|
|
|
9ae3a8 |
@@ -42,8 +42,6 @@ typedef struct cmdinfo {
|
|
|
9ae3a8 |
extern cmdinfo_t *cmdtab;
|
|
|
9ae3a8 |
extern int ncmds;
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
-void quit_init(void);
|
|
|
9ae3a8 |
-
|
|
|
9ae3a8 |
typedef int (*checkfunc_t)(BlockDriverState *bs, const cmdinfo_t *ci);
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
void add_command(const cmdinfo_t *ci);
|
|
|
9ae3a8 |
diff --git a/qemu-io.c b/qemu-io.c
|
|
|
9ae3a8 |
index 4f1c808..b86bfbf 100644
|
|
|
9ae3a8 |
--- a/qemu-io.c
|
|
|
9ae3a8 |
+++ b/qemu-io.c
|
|
|
9ae3a8 |
@@ -170,6 +170,21 @@ static int open_f(BlockDriverState *bs, int argc, char **argv)
|
|
|
9ae3a8 |
return openfile(argv[optind], flags, growable, opts);
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
+static int quit_f(BlockDriverState *bs, int argc, char **argv)
|
|
|
9ae3a8 |
+{
|
|
|
9ae3a8 |
+ return 1;
|
|
|
9ae3a8 |
+}
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
+static const cmdinfo_t quit_cmd = {
|
|
|
9ae3a8 |
+ .name = "quit",
|
|
|
9ae3a8 |
+ .altname = "q",
|
|
|
9ae3a8 |
+ .cfunc = quit_f,
|
|
|
9ae3a8 |
+ .argmin = -1,
|
|
|
9ae3a8 |
+ .argmax = -1,
|
|
|
9ae3a8 |
+ .flags = CMD_FLAG_GLOBAL,
|
|
|
9ae3a8 |
+ .oneline = "exit the program",
|
|
|
9ae3a8 |
+};
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
static void usage(const char *name)
|
|
|
9ae3a8 |
{
|
|
|
9ae3a8 |
printf(
|
|
|
9ae3a8 |
@@ -285,7 +300,7 @@ int main(int argc, char **argv)
|
|
|
9ae3a8 |
bdrv_init();
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
/* initialize commands */
|
|
|
9ae3a8 |
- quit_init();
|
|
|
9ae3a8 |
+ add_command(&quit_cmd);
|
|
|
9ae3a8 |
add_command(&open_cmd);
|
|
|
9ae3a8 |
add_command(&close_cmd);
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
--
|
|
|
9ae3a8 |
1.8.3.1
|
|
|
9ae3a8 |
|