From nobody Mon Feb 9 14:01:37 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=reject dis=none) header.from=citrix.com ARC-Seal: i=1; a=rsa-sha256; t=1610751556; cv=none; d=zohomail.com; s=zohoarc; b=F7jw9SzNayaYPPGYbNObbg2iYBfYQ4SZ7RW4tEOQFJiCN68XuuRvnAGiheulFhqBYbXbNDIrGqwyjt5NUHTwLzUtS/Yc30U+pOjDEWb37z3lfcwDExx5+K2PeQR7czdTwhRv0lDT4Jzk92QduD89LgTsduVc/Wu8t9s469LMDk0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1610751556; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=J0bUyhWwWkrSeOzEcBj5+InHuiWagSI45sYQYpKlKOw=; b=PXJrKNU8g64OR+g66KtV7UVtudwMtdAhIyBYbnabEOliPvLV9StFoI96kjWijyZAPESQKxJB0VjbvQdzzTzdQ/9oGLm9wruTAmxIrVQrRFBFA3iguTIrWveI30h21Jm62TU0flOIWivZmYgzq12enVUWw9VWulFIqiwUOfSOK4U= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=reject dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1610751556620760.8314231596653; Fri, 15 Jan 2021 14:59:16 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.68772.123236 (Exim 4.92) (envelope-from ) id 1l0Y3U-0003Bk-Aa; Fri, 15 Jan 2021 22:58:56 +0000 Received: by outflank-mailman (output) from mailman id 68772.123236; Fri, 15 Jan 2021 22:58:56 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1l0Y3U-0003BQ-6i; Fri, 15 Jan 2021 22:58:56 +0000 Received: by outflank-mailman (input) for mailman id 68772; Fri, 15 Jan 2021 22:58:54 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1l0Xyv-0001Wj-2v for xen-devel@lists.xenproject.org; Fri, 15 Jan 2021 22:54:13 +0000 Received: from esa6.hc3370-68.iphmx.com (unknown [216.71.155.175]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 629a213d-4dfe-4247-bf5f-c08231a24f78; Fri, 15 Jan 2021 22:52:49 +0000 (UTC) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 629a213d-4dfe-4247-bf5f-c08231a24f78 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1610751169; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=1fmXH+SV34jkCGcRhwIYTVVlbOpuedtyRttAjPwZ3tU=; b=CcVuX5iQNs+fVN63dfSRrLsvA6q/seyVFIkFDcNfMshZNM9Zj/oeWIaT yWVvjYZeLE7utfh4e4joa2CAmoq0335CYfWqitAN2fOMefSsD6hLl2lPo jqTK5rmY0QcMwhqgQBBVBlwJfYe7uMgHvvgVoucDopKQIloAdzVuW8SSl 8=; Authentication-Results: esa6.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none IronPort-SDR: T6uE9a3+Hbivy7ic5p4Ho0uLZWHlEkl/q9h05/gdILwahYLCt++JDR8X6X08cYBMinvb6OivdF k+wPABfO6WAvOhXxAmB0ZcqtXv1dihG/xvPO1wfuV5Z9rJq3o6r9tnaDbC8UJiU/CriNC5PeKS 3wNLaVbm7iqU/z1uyFMTPCOOLjbEvxsTftN5AUQ8HxSYUf77VIfzRwM0dpye0XtkGw8joJBB03 Cnye1B64S1R6F0ywp2GmreXqXGUvj0miEoHp1xoz6N3Sc1RuluJbMVIwv7NWjAgA2klCqqDRGb 5Tk= X-SBRS: 5.1 X-MesageID: 35435287 X-Ironport-Server: esa6.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.79,350,1602561600"; d="scan'208";a="35435287" From: =?UTF-8?q?Edwin=20T=C3=B6r=C3=B6k?= To: CC: =?UTF-8?q?Edwin=20T=C3=B6r=C3=B6k?= , "Christian Lindig" , David Scott , "Ian Jackson" , Wei Liu Subject: [PATCH v2 2/2] tools/ocaml/libs/xc: backward compatible domid control at domain creation time Date: Fri, 15 Jan 2021 22:28:53 +0000 Message-ID: <610924e3a2a426cfe1d7a614c095c15a095c3475.1610748224.git.edvin.torok@citrix.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @citrix.com) One can specify the domid to use when creating the domain, but this was har= dcoded to 0. Keep the existing `domain_create` function, and make domid an optional argu= ment. When not specified default to 0. A new version of xenopsd can choose to start using this, while old versions= of xenopsd will keep building and using the old API. (The ABI will change, but that changes every time a function is introduced/= removed or modified) Controlling the domid can be useful during testing or migration. Signed-off-by: Edwin T=C3=B6r=C3=B6k Acked-by: Christian Lindig --- Changed since V1: * introduced an optional ?domid for better backwards compatibility * use CAMLparam3 because we have an additional parameter --- tools/ocaml/libs/xc/xenctrl.ml | 5 ++++- tools/ocaml/libs/xc/xenctrl.mli | 4 ++-- tools/ocaml/libs/xc/xenctrl_stubs.c | 6 +++--- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/tools/ocaml/libs/xc/xenctrl.ml b/tools/ocaml/libs/xc/xenctrl.ml index e878699b0a..e0a47c4769 100644 --- a/tools/ocaml/libs/xc/xenctrl.ml +++ b/tools/ocaml/libs/xc/xenctrl.ml @@ -179,9 +179,12 @@ let with_intf f =3D handle :=3D Some h; f h =20 -external domain_create: handle -> domctl_create_config -> domid +external domain_create_stub: handle -> domid -> domctl_create_config -> do= mid =3D "stub_xc_domain_create" =20 +let domain_create handle ?(domid=3D0) config =3D + domain_create_stub handle domid config + external domain_sethandle: handle -> domid -> string -> unit =3D "stub_xc_domain_sethandle" =20 diff --git a/tools/ocaml/libs/xc/xenctrl.mli b/tools/ocaml/libs/xc/xenctrl.= mli index e64907df8e..84311fa33d 100644 --- a/tools/ocaml/libs/xc/xenctrl.mli +++ b/tools/ocaml/libs/xc/xenctrl.mli @@ -143,8 +143,8 @@ val get_handle: unit -> handle option * would invalidate the handle that with_intf passes to its argument. *) val close_handle: unit -> unit =20 -external domain_create : handle -> domctl_create_config -> domid - =3D "stub_xc_domain_create" +val domain_create: handle -> ?domid:int -> domctl_create_config -> domid + external domain_sethandle : handle -> domid -> string -> unit =3D "stub_xc= _domain_sethandle" external domain_max_vcpus : handle -> domid -> int -> unit =3D "stub_xc_domain_max_vcpus" diff --git a/tools/ocaml/libs/xc/xenctrl_stubs.c b/tools/ocaml/libs/xc/xenc= trl_stubs.c index 94aba38a42..9a8dbe5579 100644 --- a/tools/ocaml/libs/xc/xenctrl_stubs.c +++ b/tools/ocaml/libs/xc/xenctrl_stubs.c @@ -175,9 +175,9 @@ static unsigned int ocaml_list_to_c_bitmap(value l) return val; } =20 -CAMLprim value stub_xc_domain_create(value xch, value config) +CAMLprim value stub_xc_domain_create(value xch, value wanted_domid, value = config) { - CAMLparam2(xch, config); + CAMLparam3(xch, wanted_domid, config); CAMLlocal2(l, arch_domconfig); =20 /* Mnemonics for the named fields inside domctl_create_config */ @@ -191,7 +191,7 @@ CAMLprim value stub_xc_domain_create(value xch, value c= onfig) #define VAL_MAX_MAPTRACK_FRAMES Field(config, 7) #define VAL_ARCH Field(config, 8) =20 - uint32_t domid =3D 0; + uint32_t domid =3D Int_val(wanted_domid); int result; struct xen_domctl_createdomain cfg =3D { .ssidref =3D Int32_val(VAL_SSIDREF), --=20 2.29.2