thebeanogamer / rpms / qemu-kvm

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