thebeanogamer / rpms / qemu-kvm

Forked from rpms/qemu-kvm 5 months ago
Clone
34b321
From d16c34d6dc39a159326efda97101aed3c1481812 Mon Sep 17 00:00:00 2001
34b321
From: John Snow <jsnow@redhat.com>
34b321
Date: Mon, 23 Nov 2015 17:38:20 +0100
34b321
Subject: [PATCH 01/27] qemu-io: Remove unused args_command
34b321
34b321
RH-Author: John Snow <jsnow@redhat.com>
34b321
Message-id: <1448300320-7772-2-git-send-email-jsnow@redhat.com>
34b321
Patchwork-id: 68429
34b321
O-Subject: [RHEL-7.3 qemu-kvm PATCH v2 01/21] qemu-io: Remove unused args_command
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
The original intention seems to be something with handling multiple
34b321
images at once, but this has never been implemented and the only
34b321
function ever registered is implemented to make everything behave like a
34b321
"global" command. Just do that unconditionally now.
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 a23818f4ff3d7981f49453b739f589e4205930b5)
34b321
Signed-off-by: John Snow <jsnow@redhat.com>
34b321
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
34b321
---
34b321
 cmd.c     | 28 ++--------------------------
34b321
 cmd.h     |  2 --
34b321
 qemu-io.c | 10 ----------
34b321
 3 files changed, 2 insertions(+), 38 deletions(-)
34b321
34b321
diff --git a/cmd.c b/cmd.c
34b321
index 10a8688..4e7579b 100644
34b321
--- a/cmd.c
34b321
+++ b/cmd.c
34b321
@@ -34,7 +34,6 @@
34b321
 cmdinfo_t	*cmdtab;
34b321
 int		ncmds;
34b321
 
34b321
-static argsfunc_t	args_func;
34b321
 static checkfunc_t	check_func;
34b321
 static int		ncmdline;
34b321
 static char		**cmdline;
34b321
@@ -127,22 +126,6 @@ void add_user_command(char *optarg)
34b321
     cmdline[ncmdline-1] = optarg;
34b321
 }
34b321
 
34b321
-static int
34b321
-args_command(
34b321
-	int	index)
34b321
-{
34b321
-	if (args_func)
34b321
-		return args_func(index);
34b321
-	return 0;
34b321
-}
34b321
-
34b321
-void
34b321
-add_args_command(
34b321
-	argsfunc_t	af)
34b321
-{
34b321
-	args_func = af;
34b321
-}
34b321
-
34b321
 static void prep_fetchline(void *opaque)
34b321
 {
34b321
     int *fetchable = opaque;
34b321
@@ -155,7 +138,7 @@ static char *get_prompt(void);
34b321
 
34b321
 void command_loop(void)
34b321
 {
34b321
-    int c, i, j = 0, done = 0, fetchable = 0, prompted = 0;
34b321
+    int c, i, done = 0, fetchable = 0, prompted = 0;
34b321
     char *input;
34b321
     char **v;
34b321
     const cmdinfo_t *ct;
34b321
@@ -171,14 +154,7 @@ void command_loop(void)
34b321
         if (c) {
34b321
             ct = find_command(v[0]);
34b321
             if (ct) {
34b321
-                if (ct->flags & CMD_FLAG_GLOBAL) {
34b321
-                    done = command(ct, c, v);
34b321
-                } else {
34b321
-                    j = 0;
34b321
-                    while (!done && (j = args_command(j))) {
34b321
-                        done = command(ct, c, v);
34b321
-                    }
34b321
-                }
34b321
+                done = command(ct, c, v);
34b321
             } else {
34b321
                 fprintf(stderr, _("command \"%s\" not found\n"), v[0]);
34b321
             }
34b321
diff --git a/cmd.h b/cmd.h
34b321
index b763b19..8e6f753 100644
34b321
--- a/cmd.h
34b321
+++ b/cmd.h
34b321
@@ -41,12 +41,10 @@ extern int		ncmds;
34b321
 void help_init(void);
34b321
 void quit_init(void);
34b321
 
34b321
-typedef int (*argsfunc_t)(int index);
34b321
 typedef int (*checkfunc_t)(const cmdinfo_t *ci);
34b321
 
34b321
 void add_command(const cmdinfo_t *ci);
34b321
 void add_user_command(char *optarg);
34b321
-void add_args_command(argsfunc_t af);
34b321
 void add_check_command(checkfunc_t cf);
34b321
 
34b321
 const cmdinfo_t *find_command(const char *cmd);
34b321
diff --git a/qemu-io.c b/qemu-io.c
34b321
index cc89947..9f66a78 100644
34b321
--- a/qemu-io.c
34b321
+++ b/qemu-io.c
34b321
@@ -1935,15 +1935,6 @@ static int open_f(int argc, char **argv)
34b321
     return openfile(argv[optind], flags, growable, opts);
34b321
 }
34b321
 
34b321
-static int init_args_command(int index)
34b321
-{
34b321
-    /* only one device allowed so far */
34b321
-    if (index >= 1) {
34b321
-        return 0;
34b321
-    }
34b321
-    return ++index;
34b321
-}
34b321
-
34b321
 static int init_check_command(const cmdinfo_t *ct)
34b321
 {
34b321
     if (ct->flags & CMD_FLAG_GLOBAL) {
34b321
@@ -2096,7 +2087,6 @@ int main(int argc, char **argv)
34b321
     add_command(&abort_cmd);
34b321
     add_command(&sleep_cmd);
34b321
 
34b321
-    add_args_command(init_args_command);
34b321
     add_check_command(init_check_command);
34b321
 
34b321
     /* open the device */
34b321
-- 
34b321
1.8.3.1
34b321