From patchwork Fri Jan 8 06:38:51 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wen Congyang X-Patchwork-Id: 7982851 Return-Path: X-Original-To: patchwork-xen-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 69826BEEE5 for ; Fri, 8 Jan 2016 06:42:29 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 7574220172 for ; Fri, 8 Jan 2016 06:42:28 +0000 (UTC) Received: from lists.xen.org (lists.xenproject.org [50.57.142.19]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 555E520149 for ; Fri, 8 Jan 2016 06:42:27 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xen.org) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1aHQhi-0004go-MF; Fri, 08 Jan 2016 06:39:18 +0000 Received: from mail6.bemta4.messagelabs.com ([85.158.143.247]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1aHQhh-0004gS-5m for xen-devel@lists.xen.org; Fri, 08 Jan 2016 06:39:17 +0000 Received: from [85.158.143.35] by server-1.bemta-4.messagelabs.com id 0E/6B-09708-4995F865; Fri, 08 Jan 2016 06:39:16 +0000 X-Env-Sender: wency@cn.fujitsu.com X-Msg-Ref: server-13.tower-21.messagelabs.com!1452235153!7363967!1 X-Originating-IP: [59.151.112.132] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 7.35.1; banners=-,-,- X-VirusChecked: Checked Received: (qmail 38854 invoked from network); 8 Jan 2016 06:39:15 -0000 Received: from cn.fujitsu.com (HELO heian.cn.fujitsu.com) (59.151.112.132) by server-13.tower-21.messagelabs.com with SMTP; 8 Jan 2016 06:39:15 -0000 X-IronPort-AV: E=Sophos;i="5.20,346,1444665600"; d="scan'208";a="2364572" Received: from unknown (HELO cn.fujitsu.com) ([10.167.33.5]) by heian.cn.fujitsu.com with ESMTP; 08 Jan 2016 14:39:11 +0800 Received: from G08CNEXCHPEKD01.g08.fujitsu.local (unknown [10.167.33.80]) by cn.fujitsu.com (Postfix) with ESMTP id 47C59418910C; Fri, 8 Jan 2016 14:38:48 +0800 (CST) Received: from G08FNSTD140052.g08.fujitsu.local (10.167.226.52) by G08CNEXCHPEKD01.g08.fujitsu.local (10.167.33.89) with Microsoft SMTP Server (TLS) id 14.3.181.6; Fri, 8 Jan 2016 14:38:47 +0800 From: Wen Congyang To: xen devel , Andrew Cooper Date: Fri, 8 Jan 2016 14:38:51 +0800 Message-ID: <1452235131-1861-6-git-send-email-wency@cn.fujitsu.com> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1452235131-1861-1-git-send-email-wency@cn.fujitsu.com> References: <1452235131-1861-1-git-send-email-wency@cn.fujitsu.com> MIME-Version: 1.0 X-Originating-IP: [10.167.226.52] X-yoursite-MailScanner-ID: 47C59418910C.A6190 X-yoursite-MailScanner: Found to be clean X-yoursite-MailScanner-From: wency@cn.fujitsu.com X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Cc: Changlong Xie , Wei Liu , Ian Campbell , Wen Congyang , Ian Jackson , Shriram Rajagopalan , Yang Hongyang Subject: [Xen-devel] [PATCH v3 5/5] tools/libxl: remove unused function libxl__domain_save_device_model() X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP After the commit d77570e7, libxl__domain_save_device_model() can be dropped. Signed-off-by: Wen Congyang Acked-by: Ian Campbell --- tools/libxl/libxl.c | 4 -- tools/libxl/libxl_dom.c | 91 -------------------------------------------- tools/libxl/libxl_internal.h | 6 --- 3 files changed, 101 deletions(-) diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c index 9207621..c286881 100644 --- a/tools/libxl/libxl.c +++ b/tools/libxl/libxl.c @@ -1551,10 +1551,6 @@ static void stubdom_destroy_callback(libxl__egc *egc, dds->stubdom_finished = 1; savefile = libxl__device_model_savefile(gc, dis->domid); rc = libxl__remove_file(gc, savefile); - /* - * On suspend libxl__domain_save_device_model will have already - * unlinked the save file. - */ if (rc) { LOG(ERROR, "failed to remove device-model savefile %s", savefile); } diff --git a/tools/libxl/libxl_dom.c b/tools/libxl/libxl_dom.c index 47971a9..2269998 100644 --- a/tools/libxl/libxl_dom.c +++ b/tools/libxl/libxl_dom.c @@ -1785,97 +1785,6 @@ static void stream_done(libxl__egc *egc, domain_save_done(egc, sws->dss, rc); } -static void save_device_model_datacopier_done(libxl__egc *egc, - libxl__datacopier_state *dc, int rc, int onwrite, int errnoval); - -void libxl__domain_save_device_model(libxl__egc *egc, - libxl__domain_suspend_state *dss, - libxl__save_device_model_cb *callback) -{ - STATE_AO_GC(dss->ao); - struct stat st; - uint32_t qemu_state_len; - int rc; - - dss->save_dm_callback = callback; - - /* Convenience aliases */ - const char *const filename = dss->dm_savefile; - const int fd = dss->fd; - - libxl__datacopier_state *dc = &dss->save_dm_datacopier; - memset(dc, 0, sizeof(*dc)); - dc->readwhat = GCSPRINTF("qemu save file %s", filename); - dc->ao = ao; - dc->readfd = -1; - dc->writefd = fd; - dc->maxsz = INT_MAX; - dc->bytes_to_read = -1; - dc->copywhat = GCSPRINTF("qemu save file for domain %"PRIu32, dss->domid); - dc->writewhat = "save/migration stream"; - dc->callback = save_device_model_datacopier_done; - - dc->readfd = open(filename, O_RDONLY); - if (dc->readfd < 0) { - LOGE(ERROR, "unable to open %s", dc->readwhat); - rc = ERROR_FAIL; - goto out; - } - - if (fstat(dc->readfd, &st)) - { - LOGE(ERROR, "unable to fstat %s", dc->readwhat); - rc = ERROR_FAIL; - goto out; - } - - if (!S_ISREG(st.st_mode)) { - LOG(ERROR, "%s is not a plain file!", dc->readwhat); - rc = ERROR_FAIL; - goto out; - } - - qemu_state_len = st.st_size; - LOG(DEBUG, "%s is %d bytes", dc->readwhat, qemu_state_len); - - rc = libxl__datacopier_start(dc); - if (rc) goto out; - - libxl__datacopier_prefixdata(egc, dc, - QEMU_SIGNATURE, strlen(QEMU_SIGNATURE)); - - libxl__datacopier_prefixdata(egc, dc, - &qemu_state_len, sizeof(qemu_state_len)); - return; - - out: - save_device_model_datacopier_done(egc, dc, rc, -1, EIO); -} - -static void save_device_model_datacopier_done(libxl__egc *egc, - libxl__datacopier_state *dc, int our_rc, int onwrite, int errnoval) -{ - libxl__domain_suspend_state *dss = - CONTAINER_OF(dc, *dss, save_dm_datacopier); - STATE_AO_GC(dss->ao); - - /* Convenience aliases */ - const char *const filename = dss->dm_savefile; - int rc; - - libxl__datacopier_kill(dc); - - if (dc->readfd >= 0) { - close(dc->readfd); - dc->readfd = -1; - } - - rc = libxl__remove_file(gc, filename); - if (!our_rc) our_rc = rc; - - dss->save_dm_callback(egc, dss, our_rc); -} - static void libxl__remus_teardown(libxl__egc *egc, libxl__domain_suspend_state *dss, int rc); diff --git a/tools/libxl/libxl_internal.h b/tools/libxl/libxl_internal.h index a556a38..233d44a 100644 --- a/tools/libxl/libxl_internal.h +++ b/tools/libxl/libxl_internal.h @@ -3103,9 +3103,6 @@ struct libxl__domain_suspend_state { libxl__logdirty_switch logdirty; void (*callback_common_done)(libxl__egc*, struct libxl__domain_suspend_state*, int ok); - /* private for libxl__domain_save_device_model */ - libxl__save_device_model_cb *save_dm_callback; - libxl__datacopier_state save_dm_datacopier; }; @@ -3498,9 +3495,6 @@ static inline bool libxl__save_helper_inuse(const libxl__save_helper_state *shs) /* Each time the dm needs to be saved, we must call suspend and then save */ _hidden int libxl__domain_suspend_device_model(libxl__gc *gc, libxl__domain_suspend_state *dss); -_hidden void libxl__domain_save_device_model(libxl__egc *egc, - libxl__domain_suspend_state *dss, - libxl__save_device_model_cb *callback); _hidden const char *libxl__device_model_savefile(libxl__gc *gc, uint32_t domid);