Received: by 2002:a05:6358:c692:b0:131:369:b2a3 with SMTP id fe18csp2234236rwb; Sat, 29 Jul 2023 02:45:15 -0700 (PDT) X-Google-Smtp-Source: APBJJlG5z3i/UuqNPU+bTGbkC7kOVBMpJ7Igtcm+m36vR7YHRRho+N2TzdAsacSJeCVzObKUbfEE X-Received: by 2002:a05:6a00:b44:b0:687:1a86:7a83 with SMTP id p4-20020a056a000b4400b006871a867a83mr2977945pfo.1.1690623915021; Sat, 29 Jul 2023 02:45:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690623915; cv=none; d=google.com; s=arc-20160816; b=nFTrxv882H9OOov+x1BJkK9Ynp3LyzwkDQ3TO4783RK/sfPI7D7rTYd32sDO8C+krA LXWgfSwmg/QyqJjX4nnRlQqvh2LGjGksHWlSH/0rQK4kvgFV7Hf7B/oZo0orTeNzNH+b 4M7uswbdWXb9y1n2rPS/bernT5aOIjjvJBHrssjEJWQzmJ3ja95+EmiqF/Df1bvwsKH0 TL/fntrAwwWNeGa4AAxkeHPThjj/qXhe3EvnhLtyfhAJfruzTD/XNHB9yW+kd2qokDbZ yrhtyDya8qeKRz3/C+fk9/+z8OuwpEKoTf1yy4Syg0JPA8Zrtc3lT1bYnk5T7BzDKkXT m2gA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :feedback-id:message-id:subject:cc:from:to:dkim-signature:date; bh=4lDtjHwaSFsAZDEy7KtHvYhEsNR9ASqMeTkQVXtY5AU=; fh=qm1bOEYzVYZKL4fg86TgWb8D+QJA9mGpUhKFp2A6Xio=; b=EMJ/GZIQNsdLZwsLMNliP35dIw9FopiPxDiXpEmlNDwk26zoWma3OfNOWWiZ5tXWAo wKHGXyEgabh8WlSf0TbQ9oLGJWIFxI50x5eS0VodrL5MWVl0dKjms9XdDqBuh8b28JVz ePLdcaPVMQno5lVbutYiOAQLpSFVMC9BHsxLAnEfpdNBi3cAg+lKe81CVpjyRVg7cmBp i7o71rzOYK10EVFL9vzZMpLifEeklv3HIYLLrd83icmI68SPmLPGYEgeXtHLjImN07Kz N9Q/m4/szbXBql90iYYdihHl2viUKBsng2TvjfeOXpa8Cgys/lVpiTTO9aSgqSNw95ak 2pYw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@proton.me header.s=protonmail header.b=SgUnpj5i; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=proton.me Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i132-20020a639d8a000000b00563fe2c1159si4334979pgd.467.2023.07.29.02.45.02; Sat, 29 Jul 2023 02:45:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@proton.me header.s=protonmail header.b=SgUnpj5i; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=proton.me Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231472AbjG2JJe (ORCPT + 99 others); Sat, 29 Jul 2023 05:09:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40454 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231470AbjG2JJa (ORCPT ); Sat, 29 Jul 2023 05:09:30 -0400 Received: from mail-4322.protonmail.ch (mail-4322.protonmail.ch [185.70.43.22]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3ADEE49EA for ; Sat, 29 Jul 2023 02:09:22 -0700 (PDT) Date: Sat, 29 Jul 2023 09:09:11 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=proton.me; s=protonmail; t=1690621758; x=1690880958; bh=4lDtjHwaSFsAZDEy7KtHvYhEsNR9ASqMeTkQVXtY5AU=; h=Date:To:From:Cc:Subject:Message-ID:Feedback-ID:From:To:Cc:Date: Subject:Reply-To:Feedback-ID:Message-ID:BIMI-Selector; b=SgUnpj5i8S1wDowm+nE6f6blDsWPn7GBfTuL2KBzzkzGbkG65CTNnF7WlUwJCDszw RxM9sfFsWbGo/vb8KQZDIHHRBLxdwfkOUD4zPF6Zjv+9+6+UDcNdJ3ssIwrFdN8Q85 /Yj9X0YlyHTm8ieNu7Hadr7IWvcayaHToRb4nSDMfbHLjONc3GtcRm/8D0ILLJe2CM 8mZc4pj2DCe/7EoiBjJfhvKRlyOKSzKzXLAUoqyJLjiF0RaVjObPL3X72NgH6MqaTe qP9Y4J2+GMfdswVKd2HEWdLLCVx91LyycHqtU0A/Ne77ZripOvqj3hL9gCGCv9NEAo vJw0rHjrloBow== To: Miguel Ojeda , Wedson Almeida Filho , Alex Gaynor From: Benno Lossin Cc: Boqun Feng , Gary Guo , =?utf-8?Q?Bj=C3=B6rn_Roy_Baron?= , Benno Lossin , Alice Ryhl , Andreas Hindborg , rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 00/13] Quality of life improvements for pin-init Message-ID: <20230729090838.225225-1-benno.lossin@proton.me> Feedback-ID: 71780778:user:proton MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_MSPIKE_H5, RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE, URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patch series adds several improvements to the pin-init api: - a derive macro for the `Zeroable` trait, - makes hygiene of fields in initializers behave like normal struct initializers would behave, - prevent stackoverflow without optimizations - add `..Zeroable::zeroed()` syntax to zero missing fields, - support arbitrary paths in initializer macros. It is based on the `rust-dev` branch. This is the third version of this patch series. - v2: https://lore.kernel.org/rust-for-linux/20230719141918.543938-1-benno.= lossin@proton.me/ - v1: https://lore.kernel.org/rust-for-linux/20230624092330.157338-1-benno.= lossin@proton.me/ Changes not present on modified commits: v2 -> v3: - make `#[pin_data]` work better with `#[cfg]` attributes on fields. v1 -> v2: - implement `Zeroable` for `Opaque`, - remove blanket impl of `PinInit` for `Init` and make it a supertrait instead, - add `{pin_}chain` functions to execute code after initialization, - update the example macro expansion. Benno Lossin (13): rust: init: consolidate init macros rust: init: make `#[pin_data]` compatible with conditional compilation of fields rust: add derive macro for `Zeroable` rust: init: make guards in the init macros hygienic rust: init: wrap type checking struct initializers in a closure rust: init: make initializer values inaccessible after initializing rust: init: add `..Zeroable::zeroed()` syntax for zeroing all missing fields rust: init: Add functions to create array initializers rust: init: add support for arbitrary paths in init macros rust: init: implement `Zeroable` for `UnsafeCell` and `Opaque` rust: init: make `PinInit` a supertrait of `Init` rust: init: add `{pin_}chain` functions to `{Pin}Init` rust: init: update expanded macro explanation rust/kernel/init.rs | 645 ++++++++++++++------------------- rust/kernel/init/__internal.rs | 39 +- rust/kernel/init/macros.rs | 519 +++++++++++++++++++++++--- rust/kernel/prelude.rs | 2 +- rust/macros/lib.rs | 20 + rust/macros/quote.rs | 6 + rust/macros/zeroable.rs | 72 ++++ 7 files changed, 850 insertions(+), 453 deletions(-) create mode 100644 rust/macros/zeroable.rs base-commit: 65fba633fcdf8c4c15ddc24a21d8e55094607e33 --=20 2.41.0