qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
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 04/26] monitor: Convert mon_cmd_t to MonitorCommand
Date: Fri, 15 Aug 2014 15:35:36 +0200	[thread overview]
Message-ID: <1408109759-1100-5-git-send-email-benoit.canet@nodalink.com> (raw)
In-Reply-To: <1408109759-1100-1-git-send-email-benoit.canet@nodalink.com>

Signed-off-by: Benoît Canet <benoit.canet@nodalink.com>
---
 monitor.c | 68 +++++++++++++++++++++++++++++++--------------------------------
 1 file changed, 34 insertions(+), 34 deletions(-)

diff --git a/monitor.c b/monitor.c
index 48a147c..f57dae5 100644
--- a/monitor.c
+++ b/monitor.c
@@ -123,7 +123,7 @@ struct MonitorCompletionData {
     void (*user_print)(Monitor *mon, const QObject *data);
 };
 
-typedef struct mon_cmd_t {
+typedef struct MonitorCommand {
     const char *name;
     const char *args_type;
     const char *params;
@@ -140,9 +140,9 @@ typedef struct mon_cmd_t {
      * 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 mon_cmd_t *sub_table;
+    struct MonitorCommand *sub_table;
     void (*command_completion)(ReadLineState *rs, int nb_args, const char *str);
-} mon_cmd_t;
+} MonitorCommand;
 
 /* file descriptors passed via SCM_RIGHTS */
 typedef struct mon_fd_t mon_fd_t;
@@ -208,7 +208,7 @@ struct Monitor {
     CPUState *mon_cpu;
     BlockDriverCompletionFunc *password_completion_cb;
     void *password_opaque;
-    mon_cmd_t *cmd_table;
+    MonitorCommand *cmd_table;
     QError *error;
     QLIST_HEAD(,mon_fd_t) fds;
     QLIST_ENTRY(Monitor) entry;
@@ -224,10 +224,10 @@ static QLIST_HEAD(mon_list, Monitor) mon_list;
 static QLIST_HEAD(mon_fdsets, MonFdset) mon_fdsets;
 static int mon_refcount;
 
-static mon_cmd_t mon_cmds[];
-static mon_cmd_t info_cmds[];
+static MonitorCommand mon_cmds[];
+static MonitorCommand info_cmds[];
 
-static const mon_cmd_t qmp_cmds[];
+static const MonitorCommand qmp_cmds[];
 
 Monitor *cur_mon;
 Monitor *default_mon;
@@ -391,12 +391,12 @@ static int GCC_FMT_ATTR(2, 3) monitor_fprintf(FILE *stream,
 
 void monitor_user_noop(Monitor *mon, const QObject *data) { }
 
-static inline int handler_is_qobject(const mon_cmd_t *cmd)
+static inline int handler_is_qobject(const MonitorCommand *cmd)
 {
     return cmd->user_print != NULL;
 }
 
-static inline bool handler_is_async(const mon_cmd_t *cmd)
+static inline bool handler_is_async(const MonitorCommand *cmd)
 {
     return cmd->flags & MONITOR_CMD_ASYNC;
 }
@@ -804,7 +804,7 @@ int parse_cmdline(const char *cmdline, int *pnb_args, char **args)
 }
 
 static void help_cmd_dump_one(Monitor *mon,
-                              const mon_cmd_t *cmd,
+                              const MonitorCommand *cmd,
                               char **prefix_args,
                               int prefix_args_nb)
 {
@@ -817,10 +817,10 @@ static void help_cmd_dump_one(Monitor *mon,
 }
 
 /* @args[@arg_index] is the valid command need to find in @cmds */
-static void help_cmd_dump(Monitor *mon, const mon_cmd_t *cmds,
+static void help_cmd_dump(Monitor *mon, const MonitorCommand *cmds,
                           char **args, int nb_args, int arg_index)
 {
-    const mon_cmd_t *cmd;
+    const MonitorCommand *cmd;
 
     /* No valid arg need to compare with, dump all in *cmds */
     if (arg_index >= nb_args) {
@@ -940,13 +940,13 @@ static void qmp_monitor_complete(void *opaque, QObject *ret_data)
     monitor_protocol_emitter(opaque, ret_data);
 }
 
-static int qmp_async_cmd_handler(Monitor *mon, const mon_cmd_t *cmd,
+static int qmp_async_cmd_handler(Monitor *mon, const MonitorCommand *cmd,
                                  const QDict *params)
 {
     return cmd->mhandler.cmd_async(mon, params, qmp_monitor_complete, mon);
 }
 
-static void user_async_cmd_handler(Monitor *mon, const mon_cmd_t *cmd,
+static void user_async_cmd_handler(Monitor *mon, const MonitorCommand *cmd,
                                    const QDict *params)
 {
     int ret;
@@ -971,7 +971,7 @@ static void do_info_help(Monitor *mon, const QDict *qdict)
 CommandInfoList *qmp_query_commands(Error **errp)
 {
     CommandInfoList *info, *cmd_list = NULL;
-    const mon_cmd_t *cmd;
+    const MonitorCommand *cmd;
 
     for (cmd = qmp_cmds; cmd->name != NULL; cmd++) {
         info = g_malloc0(sizeof(*info));
@@ -2595,7 +2595,7 @@ int monitor_handle_fd_param2(Monitor *mon, const char *fdname, Error **errp)
 }
 
 /* Please update hmp-commands.hx when adding or changing commands */
-static mon_cmd_t info_cmds[] = {
+static MonitorCommand info_cmds[] = {
     {
         .name       = "version",
         .args_type  = "",
@@ -2921,12 +2921,12 @@ static mon_cmd_t info_cmds[] = {
 };
 
 /* mon_cmds and info_cmds would be sorted at runtime */
-static mon_cmd_t mon_cmds[] = {
+static MonitorCommand mon_cmds[] = {
 #include "hmp-commands.h"
     { NULL, NULL, },
 };
 
-static const mon_cmd_t qmp_cmds[] = {
+static const MonitorCommand qmp_cmds[] = {
 #include "qmp-commands-old.h"
     { /* NULL */ },
 };
@@ -3643,10 +3643,10 @@ static int is_valid_option(const char *c, const char *typestr)
     return (typestr != NULL);
 }
 
-static const mon_cmd_t *search_dispatch_table(const mon_cmd_t *disp_table,
+static const MonitorCommand *search_dispatch_table(const MonitorCommand *disp_table,
                                               const char *cmdname)
 {
-    const mon_cmd_t *cmd;
+    const MonitorCommand *cmd;
 
     for (cmd = disp_table; cmd->name != NULL; cmd++) {
         if (compare_cmd(cmdname, cmd->name)) {
@@ -3657,7 +3657,7 @@ static const mon_cmd_t *search_dispatch_table(const mon_cmd_t *disp_table,
     return NULL;
 }
 
-static const mon_cmd_t *qmp_find_cmd(const char *cmdname)
+static const MonitorCommand *qmp_find_cmd(const char *cmdname)
 {
     return search_dispatch_table(qmp_cmds, cmdname);
 }
@@ -3674,15 +3674,15 @@ static const mon_cmd_t *qmp_find_cmd(const char *cmdname)
  * Do not assume the returned command points into @table!  It doesn't
  * when the command is a sub-command.
  */
-static const mon_cmd_t *monitor_parse_command(Monitor *mon,
+static const MonitorCommand *monitor_parse_command(Monitor *mon,
                                               const char *cmdline,
                                               int start,
-                                              mon_cmd_t *table,
+                                              MonitorCommand *table,
                                               QDict *qdict)
 {
     const char *p, *typestr;
     int c;
-    const mon_cmd_t *cmd;
+    const MonitorCommand *cmd;
     char cmdname[256];
     char buf[1024];
     char *key;
@@ -4078,7 +4078,7 @@ void monitor_set_error(Monitor *mon, QError *qerror)
     }
 }
 
-static void handler_audit(Monitor *mon, const mon_cmd_t *cmd, int ret)
+static void handler_audit(Monitor *mon, const MonitorCommand *cmd, int ret)
 {
     if (ret && !monitor_has_error(mon)) {
         /*
@@ -4093,7 +4093,7 @@ static void handler_audit(Monitor *mon, const mon_cmd_t *cmd, int ret)
 void handle_user_command(Monitor *mon, const char *cmdline)
 {
     QDict *qdict;
-    const mon_cmd_t *cmd;
+    const MonitorCommand *cmd;
 
     qdict = qdict_new();
 
@@ -4653,14 +4653,14 @@ void loadvm_completion(ReadLineState *rs, int nb_args, const char *str)
 }
 
 static void monitor_find_completion_by_table(Monitor *mon,
-                                             const mon_cmd_t *cmd_table,
+                                             const MonitorCommand *cmd_table,
                                              char **args,
                                              int nb_args)
 {
     const char *cmdname;
     int i;
     const char *ptype, *str;
-    const mon_cmd_t *cmd;
+    const MonitorCommand *cmd;
     MonitorBlockComplete mbs;
 
     if (nb_args <= 1) {
@@ -4951,7 +4951,7 @@ out:
  * 3. Each argument provided by the client must have the type expected
  *    by the command
  */
-static int qmp_check_client_args(const mon_cmd_t *cmd, QDict *client_args)
+static int qmp_check_client_args(const MonitorCommand *cmd, QDict *client_args)
 {
     int flags, err;
     QDict *cmd_args;
@@ -5027,7 +5027,7 @@ static QDict *qmp_check_input_obj(QObject *input_obj)
     return input_dict;
 }
 
-static void qmp_call_cmd(Monitor *mon, const mon_cmd_t *cmd,
+static void qmp_call_cmd(Monitor *mon, const MonitorCommand *cmd,
                          const QDict *params)
 {
     int ret;
@@ -5044,7 +5044,7 @@ static void handle_qmp_command(JSONMessageParser *parser, QList *tokens)
     int err;
     QObject *obj;
     QDict *input, *args;
-    const mon_cmd_t *cmd;
+    const MonitorCommand *cmd;
     const char *cmd_name;
     Monitor *mon = cur_mon;
 
@@ -5257,14 +5257,14 @@ static void monitor_event(void *opaque, int event)
 static int
 compare_mon_cmd(const void *a, const void *b)
 {
-    return strcmp(((const mon_cmd_t *)a)->name,
-            ((const mon_cmd_t *)b)->name);
+    return strcmp(((const MonitorCommand *)a)->name,
+            ((const MonitorCommand *)b)->name);
 }
 
 static void sortcmdlist(void)
 {
     int array_num;
-    int elem_size = sizeof(mon_cmd_t);
+    int elem_size = sizeof(MonitorCommand);
 
     array_num = sizeof(mon_cmds)/elem_size-1;
     qsort((void *)mon_cmds, array_num, elem_size, compare_mon_cmd);
-- 
2.1.0.rc1

  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 ` Benoît Canet [this message]
2014-08-15 13:35 ` [Qemu-devel] [PATCH v2 05/26] monitor: Extract monitor-system.h header Benoît Canet
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-5-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).