From patchwork Tue Dec 24 13:04:11 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Durrant X-Patchwork-Id: 11309325 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 C01FE13A4 for ; Tue, 24 Dec 2019 13:05:57 +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 9CB4D206B7 for ; Tue, 24 Dec 2019 13:05:57 +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="lakU7nnV" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9CB4D206B7 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 1ijjrm-0005Ph-HX; Tue, 24 Dec 2019 13:04:50 +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 1ijjrk-0005P1-Ro for xen-devel@lists.xenproject.org; Tue, 24 Dec 2019 13:04:48 +0000 X-Inumbo-ID: f04e20ab-264d-11ea-97ba-12813bfff9fa Received: from smtp-fw-9101.amazon.com (unknown [207.171.184.25]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id f04e20ab-264d-11ea-97ba-12813bfff9fa; Tue, 24 Dec 2019 13:04:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazon201209; t=1577192678; x=1608728678; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=8yV9OhAFczXqA60/NNY/VsUpkx8SzXjkFLHYyVQtSoM=; b=lakU7nnVSnQBPp5Xzh2wyZb/1cfjj2JI2Y/4ntQdXmWZUonETBotCPac u175uPu/ik0NI9gl5KoAPLMRYAjNqcn/S6evmE0jEVBVa+FUOSNW2TkiH RCkAnRJASv8WLzEnsaSLGHzOCBH0baBBsJsfxe0E6FRZz2sps8y8U0bfy Q=; IronPort-SDR: m+VxJJKoPG0Qmt6ee74Z7AG07kGp8Tiht3iydkfPSO+RGFJUChfsZ+uPxkfm5YVsgJPd/6kkXk lb2nnLmLh9dw== X-IronPort-AV: E=Sophos;i="5.69,351,1571702400"; d="scan'208";a="6955867" Received: from sea32-co-svc-lb4-vlan3.sea.corp.amazon.com (HELO email-inbound-relay-1d-38ae4ad2.us-east-1.amazon.com) ([10.47.23.38]) by smtp-border-fw-out-9101.sea19.amazon.com with ESMTP; 24 Dec 2019 13:04:28 +0000 Received: from EX13MTAUEA001.ant.amazon.com (iad55-ws-svc-p15-lb9-vlan3.iad.amazon.com [10.40.159.166]) by email-inbound-relay-1d-38ae4ad2.us-east-1.amazon.com (Postfix) with ESMTPS id B56E2A2CF9; Tue, 24 Dec 2019 13:04:25 +0000 (UTC) Received: from EX13D32EUC002.ant.amazon.com (10.43.164.94) by EX13MTAUEA001.ant.amazon.com (10.43.61.82) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Tue, 24 Dec 2019 13:04:24 +0000 Received: from EX13MTAUWB001.ant.amazon.com (10.43.161.207) by EX13D32EUC002.ant.amazon.com (10.43.164.94) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Tue, 24 Dec 2019 13:04:24 +0000 Received: from u2f063a87eabd5f.cbg10.amazon.com (10.125.106.135) by mail-relay.amazon.com (10.43.161.249) with Microsoft SMTP Server id 15.0.1367.3 via Frontend Transport; Tue, 24 Dec 2019 13:04:21 +0000 From: Paul Durrant To: Date: Tue, 24 Dec 2019 13:04:11 +0000 Message-ID: <20191224130416.3570-2-pdurrant@amazon.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191224130416.3570-1-pdurrant@amazon.com> References: <20191224130416.3570-1-pdurrant@amazon.com> MIME-Version: 1.0 Precedence: Bulk Subject: [Xen-devel] [PATCH 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: 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 b5adbfe4b7..a15778952c 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) /*