From patchwork Fri Jan 31 15:01:43 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Durrant X-Patchwork-Id: 11360027 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 81FFA921 for ; Fri, 31 Jan 2020 15:03:21 +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 5E65C20705 for ; Fri, 31 Jan 2020 15:03:21 +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="Oa51lCYp" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5E65C20705 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 1ixXo4-0005wl-Ax; Fri, 31 Jan 2020 15:02:04 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1ixXo2-0005wX-QJ for xen-devel@lists.xenproject.org; Fri, 31 Jan 2020 15:02:02 +0000 X-Inumbo-ID: a08d3da2-443a-11ea-b211-bc764e2007e4 Received: from smtp-fw-6002.amazon.com (unknown [52.95.49.90]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id a08d3da2-443a-11ea-b211-bc764e2007e4; Fri, 31 Jan 2020 15:01:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazon201209; t=1580482919; x=1612018919; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=UwU9jIJ79IWsZ3Gqe1SBt9ApK0WlCHSaC/FXU5it7pk=; b=Oa51lCYp93NjIHHUTd4Y/6A1xP47bdWVyLN6baKDrOBfltNo4c5znP4M 9pKJtzK5SlQ3HKDANKHRSrZrWcaMnzxPtwL2Zlq6zOmz5BwQnhjZIQgIy 1vKImcdBWyZd1ULRBMdqNSQS7xQdhBWEZcNKglKesLYvmJWDeK1ds/2qs 8=; IronPort-SDR: QfWC5aNtDe4V69wKDzbiwaLXNaowIz1ldzam5cyZcPW+TsClfntb2seInjnnUjhmReENKDpoU3 wdjKGobCr9Vg== X-IronPort-AV: E=Sophos;i="5.70,386,1574121600"; d="scan'208";a="14194300" Received: from iad12-co-svc-p1-lb1-vlan3.amazon.com (HELO email-inbound-relay-2c-87a10be6.us-west-2.amazon.com) ([10.43.8.6]) by smtp-border-fw-out-6002.iad6.amazon.com with ESMTP; 31 Jan 2020 15:01:57 +0000 Received: from EX13MTAUEA002.ant.amazon.com (pdx4-ws-svc-p6-lb7-vlan2.pdx.amazon.com [10.170.41.162]) by email-inbound-relay-2c-87a10be6.us-west-2.amazon.com (Postfix) with ESMTPS id D7877A1E09; Fri, 31 Jan 2020 15:01:55 +0000 (UTC) Received: from EX13D32EUC001.ant.amazon.com (10.43.164.159) by EX13MTAUEA002.ant.amazon.com (10.43.61.77) with Microsoft SMTP Server (TLS) id 15.0.1236.3; Fri, 31 Jan 2020 15:01:55 +0000 Received: from EX13MTAUEE002.ant.amazon.com (10.43.62.24) by EX13D32EUC001.ant.amazon.com (10.43.164.159) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Fri, 31 Jan 2020 15:01:54 +0000 Received: from u2f063a87eabd5f.cbg10.amazon.com (10.125.106.135) by mail-relay.amazon.com (10.43.62.224) with Microsoft SMTP Server id 15.0.1367.3 via Frontend Transport; Fri, 31 Jan 2020 15:01:53 +0000 From: Paul Durrant To: Date: Fri, 31 Jan 2020 15:01:43 +0000 Message-ID: <20200131150149.2008-2-pdurrant@amazon.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200131150149.2008-1-pdurrant@amazon.com> References: <20200131150149.2008-1-pdurrant@amazon.com> MIME-Version: 1.0 Precedence: Bulk Subject: [Xen-devel] [PATCH v5 1/7] 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. NOTE: The value of INVALID_DOMID (~0) is distinct from the hypervisor's DOMID_INVALID. This patch preserves that value. Signed-off-by: Paul Durrant Acked-by: Ian Jackson --- Cc: Wei Liu Cc: Anthony PERARD v5: - Expand commit comment --- 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 2555aa4575..72290c6f28 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) /*