Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp8276009rwp; Wed, 19 Jul 2023 07:41:53 -0700 (PDT) X-Google-Smtp-Source: APBJJlF/dUPjPJU3ENYxOIpqhsUudPUQuFB+NKD9ELIOTyc3Zvc+2MBK96XAmr/XDLw3e+soHtvb X-Received: by 2002:a05:6a20:230a:b0:137:23f1:4281 with SMTP id n10-20020a056a20230a00b0013723f14281mr1803843pzc.12.1689777712615; Wed, 19 Jul 2023 07:41:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689777712; cv=none; d=google.com; s=arc-20160816; b=wfutHGHPUizhUSQDoWcPBHVBL06WXQtbn2YF0/ESM9WhicHY/Pj7RP9dKHgME2/8fS t93qDP6p0VJRTQNVfVt1wb3xWOHGhR2WQ9WLDyWQqstgYELbomWhAz2vI6zihdKVWv6B YwP6ubl6RhBPkCYTG+e1WPinBVVr08R+nVzXLCLkHRTRA4mGxON9MI9denhWJ2BewfuT B0Y4w8DBzwg5VpSIUo8sYMcvGX/R7D8058QVazYeHf6bTiAwL9uIQGEPkWCitl7T6RDR cbSIHw4TzXpHEjlm6b5rSVoJi3KuhCReXUacT/C/eg5BKZgNZRQjs5pD7WgCYgHtUkMF yb9A== 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=5SJbhv9m6kCeMleleWVbb/UYtgrGWulTiGHG+cg8WBA=; fh=qm1bOEYzVYZKL4fg86TgWb8D+QJA9mGpUhKFp2A6Xio=; b=ECZ2aNokOqyqR/0tqaFKZHBAZosoXfl0E2pBgdnvoE4vnWY0lMcvYm55vT2MwmcjQs eC0aKuBrSdv5JdZWtzleaZ+QxKQiogdXmxXAEI/qcD3bBRfBNfspn0ad4e0NEds68QJD UM+vm4cyfp2/KqkDMdFbiTZ80SULEFCKlcQxdWTv/7EVAnOrx+P9a4WSmzAqCAzedEU0 gWCeuNY78N7g5DjvX80LVX45bVBMrq1D2QWuTshz3237wFRGhCWz5/mSy5g86FGt6nKh opwLPHhi/jfe9KIotfn+Tgpe8r2O72G9YqBJhjF7Kg/mYIdRKQhBurBTr7fGk7Q/Yaao C9fw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@proton.me header.s=protonmail header.b=kmhDij1p; 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 u14-20020a63140e000000b0054481da6ee5si3640911pgl.418.2023.07.19.07.41.40; Wed, 19 Jul 2023 07:41:52 -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=kmhDij1p; 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 S229997AbjGSOU2 (ORCPT + 99 others); Wed, 19 Jul 2023 10:20:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50248 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229719AbjGSOU2 (ORCPT ); Wed, 19 Jul 2023 10:20:28 -0400 Received: from mail-40131.protonmail.ch (mail-40131.protonmail.ch [185.70.40.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5632F1724 for ; Wed, 19 Jul 2023 07:20:24 -0700 (PDT) Date: Wed, 19 Jul 2023 14:20:09 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=proton.me; s=protonmail; t=1689776421; x=1690035621; bh=5SJbhv9m6kCeMleleWVbb/UYtgrGWulTiGHG+cg8WBA=; h=Date:To:From:Cc:Subject:Message-ID:Feedback-ID:From:To:Cc:Date: Subject:Reply-To:Feedback-ID:Message-ID:BIMI-Selector; b=kmhDij1pQxsoRyCm1+cSe+7Q+VQOSCyh9ffpcou+mSBIgZGC9goGmf41pthvwTrIS rqx2BAUhQGUYlxKM/ThHc8crn7GiKVaY3Nry2seX6cXum3uH38bDEOUDsCdjuVyibK MFg4fMLVSc5cg3WkLKqxMNdMiTrHV+YfY4JT8GCsEvFZokXW+iFN2vidrcTR/7e2GZ ozbHJCXxc7VNKDjXApk1MTKRexz3JGxKcG6ysoJ0If6Krg5UWWi2nYRf/I/5aX1Q14 O/W87QFHNXQPVSEtICNhLIskDXcdP75P7by+5rNZ/XgBk+ByB6z1GPebrZkyxmcHOW UhJagI3r77Olg== 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 v2 00/12] Quality of life improvements for pin-init Message-ID: <20230719141918.543938-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_DNSWL_BLOCKED, 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 This is the second version of this patch series. * v1: https://lore.kernel.org/rust-for-linux/20230624092330.157338-1-benno.= lossin@proton.me/ Changes not present on modified commits: 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 (12): rust: init: consolidate init macros 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 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 | 633 ++++++++++++++------------------- rust/kernel/init/__internal.rs | 39 +- rust/kernel/init/macros.rs | 510 +++++++++++++++++++++++--- rust/kernel/prelude.rs | 2 +- rust/kernel/types.rs | 2 + rust/macros/lib.rs | 20 ++ rust/macros/quote.rs | 6 + rust/macros/zeroable.rs | 25 ++ 8 files changed, 784 insertions(+), 453 deletions(-) create mode 100644 rust/macros/zeroable.rs base-commit: 6946437838b0ec7c976252f5d1872d4d8b679515 --=20 2.41.0