Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/819450/?format=api
{ "id": 819450, "url": "http://patchwork.ozlabs.org/api/patches/819450/?format=api", "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/patch/1506590409-28857-4-git-send-email-amarnath.valluri@intel.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": "<1506590409-28857-4-git-send-email-amarnath.valluri@intel.com>", "list_archive_url": null, "date": "2017-09-28T09:20:04", "name": "[v9,3/8] tpm-backend: Initialize and free data members in it's own methods", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "98472023c1eff3e6280185fdbaaf884ef0a417c7", "submitter": { "id": 71320, "url": "http://patchwork.ozlabs.org/api/people/71320/?format=api", "name": "Valluri, Amarnath", "email": "amarnath.valluri@intel.com" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/qemu-devel/patch/1506590409-28857-4-git-send-email-amarnath.valluri@intel.com/mbox/", "series": [ { "id": 5516, "url": "http://patchwork.ozlabs.org/api/series/5516/?format=api", "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/list/?series=5516", "date": "2017-09-28T09:20:02", "name": "Provide support for the software TPM", "version": 9, "mbox": "http://patchwork.ozlabs.org/series/5516/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/819450/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/819450/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>)", "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 3y2q025PRGz9t2c\n\tfor <incoming@patchwork.ozlabs.org>;\n\tThu, 28 Sep 2017 19:19:46 +1000 (AEST)", "from localhost ([::1]:58092 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 1dxUyu-0000qE-R5\n\tfor incoming@patchwork.ozlabs.org; Thu, 28 Sep 2017 05:19:44 -0400", "from eggs.gnu.org ([2001:4830:134:3::10]:59191)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <amarnath.valluri@intel.com>) id 1dxUyG-0000oI-7U\n\tfor qemu-devel@nongnu.org; Thu, 28 Sep 2017 05:19:05 -0400", "from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <amarnath.valluri@intel.com>) id 1dxUyE-0000kO-UJ\n\tfor qemu-devel@nongnu.org; Thu, 28 Sep 2017 05:19:04 -0400", "from mga11.intel.com ([192.55.52.93]:13925)\n\tby eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)\n\t(Exim 4.71) (envelope-from <amarnath.valluri@intel.com>)\n\tid 1dxUyE-0000bz-K1\n\tfor qemu-devel@nongnu.org; Thu, 28 Sep 2017 05:19:02 -0400", "from orsmga005.jf.intel.com ([10.7.209.41])\n\tby fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t28 Sep 2017 02:19:02 -0700", "from avallurigigabyte.fi.intel.com ([10.237.68.147])\n\tby orsmga005.jf.intel.com with ESMTP; 28 Sep 2017 02:19:00 -0700" ], "X-ExtLoop1": "1", "X-IronPort-AV": "E=Sophos;i=\"5.42,449,1500966000\"; d=\"scan'208\";a=\"154306568\"", "From": "Amarnath Valluri <amarnath.valluri@intel.com>", "To": "qemu-devel@nongnu.org", "Date": "Thu, 28 Sep 2017 12:20:04 +0300", "Message-Id": "<1506590409-28857-4-git-send-email-amarnath.valluri@intel.com>", "X-Mailer": "git-send-email 2.7.4", "In-Reply-To": "<1506590409-28857-1-git-send-email-amarnath.valluri@intel.com>", "References": "<1506590409-28857-1-git-send-email-amarnath.valluri@intel.com>", "MIME-Version": "1.0", "Content-Type": "text/plain; charset=UTF-8", "Content-Transfer-Encoding": "8bit", "X-detected-operating-system": "by eggs.gnu.org: Genre and OS details not\n\trecognized.", "X-Received-From": "192.55.52.93", "Subject": "[Qemu-devel] [PATCH v9 3/8] tpm-backend: Initialize and free data\n\tmembers in it's own methods", "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": "Amarnath Valluri <amarnath.valluri@intel.com>, =?utf-8?q?Marc-Andr?=\n\t=?utf-8?b?w6kgTHVyZWF1?= <marcandre.lureau@gmail.com>,\n\tStefan Berger <stefanb@linux.vnet.ibm.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": "Initialize and free TPMBackend data members in it's own instance_init() and\ninstance_finalize methods.\n\nTook the opportunity to remove unneeded destroy() method from TpmDriverOps\ninterface as TPMBackend is a Qemu Object, we can use object_unref() inplace of\ntpm_backend_destroy() to free the backend object, hence removed destroy() from\nTPMDriverOps interface.\n\nSigned-off-by: Amarnath Valluri <amarnath.valluri@intel.com>\nReviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>\nReviewed-by: Stefan Berger <stefanb@linux.vnet.ibm.com>\n---\n backends/tpm.c | 16 ++++++----------\n hw/tpm/tpm_passthrough.c | 31 ++++++++++++-------------------\n include/sysemu/tpm_backend.h | 7 -------\n tpm.c | 2 +-\n 4 files changed, 19 insertions(+), 37 deletions(-)", "diff": "diff --git a/backends/tpm.c b/backends/tpm.c\nindex ce56c3b..cf5abf1 100644\n--- a/backends/tpm.c\n+++ b/backends/tpm.c\n@@ -51,15 +51,6 @@ const char *tpm_backend_get_desc(TPMBackend *s)\n return k->ops->desc();\n }\n \n-void tpm_backend_destroy(TPMBackend *s)\n-{\n- TPMBackendClass *k = TPM_BACKEND_GET_CLASS(s);\n-\n- k->ops->destroy(s);\n-\n- tpm_backend_thread_end(s);\n-}\n-\n int tpm_backend_init(TPMBackend *s, TPMState *state,\n TPMRecvDataCB *datacb)\n {\n@@ -182,17 +173,22 @@ static void tpm_backend_prop_set_opened(Object *obj, bool value, Error **errp)\n \n static void tpm_backend_instance_init(Object *obj)\n {\n+ TPMBackend *s = TPM_BACKEND(obj);\n+\n object_property_add_bool(obj, \"opened\",\n tpm_backend_prop_get_opened,\n tpm_backend_prop_set_opened,\n NULL);\n-\n+ s->fe_model = -1;\n }\n \n static void tpm_backend_instance_finalize(Object *obj)\n {\n TPMBackend *s = TPM_BACKEND(obj);\n \n+ g_free(s->id);\n+ g_free(s->path);\n+ g_free(s->cancel_path);\n tpm_backend_thread_end(s);\n }\n \ndiff --git a/hw/tpm/tpm_passthrough.c b/hw/tpm/tpm_passthrough.c\nindex f50d9cf..815a72e 100644\n--- a/hw/tpm/tpm_passthrough.c\n+++ b/hw/tpm/tpm_passthrough.c\n@@ -417,8 +417,6 @@ static TPMBackend *tpm_passthrough_create(QemuOpts *opts, const char *id)\n TPMPassthruState *tpm_pt = TPM_PASSTHROUGH(tb);\n \n tb->id = g_strdup(id);\n- /* let frontend set the fe_model to proper value */\n- tb->fe_model = -1;\n \n if (tpm_passthrough_handle_device_opts(opts, tb)) {\n goto err_exit;\n@@ -432,26 +430,11 @@ static TPMBackend *tpm_passthrough_create(QemuOpts *opts, const char *id)\n return tb;\n \n err_exit:\n- g_free(tb->id);\n+ object_unref(obj);\n \n return NULL;\n }\n \n-static void tpm_passthrough_destroy(TPMBackend *tb)\n-{\n- TPMPassthruState *tpm_pt = TPM_PASSTHROUGH(tb);\n-\n- tpm_passthrough_cancel_cmd(tb);\n-\n- qemu_close(tpm_pt->tpm_fd);\n- qemu_close(tpm_pt->cancel_fd);\n-\n- g_free(tb->id);\n- g_free(tb->path);\n- g_free(tb->cancel_path);\n- g_free(tpm_pt->tpm_dev);\n-}\n-\n static const QemuOptDesc tpm_passthrough_cmdline_opts[] = {\n TPM_STANDARD_CMDLINE_OPTS,\n {\n@@ -472,7 +455,6 @@ static const TPMDriverOps tpm_passthrough_driver = {\n .opts = tpm_passthrough_cmdline_opts,\n .desc = tpm_passthrough_create_desc,\n .create = tpm_passthrough_create,\n- .destroy = tpm_passthrough_destroy,\n .init = tpm_passthrough_init,\n .startup_tpm = tpm_passthrough_startup_tpm,\n .realloc_buffer = tpm_passthrough_realloc_buffer,\n@@ -486,10 +468,21 @@ static const TPMDriverOps tpm_passthrough_driver = {\n \n static void tpm_passthrough_inst_init(Object *obj)\n {\n+ TPMPassthruState *tpm_pt = TPM_PASSTHROUGH(obj);\n+\n+ tpm_pt->tpm_fd = -1;\n+ tpm_pt->cancel_fd = -1;\n }\n \n static void tpm_passthrough_inst_finalize(Object *obj)\n {\n+ TPMPassthruState *tpm_pt = TPM_PASSTHROUGH(obj);\n+\n+ tpm_passthrough_cancel_cmd(TPM_BACKEND(obj));\n+\n+ qemu_close(tpm_pt->tpm_fd);\n+ qemu_close(tpm_pt->cancel_fd);\n+ g_free(tpm_pt->tpm_dev);\n }\n \n static void tpm_passthrough_class_init(ObjectClass *klass, void *data)\ndiff --git a/include/sysemu/tpm_backend.h b/include/sysemu/tpm_backend.h\nindex 58308b3..202ec8d 100644\n--- a/include/sysemu/tpm_backend.h\n+++ b/include/sysemu/tpm_backend.h\n@@ -78,7 +78,6 @@ struct TPMDriverOps {\n const char *(*desc)(void);\n \n TPMBackend *(*create)(QemuOpts *opts, const char *id);\n- void (*destroy)(TPMBackend *t);\n \n /* initialize the backend */\n int (*init)(TPMBackend *t);\n@@ -118,12 +117,6 @@ enum TpmType tpm_backend_get_type(TPMBackend *s);\n const char *tpm_backend_get_desc(TPMBackend *s);\n \n /**\n- * tpm_backend_destroy:\n- * @s: the backend to destroy\n- */\n-void tpm_backend_destroy(TPMBackend *s);\n-\n-/**\n * tpm_backend_init:\n * @s: the backend to initialized\n * @state: TPMState\ndiff --git a/tpm.c b/tpm.c\nindex abedf3f..b19b1a3 100644\n--- a/tpm.c\n+++ b/tpm.c\n@@ -157,7 +157,7 @@ void tpm_cleanup(void)\n \n QLIST_FOREACH_SAFE(drv, &tpm_backends, list, next) {\n QLIST_REMOVE(drv, list);\n- tpm_backend_destroy(drv);\n+ object_unref(OBJECT(drv));\n }\n }\n \n", "prefixes": [ "v9", "3/8" ] }