From: "Benoît Canet" <benoit.canet@nodalink.com>
To: qemu-devel@nongnu.org
Cc: kwolf@redhat.com, pbonzini@redhat.com,
"Benoît Canet" <benoit.canet@nodalink.com>,
stefanha@redhat.com
Subject: [Qemu-devel] [PATCH v2 05/26] monitor: Extract monitor-system.h header
Date: Fri, 15 Aug 2014 15:35:37 +0200 [thread overview]
Message-ID: <1408109759-1100-6-git-send-email-benoit.canet@nodalink.com> (raw)
In-Reply-To: <1408109759-1100-1-git-send-email-benoit.canet@nodalink.com>
This header will allow allow splitting the monitor into two parts.
Signed-off-by: Benoît Canet <benoit.canet@nodalink.com>
---
include/monitor/monitor-system.h | 99 ++++++++++++++++++++++++++++++++++++++++
monitor.c | 57 ++---------------------
2 files changed, 102 insertions(+), 54 deletions(-)
create mode 100644 include/monitor/monitor-system.h
diff --git a/include/monitor/monitor-system.h b/include/monitor/monitor-system.h
new file mode 100644
index 0000000..e7b99ce
--- /dev/null
+++ b/include/monitor/monitor-system.h
@@ -0,0 +1,99 @@
+/*
+ * QEMU monitor
+ *
+ * Copyright (c) 2003-2004 Fabrice Bellard
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#ifndef MONITOR_COMMANDS_H
+#define MONITOR_COMMANDS_H
+
+#include "monitor/monitor.h"
+#include "qapi/error.h"
+#include "qapi/qmp/qlist.h"
+#include "qapi/qmp/qstring.h"
+#include "qapi/qmp/qjson.h"
+#include "qapi/qmp/json-streamer.h"
+#include "qapi/qmp/json-parser.h"
+#include <qom/object_interfaces.h>
+#include "hw/pci/pci.h"
+
+#include <stdint.h>
+
+#define MAX_ARGS 16
+
+struct MonitorCommand;
+
+typedef struct MonitorControl {
+ QObject *id;
+ JSONMessageParser parser;
+ int command_mode;
+} MonitorControl;
+
+struct Monitor {
+ CharDriverState *chr;
+ bool reset_seen;
+ int flags;
+ int suspend_cnt;
+ bool skip_flush;
+
+ QemuMutex out_lock;
+ QString *outbuf;
+ guint out_watch;
+
+ /* Read under either BQL or out_lock, written with BQL+out_lock. */
+ int mux_out;
+
+ ReadLineState *rs;
+ MonitorControl *mc;
+ CPUState *mon_cpu;
+ BlockDriverCompletionFunc *password_completion_cb;
+ void *password_opaque;
+ struct MonitorCommand *cmd_table;
+ QError *error;
+ QLIST_HEAD(,mon_fd_t) fds;
+ QLIST_ENTRY(Monitor) entry;
+};
+
+typedef struct MonitorCommand {
+ const char *name;
+ const char *args_type;
+ const char *params;
+ const char *help;
+ void (*user_print)(Monitor *mon, const QObject *data);
+ union {
+ void (*cmd)(Monitor *mon, const QDict *qdict);
+ int (*cmd_new)(Monitor *mon, const QDict *params, QObject **ret_data);
+ int (*cmd_async)(Monitor *mon, const QDict *params,
+ MonitorCompletion *cb, void *opaque);
+ } mhandler;
+ int flags;
+ /* @sub_table is a list of 2nd level of commands. If it do not exist,
+ * mhandler should be used. If it exist, sub_table[?].mhandler should be
+ * used, and mhandler of 1st level plays the role of help function.
+ */
+ struct MonitorCommand *sub_table;
+ void (*command_completion)(ReadLineState *rs, int nb_args, const char *str);
+} MonitorCommand;
+
+int get_expr(Monitor *mon, int64_t *pval, const char **pp);
+int get_double(Monitor *mon, double *pval, const char **pp);
+
+#endif
diff --git a/monitor.c b/monitor.c
index f57dae5..8c90c11 100644
--- a/monitor.c
+++ b/monitor.c
@@ -37,6 +37,7 @@
#include "ui/qemu-spice.h"
#include "sysemu/sysemu.h"
#include "monitor/monitor.h"
+#include "monitor/monitor-system.h"
#include "qemu/readline.h"
#include "ui/console.h"
#include "ui/input.h"
@@ -123,27 +124,6 @@ struct MonitorCompletionData {
void (*user_print)(Monitor *mon, const QObject *data);
};
-typedef struct MonitorCommand {
- const char *name;
- const char *args_type;
- const char *params;
- const char *help;
- void (*user_print)(Monitor *mon, const QObject *data);
- union {
- void (*cmd)(Monitor *mon, const QDict *qdict);
- int (*cmd_new)(Monitor *mon, const QDict *params, QObject **ret_data);
- int (*cmd_async)(Monitor *mon, const QDict *params,
- MonitorCompletion *cb, void *opaque);
- } mhandler;
- int flags;
- /* @sub_table is a list of 2nd level of commands. If it do not exist,
- * mhandler should be used. If it exist, sub_table[?].mhandler should be
- * used, and mhandler of 1st level plays the role of help function.
- */
- struct MonitorCommand *sub_table;
- void (*command_completion)(ReadLineState *rs, int nb_args, const char *str);
-} MonitorCommand;
-
/* file descriptors passed via SCM_RIGHTS */
typedef struct mon_fd_t mon_fd_t;
struct mon_fd_t {
@@ -170,12 +150,6 @@ struct MonFdset {
QLIST_ENTRY(MonFdset) next;
};
-typedef struct MonitorControl {
- QObject *id;
- JSONMessageParser parser;
- int command_mode;
-} MonitorControl;
-
/*
* To prevent flooding clients, events can be throttled. The
* throttling is calculated globally, rather than per-Monitor
@@ -189,31 +163,6 @@ typedef struct MonitorQAPIEventState {
QObject *data; /* Event pending delayed dispatch */
} MonitorQAPIEventState;
-struct Monitor {
- CharDriverState *chr;
- bool reset_seen;
- int flags;
- int suspend_cnt;
- bool skip_flush;
-
- QemuMutex out_lock;
- QString *outbuf;
- guint out_watch;
-
- /* Read under either BQL or out_lock, written with BQL+out_lock. */
- int mux_out;
-
- ReadLineState *rs;
- MonitorControl *mc;
- CPUState *mon_cpu;
- BlockDriverCompletionFunc *password_completion_cb;
- void *password_opaque;
- MonitorCommand *cmd_table;
- QError *error;
- QLIST_HEAD(,mon_fd_t) fds;
- QLIST_ENTRY(Monitor) entry;
-};
-
/* QMP checker flags */
#define QMP_ACCEPT_UNKNOWNS 1
@@ -3540,7 +3489,7 @@ static int64_t expr_sum(Monitor *mon)
return val;
}
-static int get_expr(Monitor *mon, int64_t *pval, const char **pp)
+int get_expr(Monitor *mon, int64_t *pval, const char **pp)
{
pch = *pp;
if (sigsetjmp(expr_env, 0)) {
@@ -3554,7 +3503,7 @@ static int get_expr(Monitor *mon, int64_t *pval, const char **pp)
return 0;
}
-static int get_double(Monitor *mon, double *pval, const char **pp)
+int get_double(Monitor *mon, double *pval, const char **pp)
{
const char *p = *pp;
char *tailp;
--
2.1.0.rc1
next prev parent reply other threads:[~2014-08-15 13:37 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-08-15 13:35 [Qemu-devel] [PATCH v2 00/26] Extract qmp.c and monitor.c core and wire QMP into qemu-nbd Benoît Canet
2014-08-15 13:35 ` [Qemu-devel] [PATCH v2 01/26] qmp: Extract system emulation related code from qmp.c into qmp-system.c Benoît Canet
2014-08-15 13:35 ` [Qemu-devel] [PATCH v2 02/26] monitor: Make some function public Benoît Canet
2014-08-15 13:35 ` [Qemu-devel] [PATCH v2 03/26] monitor: Convert Monitor reset_seen field too boolean Benoît Canet
2014-08-15 13:35 ` [Qemu-devel] [PATCH v2 04/26] monitor: Convert mon_cmd_t to MonitorCommand Benoît Canet
2014-08-15 13:35 ` Benoît Canet [this message]
2014-08-15 13:35 ` [Qemu-devel] [PATCH v2 06/26] monitor: Make monitor_fprintf public before extracting it Benoît Canet
2014-08-15 13:35 ` [Qemu-devel] [PATCH v2 07/26] monitor: Extract monitor_fprintf to monitor-system.c Benoît Canet
2014-08-15 13:35 ` [Qemu-devel] [PATCH v2 08/26] monitor: Extract qmp_human_monitor_command into monitor-system.c Benoît Canet
2014-08-15 13:35 ` [Qemu-devel] [PATCH v2 09/26] monitor: Make some function to extract public Benoît Canet
2014-08-15 13:35 ` [Qemu-devel] [PATCH v2 10/26] monitor: Extract a couple of function to monitor-system.c Benoît Canet
2014-08-15 13:35 ` [Qemu-devel] [PATCH v2 11/26] monitor: Make do_info_help public Benoît Canet
2014-08-15 13:35 ` [Qemu-devel] [PATCH v2 12/26] monitor: Extract do_info_help in monitor-system.c Benoît Canet
2014-08-15 13:35 ` [Qemu-devel] [PATCH v2 13/26] monitor: Make some monitor functions public before moving them " Benoît Canet
2014-08-15 13:35 ` [Qemu-devel] [PATCH v2 14/26] monitor: Make do_loadvm public before moving it to monitor-system.c Benoît Canet
2014-08-15 13:35 ` [Qemu-devel] [PATCH v2 15/26] monitor: Move do_loadvm from monitor.c " Benoît Canet
2014-08-15 13:35 ` [Qemu-devel] [PATCH v2 16/26] monitor: Make commands public before moving them " Benoît Canet
2014-08-15 13:35 ` [Qemu-devel] [PATCH v2 17/26] monitor: Move MonitorCommand arrays and some function from monitor.c " Benoît Canet
2014-08-15 13:35 ` [Qemu-devel] [PATCH v2 18/26] monitor: Move more functions " Benoît Canet
2014-08-15 13:35 ` [Qemu-devel] [PATCH v2 19/26] monitor: Move two net " Benoît Canet
2014-08-15 13:35 ` [Qemu-devel] [PATCH v2 20/26] monitor: Move qmp_rtc_reset_reinjection " Benoît Canet
2014-08-15 13:35 ` [Qemu-devel] [PATCH v2 21/26] monitor-system: Switch back functions to static Benoît Canet
2014-08-15 13:35 ` [Qemu-devel] [PATCH v2 22/26] monitor: Extract hardware dependent completion function from monitor.c to monitor-system.c Benoît Canet
2014-08-15 13:35 ` [Qemu-devel] [PATCH v2 23/26] monitor: Cleanup monitor.c includes after extracting monitor-system.c Benoît Canet
2014-08-15 13:35 ` [Qemu-devel] [PATCH v2 24/26] qemu-nbd: build QAPI block core into qemu-nbd Benoît Canet
2014-08-15 13:35 ` [Qemu-devel] [PATCH v2 25/26] qapi: Add a script to filter qmp-commands-old.h to generate a subset of it Benoît Canet
2014-08-15 13:35 ` [Qemu-devel] [PATCH v2 26/26] qemu-nbd: Add --qmp option to qemu-nbd Benoît Canet
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1408109759-1100-6-git-send-email-benoit.canet@nodalink.com \
--to=benoit.canet@nodalink.com \
--cc=kwolf@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).