From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 56A43CA0EFA for ; Tue, 26 Aug 2025 15:16:41 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uqvPA-0006Jy-NY; Tue, 26 Aug 2025 11:16:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uqvOw-0006CY-3I for qemu-rust@nongnu.org; Tue, 26 Aug 2025 11:16:03 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uqvOl-0004cH-OI for qemu-rust@nongnu.org; Tue, 26 Aug 2025 11:15:57 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1756221338; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=apDad2bbnrJVF3oXeIECJ1Y0YLrfwQbQii/KbeCcQC8=; b=In/w++ai/8mkyz9+w8nlyJO2ZgJc4QiF4j42YonCw72XJrqV9/SZE5VKNirdMf3x5TsyQ5 LAdamRbmVP1cxdhMZL2Nc9ssaxUA1KTWM5epdhpbXrdw0bm/zxtE16Ch3+iccnagJdVxFh WutNju+0P+O26axACcbrtQVJQ68JP5w= Received: from mail-pj1-f71.google.com (mail-pj1-f71.google.com [209.85.216.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-216-8MY6q66YNZ66_0e9sTTBtw-1; Tue, 26 Aug 2025 11:15:34 -0400 X-MC-Unique: 8MY6q66YNZ66_0e9sTTBtw-1 X-Mimecast-MFC-AGG-ID: 8MY6q66YNZ66_0e9sTTBtw_1756221333 Received: by mail-pj1-f71.google.com with SMTP id 98e67ed59e1d1-3259ff53c2eso3376938a91.1 for ; Tue, 26 Aug 2025 08:15:34 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1756221333; x=1756826133; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=apDad2bbnrJVF3oXeIECJ1Y0YLrfwQbQii/KbeCcQC8=; b=tJvTcVbWRDvhydRBjWKTZVHTY++UxM351ExjKuOsw58glBTCTlyydTJmEST0XedZAF Fo5RWST4CtYiSDAISo1RTCtyABmVwJlYjtDOAfCnE7k480mUAR+oabMrMO4X2dwktm49 YFJ0tn22w0tR980O0y34rsRc3a2aCqchy4Adk8A8STAkvzuoUM9vYojqvqX7YzTHn0tR XoS3rcs+YKNJg+XS24rUEZRRHPcnAwMsrrb74L5SWh+rIKIDa1jTjjVMxVQppnSkE6oX RC2fLZP39eCIDWOLs0pAVlgaB29xcyEi6o2iLeOzPBLBpdsNRiHglAuteumdS8tIqTkI hpyQ== X-Forwarded-Encrypted: i=1; AJvYcCXRbNU22deplmi57CK9iInmTid0K7JmMJAijgakvEtzst8gOe0dT8KSmrXjWcaXbwcUK0zrC0G3ba0=@nongnu.org X-Gm-Message-State: AOJu0YwgqlE7ZLGmiMsyS8OY8S/8cccpsSa25O7O93BhN/E80bexKmxq 7KuKYaoM7so/A28oxgjEeTHg+HZQEqANcj44cSsfzn7iqOZh8SOMwpW0Zf3g0AykKONFLRRO31L CFdXSIUF4e+Kfsve9Qo05hihukuxzBIc33CCCznkjYdg3pxTT2HXHhZxQ+334Se7rdd35gldWUC JH2Lnlq+f92be836mH1RtCbf4RU35ZEQ== X-Gm-Gg: ASbGncv+hoOFE4jfVHuwB2uah2qoejkzDvfCPAAuyOWjSkxlB+4jGOh6GxMFBBPGWMH 4d8CAmy3e9wuR5Xk/E0DJTP1eSDZrIISqS2/eKFfdu2vSGPnq5jPFlZrIVPNi0x6MeLpsBXdnfe kbJhQ41wvrGWY8rhAMKWPFVx49D9SjlDKJORSyqbJTGueVfl4fX9/HJA== X-Received: by 2002:a17:90b:5627:b0:31e:ec58:62e2 with SMTP id 98e67ed59e1d1-32515eaafdcmr23655326a91.19.1756221333181; Tue, 26 Aug 2025 08:15:33 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHq8i93LR3ff0gxtxLBPX6/1s3s+GQ5Ml3ArL3vvR8jvI/jkVOzNQWfA/aCg3NwOl2RtfUsOBO2qMyw7/ilrAM= X-Received: by 2002:a17:90b:5627:b0:31e:ec58:62e2 with SMTP id 98e67ed59e1d1-32515eaafdcmr23655255a91.19.1756221332411; Tue, 26 Aug 2025 08:15:32 -0700 (PDT) MIME-Version: 1.0 References: <20250826140449.4190022-1-marcandre.lureau@redhat.com> In-Reply-To: From: =?UTF-8?B?TWFyYy1BbmRyw6kgTHVyZWF1?= Date: Tue, 26 Aug 2025 19:15:21 +0400 X-Gm-Features: Ac12FXxbwuXqOT7ugEZ37qpRYFJOysdL_bpL1KsVr5pOzDYO4JWSPQYaafxdA-c Message-ID: Subject: Re: [RFC 00/18] rust: split qemu-api To: Paolo Bonzini Cc: qemu-devel@nongnu.org, =?UTF-8?Q?Daniel_P=2E_Berrang=C3=A9?= , qemu-rust@nongnu.org, =?UTF-8?Q?Philippe_Mathieu=2DDaud=C3=A9?= , Manos Pitsidianakis X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: iSh-iMlc9wZyA_LWeUhSYL60FW_Xxf9qW8N4AOj3bZo_1756221333 X-Mimecast-Originator: redhat.com Content-Type: multipart/alternative; boundary="000000000000aa6a5c063d462425" Received-SPF: pass client-ip=170.10.133.124; envelope-from=mlureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-rust@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: QEMU Rust-related patches and discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-rust-bounces+qemu-rust=archiver.kernel.org@nongnu.org Sender: qemu-rust-bounces+qemu-rust=archiver.kernel.org@nongnu.org --000000000000aa6a5c063d462425 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi On Tue, Aug 26, 2025 at 6:44=E2=80=AFPM Paolo Bonzini = wrote: > On 8/26/25 16:04, marcandre.lureau@redhat.com wrote: > > From: Marc-Andr=C3=A9 Lureau > > > > Hi, > > > > qemu-api is providing bindings for various internal libraries. Instead, > the > > bindings requirements should match the various libraries and use the > minimal set > > of dependencies. > > > > An initial Rust-only "common" crate is introduced, then "util" (for > libqemuutil, > > without bql), "migration" (so it doesn't depend on bql), "bql", "qom" > (arguably, > > bql shouldn't be required?), and "chardev", "system", "hwcore". Finally > the > > qemu-api crates are renamed and repurposed. > > > > This involves a lot of code churn, so hopefully it can be reviewed and > merged > > early and iterated upon :) > > The one comment that I would like to handle before merging, is that I'd > prefer to keep the preludes and, in fact, even add more exports to them > since they can now be chosen per-crate. Ideally, many of the crates > you've crated would be accessed through many "use xyz::prelude::*" > statements. > It's not very useful if you have to include all the preludes though :) Also, prelude feels a bit too much magic and may pollute namespace. In general, not so many crates provide them and that's usually a good thing imho, since you can explicitly import what you need, and LSP and good error report make that fairly trivial. So, I am not convinced having each crate its own prelude is a good thing, but I don't care much. Can easily be added back though. > > Also, if I understood correctly the split util/errno.rs can move to > common/. While it has a dependency on libc, it doesn't need bindgen. > > True, I will move it > There's a bunch of code duplication for the various bindings.rs and > build.rs files, which is not ideal but shouldn't grow much more than > this. I wonder if, later, common code across build.rs could be written > just once by adding a new crate (e.g. "qemu_meson") to the workspace, > that can be used as a build-dependency. > > I am not sure, but I can try. Alternatively, we can have a build.rs symlink, if we can guess the module path. --000000000000aa6a5c063d462425 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi

On Tue, Aug 26, 2= 025 at 6:44=E2=80=AFPM Paolo Bonzini <pbonzini@redhat.com> wrote:
On 8/26/25 16:04, marcandre.lureau@redhat.com wrote:
> From: Marc-Andr=C3=A9 Lureau <marcandre.lureau@redhat.com>
>
> Hi,
>
> qemu-api is providing bindings for various internal libraries. Instead= , the
> bindings requirements should match the various libraries and use the m= inimal set
> of dependencies.
>
> An initial Rust-only "common" crate is introduced, then &quo= t;util" (for libqemuutil,
> without bql), "migration" (so it doesn't depend on bql),= "bql", "qom" (arguably,
> bql shouldn't be required?), and "chardev", "system= ", "hwcore". Finally the
> qemu-api crates are renamed and repurposed.
>
> This involves a lot of code churn, so hopefully it can be reviewed and= merged
> early and iterated upon :)

