Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/808716/?format=api
{ "id": 808716, "url": "http://patchwork.ozlabs.org/api/patches/808716/?format=api", "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20170901150317.10380-3-ehabkost@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": "<20170901150317.10380-3-ehabkost@redhat.com>", "list_archive_url": null, "date": "2017-09-01T15:02:50", "name": "[PULL,02/29] cpu: cpu_by_arch_id() helper", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "fdc290c43b14eb346ce5acb68b98fd5753473b6e", "submitter": { "id": 195, "url": "http://patchwork.ozlabs.org/api/people/195/?format=api", "name": "Eduardo Habkost", "email": "ehabkost@redhat.com" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20170901150317.10380-3-ehabkost@redhat.com/mbox/", "series": [ { "id": 1043, "url": "http://patchwork.ozlabs.org/api/series/1043/?format=api", "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/list/?series=1043", "date": "2017-09-01T15:02:50", "name": null, "version": 1, "mbox": "http://patchwork.ozlabs.org/series/1043/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/808716/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/808716/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-mx02.extmail.prod.ext.phx2.redhat.com;\n\tdmarc=none (p=none dis=none) header.from=redhat.com", "ext-mx02.extmail.prod.ext.phx2.redhat.com;\n\tspf=fail smtp.mailfrom=ehabkost@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 3xkMwF0m1qz9t2Z\n\tfor <incoming@patchwork.ozlabs.org>;\n\tSat, 2 Sep 2017 01:04:27 +1000 (AEST)", "from localhost ([::1]:44982 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 1dnnUg-0007p4-1u\n\tfor incoming@patchwork.ozlabs.org; Fri, 01 Sep 2017 11:04:26 -0400", "from eggs.gnu.org ([2001:4830:134:3::10]:40701)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <ehabkost@redhat.com>) id 1dnnTn-0007mw-9l\n\tfor qemu-devel@nongnu.org; Fri, 01 Sep 2017 11:03:32 -0400", "from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <ehabkost@redhat.com>) id 1dnnTi-0002sM-Mj\n\tfor qemu-devel@nongnu.org; Fri, 01 Sep 2017 11:03:31 -0400", "from mx1.redhat.com ([209.132.183.28]:53548)\n\tby eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)\n\t(Exim 4.71) (envelope-from <ehabkost@redhat.com>) id 1dnnTi-0002s7-HG\n\tfor qemu-devel@nongnu.org; Fri, 01 Sep 2017 11:03:26 -0400", "from smtp.corp.redhat.com\n\t(int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14])\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 9513C806CC;\n\tFri, 1 Sep 2017 15:03:25 +0000 (UTC)", "from localhost (ovpn-116-66.gru2.redhat.com [10.97.116.66])\n\tby smtp.corp.redhat.com (Postfix) with ESMTP id 22C607B0FE;\n\tFri, 1 Sep 2017 15:03:24 +0000 (UTC)" ], "DMARC-Filter": "OpenDMARC Filter v1.3.2 mx1.redhat.com 9513C806CC", "From": "Eduardo Habkost <ehabkost@redhat.com>", "To": "Peter Maydell <peter.maydell@linaro.org>", "Date": "Fri, 1 Sep 2017 12:02:50 -0300", "Message-Id": "<20170901150317.10380-3-ehabkost@redhat.com>", "In-Reply-To": "<20170901150317.10380-1-ehabkost@redhat.com>", "References": "<20170901150317.10380-1-ehabkost@redhat.com>", "X-Scanned-By": "MIMEDefang 2.79 on 10.5.11.14", "X-Greylist": "Sender IP whitelisted, not delayed by milter-greylist-4.5.16\n\t(mx1.redhat.com [10.5.110.26]);\n\tFri, 01 Sep 2017 15:03:25 +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] [PULL 02/29] cpu: cpu_by_arch_id() helper", "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": "qemu-devel@nongnu.org", "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": "The helper can be used for CPU object lookup using the CPU's\narch-specific ID (the one returned by CPUClass::get_arch_id()).\n\nSigned-off-by: Eduardo Habkost <ehabkost@redhat.com>\n[Yi Wang: Added documentation comments]\nSigned-off-by: Yi Wang <wang.yi59@zte.com.cn>\nSigned-off-by: Yun Liu <liu.yunh@zte.com.cn>\n[ehabkost: extracted cpu_by_arch_id() to a separate patch]\nSigned-off-by: Eduardo Habkost <ehabkost@redhat.com>\n---\n include/qom/cpu.h | 10 ++++++++++\n qom/cpu.c | 11 ++++++++---\n 2 files changed, 18 insertions(+), 3 deletions(-)", "diff": "diff --git a/include/qom/cpu.h b/include/qom/cpu.h\nindex 25eefea7ab..b7ac9491c8 100644\n--- a/include/qom/cpu.h\n+++ b/include/qom/cpu.h\n@@ -755,6 +755,16 @@ CPUState *qemu_get_cpu(int index);\n bool cpu_exists(int64_t id);\n \n /**\n+ * cpu_by_arch_id:\n+ * @id: Guest-exposed CPU ID of the CPU to obtain.\n+ *\n+ * Get a CPU with matching @id.\n+ *\n+ * Returns: The CPU or %NULL if there is no matching CPU.\n+ */\n+CPUState *cpu_by_arch_id(int64_t id);\n+\n+/**\n * cpu_throttle_set:\n * @new_throttle_pct: Percent of sleep time. Valid range is 1 to 99.\n *\ndiff --git a/qom/cpu.c b/qom/cpu.c\nindex 4f38db0dac..e6210d5949 100644\n--- a/qom/cpu.c\n+++ b/qom/cpu.c\n@@ -34,7 +34,7 @@\n \n CPUInterruptHandler cpu_interrupt_handler;\n \n-bool cpu_exists(int64_t id)\n+CPUState *cpu_by_arch_id(int64_t id)\n {\n CPUState *cpu;\n \n@@ -42,10 +42,15 @@ bool cpu_exists(int64_t id)\n CPUClass *cc = CPU_GET_CLASS(cpu);\n \n if (cc->get_arch_id(cpu) == id) {\n- return true;\n+ return cpu;\n }\n }\n- return false;\n+ return NULL;\n+}\n+\n+bool cpu_exists(int64_t id)\n+{\n+ return !!cpu_by_arch_id(id);\n }\n \n CPUState *cpu_generic_init(const char *typename, const char *cpu_model)\n", "prefixes": [ "PULL", "02/29" ] }