From patchwork Thu Jan 16 09:35:57 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Durrant X-Patchwork-Id: 11336419 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 88A7A921 for ; Thu, 16 Jan 2020 09:37:34 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 64DE32075B for ; Thu, 16 Jan 2020 09:37:34 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=amazon.com header.i=@amazon.com header.b="fnXIEPC1" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 64DE32075B Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=amazon.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1is1Zg-0006du-OW; Thu, 16 Jan 2020 09:36:24 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1is1Zg-0006dm-AA for xen-devel@lists.xenproject.org; Thu, 16 Jan 2020 09:36:24 +0000 X-Inumbo-ID: a32fd2b7-3843-11ea-86d6-12813bfff9fa Received: from smtp-fw-2101.amazon.com (unknown [72.21.196.25]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id a32fd2b7-3843-11ea-86d6-12813bfff9fa; Thu, 16 Jan 2020 09:36:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazon201209; t=1579167375; x=1610703375; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=3V67GdulIUlIp7ax4loPsJWuwUmHAyVEgdp0JH/zDD8=; b=fnXIEPC12umrtwVbt1/Az0N1NGXyuTQrwO7zniV7oLhcOD05SQXhCQ3g wXxLd7WR6iTvhAIxgh2yA7lZYX9kTbPl8K0Vfhi8q/uMgEMF/Xrjeyd9J HREY+IVxVa9sLyPtKMn7iAAaKwxv1rqmffZYAm//xdLpdHXlhSE5KAosG 8=; IronPort-SDR: jyYb6mM5sQZPY+oVg9MJEsKxp2BV5Gd6UOPMmTQNJQa3o6jKK4rBpowiOBqz/RIF/sbFQ4aPsr gug+VpVBO3sg== X-IronPort-AV: E=Sophos;i="5.70,325,1574121600"; d="scan'208";a="12699623" Received: from iad12-co-svc-p1-lb1-vlan2.amazon.com (HELO email-inbound-relay-2a-f14f4a47.us-west-2.amazon.com) ([10.43.8.2]) by smtp-border-fw-out-2101.iad2.amazon.com with ESMTP; 16 Jan 2020 09:36:13 +0000 Received: from EX13MTAUEA002.ant.amazon.com (pdx4-ws-svc-p6-lb7-vlan2.pdx.amazon.com [10.170.41.162]) by email-inbound-relay-2a-f14f4a47.us-west-2.amazon.com (Postfix) with ESMTPS id 2C9E5A2DFC; Thu, 16 Jan 2020 09:36:12 +0000 (UTC) Received: from EX13D32EUB002.ant.amazon.com (10.43.166.114) by EX13MTAUEA002.ant.amazon.com (10.43.61.77) with Microsoft SMTP Server (TLS) id 15.0.1236.3; Thu, 16 Jan 2020 09:36:11 +0000 Received: from EX13MTAUWA001.ant.amazon.com (10.43.160.58) by EX13D32EUB002.ant.amazon.com (10.43.166.114) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Thu, 16 Jan 2020 09:36:10 +0000 Received: from u2f063a87eabd5f.cbg10.amazon.com (10.125.106.135) by mail-relay.amazon.com (10.43.160.118) with Microsoft SMTP Server id 15.0.1367.3 via Frontend Transport; Thu, 16 Jan 2020 09:36:09 +0000 From: Paul Durrant To: Date: Thu, 16 Jan 2020 09:35:57 +0000 Message-ID: <20200116093602.4203-2-pdurrant@amazon.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200116093602.4203-1-pdurrant@amazon.com> References: <20200116093602.4203-1-pdurrant@amazon.com> MIME-Version: 1.0 Precedence: Bulk Subject: [Xen-devel] [PATCH v3 1/6] libxl: add definition of INVALID_DOMID to the API X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Anthony PERARD , Paul Durrant , Ian Jackson , Wei Liu Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" Currently both xl and libxl have internal definitions of INVALID_DOMID which happen to be identical. However, for the purposes of describing the behaviour of libxl_domain_create_new/restore() it is useful to have a specified invalid value for a domain id. This patch therefore moves the libxl definition from libxl_internal.h to libxl.h and removes the internal definition from xl_utils.h. The hardcoded '-1' passed back via domcreate_complete() is then updated to INVALID_DOMID and comment above libxl_domain_create_new/restore() is accordingly modified. Signed-off-by: Paul Durrant Acked-by: Ian Jackson --- Cc: Wei Liu Cc: Anthony PERARD --- tools/libxl/libxl.h | 4 +++- tools/libxl/libxl_create.c | 2 +- tools/libxl/libxl_internal.h | 1 - tools/xl/xl_utils.h | 2 -- 4 files changed, 4 insertions(+), 5 deletions(-) diff --git a/tools/libxl/libxl.h b/tools/libxl/libxl.h index 54abb9db1f..18c1a2d6bf 100644 --- a/tools/libxl/libxl.h +++ b/tools/libxl/libxl.h @@ -1527,9 +1527,11 @@ int libxl_ctx_free(libxl_ctx *ctx /* 0 is OK */); /* domain related functions */ +#define INVALID_DOMID ~0 + /* If the result is ERROR_ABORTED, the domain may or may not exist * (in a half-created state). *domid will be valid and will be the - * domain id, or -1, as appropriate */ + * domain id, or INVALID_DOMID, as appropriate */ int libxl_domain_create_new(libxl_ctx *ctx, libxl_domain_config *d_config, uint32_t *domid, diff --git a/tools/libxl/libxl_create.c b/tools/libxl/libxl_create.c index 32d45dcef0..bc425fee32 100644 --- a/tools/libxl/libxl_create.c +++ b/tools/libxl/libxl_create.c @@ -1773,7 +1773,7 @@ static void domcreate_complete(libxl__egc *egc, libxl__domain_destroy(egc, &dcs->dds); return; } - dcs->guest_domid = -1; + dcs->guest_domid = INVALID_DOMID; } dcs->callback(egc, dcs, rc, dcs->guest_domid); } diff --git a/tools/libxl/libxl_internal.h b/tools/libxl/libxl_internal.h index ba8c9b41ab..3b708fba8f 100644 --- a/tools/libxl/libxl_internal.h +++ b/tools/libxl/libxl_internal.h @@ -121,7 +121,6 @@ #define STUBDOM_SPECIAL_CONSOLES 3 #define TAP_DEVICE_SUFFIX "-emu" #define DOMID_XS_PATH "domid" -#define INVALID_DOMID ~0 #define PVSHIM_BASENAME "xen-shim" #define PVSHIM_CMDLINE "pv-shim console=xen,pv" diff --git a/tools/xl/xl_utils.h b/tools/xl/xl_utils.h index 7b9ccca30a..d98b419f10 100644 --- a/tools/xl/xl_utils.h +++ b/tools/xl/xl_utils.h @@ -52,8 +52,6 @@ #define STR_SKIP_PREFIX( a, b ) \ ( STR_HAS_PREFIX(a, b) ? ((a) += strlen(b), 1) : 0 ) -#define INVALID_DOMID ~0 - #define LOG(_f, _a...) dolog(__FILE__, __LINE__, __func__, _f "\n", ##_a) /*