From patchwork Wed Dec 30 02:29:06 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wen Congyang X-Patchwork-Id: 7931401 Return-Path: X-Original-To: patchwork-xen-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 344089F350 for ; Wed, 30 Dec 2015 02:32:46 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 4B56A20204 for ; Wed, 30 Dec 2015 02:32:45 +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 4A7E620220 for ; Wed, 30 Dec 2015 02:32:44 +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 1aE6Ws-0000N9-Qc; Wed, 30 Dec 2015 02:30:22 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1aE6Ws-0000Kt-3H for xen-devel@lists.xen.org; Wed, 30 Dec 2015 02:30:22 +0000 Received: from [85.158.139.211] by server-10.bemta-5.messagelabs.com id 05/81-17090-DB143865; Wed, 30 Dec 2015 02:30:21 +0000 X-Env-Sender: wency@cn.fujitsu.com X-Msg-Ref: server-6.tower-206.messagelabs.com!1451442578!12896190!7 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 42007 invoked from network); 30 Dec 2015 02:30:17 -0000 Received: from cn.fujitsu.com (HELO heian.cn.fujitsu.com) (59.151.112.132) by server-6.tower-206.messagelabs.com with SMTP; 30 Dec 2015 02:30:17 -0000 X-IronPort-AV: E=Sophos;i="5.20,346,1444665600"; d="scan'208";a="2079701" Received: from unknown (HELO cn.fujitsu.com) ([10.167.33.5]) by heian.cn.fujitsu.com with ESMTP; 30 Dec 2015 10:29:47 +0800 Received: from G08CNEXCHPEKD01.g08.fujitsu.local (unknown [10.167.33.80]) by cn.fujitsu.com (Postfix) with ESMTP id EF7F141890F3; Wed, 30 Dec 2015 10:29:31 +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; Wed, 30 Dec 2015 10:29:31 +0800 From: Wen Congyang To: xen devel , Andrew Cooper , Ian Campbell , Ian Jackson , Wei Liu Date: Wed, 30 Dec 2015 10:29:06 +0800 Message-ID: <1451442548-26974-17-git-send-email-wency@cn.fujitsu.com> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1451442548-26974-1-git-send-email-wency@cn.fujitsu.com> References: <1451442548-26974-1-git-send-email-wency@cn.fujitsu.com> MIME-Version: 1.0 X-Originating-IP: [10.167.226.52] X-yoursite-MailScanner-ID: EF7F141890F3.A95BE 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: Lars Kurth , Changlong Xie , Wen Congyang , Gui Jianfeng , Jiang Yunhong , Dong Eddie , Shriram Rajagopalan , Yang Hongyang Subject: [Xen-devel] [PATCH v6 16/18] tools/libxl: store remus_ops in checkpoint device state 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 Checkpoint device is an abstract layer to do checkpoint. COLO can also use it to do checkpoint. But there are still some codes in checkpoint device which touch remus. This patch and the following 2 will seperate remus from checkpoint device layer. We use remus ops directly in checkpoint device. Store it in checkpoint device state so that we do not aware of remus_ops in the checkpoint device layer. it is pure refactoring and no functional changes. Signed-off-by: Wen Congyang Signed-off-by: Yang Hongyang Acked-by:Ian Campbell Reviewed-by: Konrad Rzeszutek Wilk --- tools/libxl/libxl_checkpoint_device.c | 10 +--------- tools/libxl/libxl_internal.h | 2 ++ tools/libxl/libxl_remus.c | 9 +++++++++ 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/tools/libxl/libxl_checkpoint_device.c b/tools/libxl/libxl_checkpoint_device.c index 226f159..bbc6dc4 100644 --- a/tools/libxl/libxl_checkpoint_device.c +++ b/tools/libxl/libxl_checkpoint_device.c @@ -17,14 +17,6 @@ #include "libxl_internal.h" -extern const libxl__checkpoint_device_instance_ops remus_device_nic; -extern const libxl__checkpoint_device_instance_ops remus_device_drbd_disk; -static const libxl__checkpoint_device_instance_ops *remus_ops[] = { - &remus_device_nic, - &remus_device_drbd_disk, - NULL, -}; - /*----- helper functions -----*/ static int init_device_subkind(libxl__checkpoint_devices_state *cds) @@ -172,7 +164,7 @@ static void device_setup_iterate(libxl__egc *egc, libxl__ao_device *aodev) goto out; do { - dev->ops = remus_ops[++dev->ops_index]; + dev->ops = dev->cds->ops[++dev->ops_index]; if (!dev->ops) { libxl_device_nic * nic = NULL; libxl_device_disk * disk = NULL; diff --git a/tools/libxl/libxl_internal.h b/tools/libxl/libxl_internal.h index 5b99d6e..914ce94 100644 --- a/tools/libxl/libxl_internal.h +++ b/tools/libxl/libxl_internal.h @@ -2895,6 +2895,8 @@ struct libxl__checkpoint_devices_state { uint32_t domid; libxl__checkpoint_callback *callback; int device_kind_flags; + /* The ops must be pointer array, and the last ops must be NULL */ + const libxl__checkpoint_device_instance_ops **ops; /*----- private for abstract layer only -----*/ diff --git a/tools/libxl/libxl_remus.c b/tools/libxl/libxl_remus.c index d088dad..3375331 100644 --- a/tools/libxl/libxl_remus.c +++ b/tools/libxl/libxl_remus.c @@ -18,6 +18,14 @@ #include "libxl_internal.h" +extern const libxl__checkpoint_device_instance_ops remus_device_nic; +extern const libxl__checkpoint_device_instance_ops remus_device_drbd_disk; +static const libxl__checkpoint_device_instance_ops *remus_ops[] = { + &remus_device_nic, + &remus_device_drbd_disk, + NULL, +}; + /*-------------------- Remus setup and teardown ---------------------*/ static void remus_setup_done(libxl__egc *egc, @@ -50,6 +58,7 @@ void libxl__remus_setup(libxl__egc *egc, cds->ao = ao; cds->domid = dss->domid; cds->callback = remus_setup_done; + cds->ops = remus_ops; dss->sws.checkpoint_callback = remus_checkpoint_stream_written;