Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/813731/?format=api
{ "id": 813731, "url": "http://patchwork.ozlabs.org/api/patches/813731/?format=api", "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/patch/1505375436-28439-8-git-send-email-peterx@redhat.com/", "project": { "id": 14, "url": "http://patchwork.ozlabs.org/api/projects/14/?format=api", "name": "QEMU Development", "link_name": "qemu-devel", "list_id": "qemu-devel.nongnu.org", "list_email": "qemu-devel@nongnu.org", "web_url": "", "scm_url": "", "webscm_url": "", "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<1505375436-28439-8-git-send-email-peterx@redhat.com>", "list_archive_url": null, "date": "2017-09-14T07:50:28", "name": "[RFC,07/15] monitor: unify global init", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "34382e33a2513b70d75ce724eed238f5015a60ac", "submitter": { "id": 67717, "url": "http://patchwork.ozlabs.org/api/people/67717/?format=api", "name": "Peter Xu", "email": "peterx@redhat.com" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/qemu-devel/patch/1505375436-28439-8-git-send-email-peterx@redhat.com/mbox/", "series": [ { "id": 3043, "url": "http://patchwork.ozlabs.org/api/series/3043/?format=api", "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/list/?series=3043", "date": "2017-09-14T07:50:21", "name": "QMP: out-of-band (OOB) execution support", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/3043/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/813731/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/813731/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>", "X-Original-To": "incoming@patchwork.ozlabs.org", "Delivered-To": "patchwork-incoming@bilbo.ozlabs.org", "Authentication-Results": [ "ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=nongnu.org\n\t(client-ip=2001:4830:134:3::11; helo=lists.gnu.org;\n\tenvelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n\treceiver=<UNKNOWN>)", "ext-mx03.extmail.prod.ext.phx2.redhat.com;\n\tdmarc=none (p=none dis=none) header.from=redhat.com", "ext-mx03.extmail.prod.ext.phx2.redhat.com;\n\tspf=fail smtp.mailfrom=peterx@redhat.com" ], "Received": [ "from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11])\n\t(using TLSv1 with cipher AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xt9qP1qFgz9sRm\n\tfor <incoming@patchwork.ozlabs.org>;\n\tThu, 14 Sep 2017 17:57:21 +1000 (AEST)", "from localhost ([::1]:46208 helo=lists.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.71) (envelope-from\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>)\n\tid 1dsP1T-0003bT-99\n\tfor incoming@patchwork.ozlabs.org; Thu, 14 Sep 2017 03:57:19 -0400", "from eggs.gnu.org ([2001:4830:134:3::10]:52063)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <peterx@redhat.com>) id 1dsOvx-0006bj-It\n\tfor qemu-devel@nongnu.org; Thu, 14 Sep 2017 03:51:38 -0400", "from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <peterx@redhat.com>) id 1dsOvw-00079V-K6\n\tfor qemu-devel@nongnu.org; Thu, 14 Sep 2017 03:51:37 -0400", "from mx1.redhat.com ([209.132.183.28]:51070)\n\tby eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)\n\t(Exim 4.71) (envelope-from <peterx@redhat.com>) id 1dsOvw-00077P-4G\n\tfor qemu-devel@nongnu.org; Thu, 14 Sep 2017 03:51:36 -0400", "from smtp.corp.redhat.com\n\t(int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12])\n\t(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby mx1.redhat.com (Postfix) with ESMTPS id 165AC7E420;\n\tThu, 14 Sep 2017 07:51:35 +0000 (UTC)", "from pxdev.xzpeter.org.com (dhcp-15-224.nay.redhat.com\n\t[10.66.15.224])\n\tby smtp.corp.redhat.com (Postfix) with ESMTP id 29C1277EC0;\n\tThu, 14 Sep 2017 07:51:29 +0000 (UTC)" ], "DMARC-Filter": "OpenDMARC Filter v1.3.2 mx1.redhat.com 165AC7E420", "From": "Peter Xu <peterx@redhat.com>", "To": "qemu-devel@nongnu.org", "Date": "Thu, 14 Sep 2017 15:50:28 +0800", "Message-Id": "<1505375436-28439-8-git-send-email-peterx@redhat.com>", "In-Reply-To": "<1505375436-28439-1-git-send-email-peterx@redhat.com>", "References": "<1505375436-28439-1-git-send-email-peterx@redhat.com>", "X-Scanned-By": "MIMEDefang 2.79 on 10.5.11.12", "X-Greylist": "Sender IP whitelisted, not delayed by milter-greylist-4.5.16\n\t(mx1.redhat.com [10.5.110.27]);\n\tThu, 14 Sep 2017 07:51:35 +0000 (UTC)", "X-detected-operating-system": "by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]\n\t[fuzzy]", "X-Received-From": "209.132.183.28", "Subject": "[Qemu-devel] [RFC 07/15] monitor: unify global init", "X-BeenThere": "qemu-devel@nongnu.org", "X-Mailman-Version": "2.1.21", "Precedence": "list", "List-Id": "<qemu-devel.nongnu.org>", "List-Unsubscribe": "<https://lists.nongnu.org/mailman/options/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>", "List-Archive": "<http://lists.nongnu.org/archive/html/qemu-devel/>", "List-Post": "<mailto:qemu-devel@nongnu.org>", "List-Help": "<mailto:qemu-devel-request@nongnu.org?subject=help>", "List-Subscribe": "<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=subscribe>", "Cc": "Laurent Vivier <lvivier@redhat.com>, Fam Zheng <famz@redhat.com>, Juan\n\tQuintela <quintela@redhat.com>, Markus Armbruster <armbru@redhat.com>,\n\tpeterx@redhat.com, mdroth@linux.vnet.ibm.com,\n\tStefan Hajnoczi <shajnocz@redhat.com>, =?utf-8?q?Marc-Andr=C3=A9_Lure?=\n\t=?utf-8?q?au?= <marcandre.lureau@gmail.com>,\n\tPaolo Bonzini <pbonzini@redhat.com>, \"Dr . David Alan Gilbert\"\n\t<dgilbert@redhat.com>", "Errors-To": "qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org", "Sender": "\"Qemu-devel\"\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>" }, "content": "There are many places for monitor init its globals, at least:\n\n- monitor_init_qmp_commands() at the very beginning\n- single function to init monitor_lock\n- in the first entry of monitor_init() using \"is_first_init\"\n\nUnify them a bit.\n\nSigned-off-by: Peter Xu <peterx@redhat.com>\n---\n include/monitor/monitor.h | 2 +-\n monitor.c | 25 ++++++++++---------------\n vl.c | 3 ++-\n 3 files changed, 13 insertions(+), 17 deletions(-)", "diff": "diff --git a/include/monitor/monitor.h b/include/monitor/monitor.h\nindex 83ea4a1..3a5128a 100644\n--- a/include/monitor/monitor.h\n+++ b/include/monitor/monitor.h\n@@ -16,7 +16,7 @@ extern Monitor *cur_mon;\n \n bool monitor_cur_is_qmp(void);\n \n-void monitor_init_qmp_commands(void);\n+void monitor_init_globals(void);\n void monitor_init(Chardev *chr, int flags);\n void monitor_cleanup(void);\n \ndiff --git a/monitor.c b/monitor.c\nindex d7eb3c2..7bd2e90 100644\n--- a/monitor.c\n+++ b/monitor.c\n@@ -1000,7 +1000,7 @@ static void qmp_unregister_commands_hack(void)\n #endif\n }\n \n-void monitor_init_qmp_commands(void)\n+static void monitor_init_qmp_commands(void)\n {\n /*\n * Two command lists:\n@@ -4043,6 +4043,14 @@ static void sortcmdlist(void)\n qsort((void *)info_cmds, array_num, elem_size, compare_mon_cmd);\n }\n \n+void monitor_init_globals(void)\n+{\n+ monitor_init_qmp_commands();\n+ monitor_qapi_event_init();\n+ sortcmdlist();\n+ qemu_mutex_init(&monitor_lock);\n+}\n+\n /* These functions just adapt the readline interface in a typesafe way. We\n * could cast function pointers but that discards compiler checks.\n */\n@@ -4083,23 +4091,10 @@ void error_vprintf_unless_qmp(const char *fmt, va_list ap)\n }\n }\n \n-static void __attribute__((constructor)) monitor_lock_init(void)\n-{\n- qemu_mutex_init(&monitor_lock);\n-}\n-\n void monitor_init(Chardev *chr, int flags)\n {\n- static int is_first_init = 1;\n- Monitor *mon;\n-\n- if (is_first_init) {\n- monitor_qapi_event_init();\n- sortcmdlist();\n- is_first_init = 0;\n- }\n+ Monitor *mon = g_malloc(sizeof(*mon));\n \n- mon = g_malloc(sizeof(*mon));\n monitor_data_init(mon, false);\n \n qemu_chr_fe_init(&mon->chr, chr, &error_abort);\ndiff --git a/vl.c b/vl.c\nindex fb1f05b..850cf55 100644\n--- a/vl.c\n+++ b/vl.c\n@@ -3049,7 +3049,6 @@ int main(int argc, char **argv, char **envp)\n qemu_init_exec_dir(argv[0]);\n \n module_call_init(MODULE_INIT_QOM);\n- monitor_init_qmp_commands();\n \n qemu_add_opts(&qemu_drive_opts);\n qemu_add_drive_opts(&qemu_legacy_drive_opts);\n@@ -4587,6 +4586,8 @@ int main(int argc, char **argv, char **envp)\n \n parse_numa_opts(current_machine);\n \n+ monitor_init_globals();\n+\n if (qemu_opts_foreach(qemu_find_opts(\"mon\"),\n mon_init_func, NULL, NULL)) {\n exit(1);\n", "prefixes": [ "RFC", "07/15" ] }