The one comment that I would like to handle before merging, is that I'd=
prefer to keep the preludes and, in fact, even add more exports to them since they can now be chosen per-crate.=C2=A0 Ideally, many of the crates <= br> you've crated would be accessed through many "use xyz::prelude::*&= quot;
statements.

It's not very useful if= you have to include all the preludes though :)

Al= so, prelude feels a bit too much magic and may pollute namespace. In genera= l, not so many crates provide them and that's usually a good thing imho= ,=C2=A0since you can explicitly import what you need, and LSP and good erro= r report make that fairly trivial.

So, I am not co= nvinced having each crate its own prelude is a good thing, but I don't = care much. Can easily be added back though.
=C2=A0

Also, if I understood correctly the split util/errno.rs can move to
common/.=C2=A0 While it has a dependency on libc, it doesn't need bindg= en.


True, I will move it
=C2=A0<= /div>
There's a bunch of code duplication for the various bindings.rs and
build.rs files, which is not ideal but shouldn't grow much more than
this.=C2=A0 I wonder if, later, common code across
build.rs could be written
just once by adding a new crate (e.g. "qemu_meson") to the worksp= ace,
that can be used as a build-dependency.


I am not sure, but I can try. Alternat= ively, we can have a build.rs symlink, if w= e can guess the module path.
--000000000000aa6a5c063d462425--