Received: by 2002:ab2:1149:0:b0:1f3:1f8c:d0c6 with SMTP id z9csp54468lqz; Fri, 29 Mar 2024 08:20:30 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUPoillJ230V4oagMio5zMwIUDaD1zag0uVR1R7NnIthPPue1Nkl30CGsxUrzyfYEYn0N6YSh9kCkHVa/E4nC14pLfQbNZcCL/Nxilo0Q== X-Google-Smtp-Source: AGHT+IFt55tKesdgPYVtXcOJbrCF99nNLelBY3P+kYIecDn2ZLMKu3iP7/SLu8I9zWb9l+IgfBGY X-Received: by 2002:a17:90b:4a88:b0:2a0:8bba:f997 with SMTP id lp8-20020a17090b4a8800b002a08bbaf997mr2301890pjb.32.1711725630489; Fri, 29 Mar 2024 08:20:30 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711725630; cv=pass; d=google.com; s=arc-20160816; b=M7oAD5V+tp6bQGrbzEc54slZuWkQKQSYMuZ1NZmy4mu/6GIo9Su2WGTk1Oa32fFsYs wgYPg3/nsNmyj5PIUDboUVdpDpWT4Q6Pq//FDkzhs9HAqWqjGTZeVDXFCUkeLQCXFvhk Ft6wSy/u4BGoL5mI5XRdQuR8hCDPIRZ/9FH1lP2TV08VBLXO/yRqMGyzccy43Kz+DQBz hmHG64a1e8sKeK1c6GOS1dhiMAlK9ZL9tPUoDw9ARnFjTnKY4pLVR7/zzpaW1VHdCAiD PSL4txPk1J0S+Qff28YKf4ay9qnKb4X2oxai0nr+Iq9SkZ63ncSo0pxLBKlVeE5NIwUQ O1Bg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:feedback-id:references :in-reply-to:message-id:subject:cc:from:to:date:dkim-signature; bh=TwY71wkAkVzxEFQEXuu91xb0QlVVxXbICyOBQ0qK7/Y=; fh=A/Ua4Q351kuGQC3NJfXQlutNC8uk5uNbUXW4Yyk8Cas=; b=hEi3nIdnsb710rv3F9rXvP+PHZJfPO4rg/3PjJKKBXK3QMepbQIrFdYFH+zd5JRWke rs6I+zRb/5gmDMHVCO0uHVgWjBm72+zq4uKVV70GOANaX62UsR6DrS4yy1Zgv/ImMTpg kTaJlF6CsXp/ZiiSOgJOuFgiiXJxkA+6bKM7+HNUwArL3d1UwA014NZn1LZtPTzOxRK7 A+SqWYon7j5mbgu4jMbvoiDr85jw8W3+fPEfFOy3M8SP70fW+vWGpqkveIsMNXfmhxp8 tcI82m1dpBSI91+piX8DHN0MwUO6Bh/4zd25Su0UuGgWqG041p63R9Oa3uqWQnIPV4Bn s3jA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@proton.me header.s=protonmail header.b="L/9teXmA"; arc=pass (i=1 spf=pass spfdomain=proton.me dkim=pass dkdomain=proton.me dmarc=pass fromdomain=proton.me); spf=pass (google.com: domain of linux-kernel+bounces-125109-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-125109-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=proton.me Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id x14-20020a17090a46ce00b002a2188d3436si1122147pjg.8.2024.03.29.08.20.30 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Mar 2024 08:20:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-125109-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@proton.me header.s=protonmail header.b="L/9teXmA"; arc=pass (i=1 spf=pass spfdomain=proton.me dkim=pass dkdomain=proton.me dmarc=pass fromdomain=proton.me); spf=pass (google.com: domain of linux-kernel+bounces-125109-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-125109-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=proton.me Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 30428287A93 for ; Fri, 29 Mar 2024 15:20:30 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id F1771136999; Fri, 29 Mar 2024 15:08:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=proton.me header.i=@proton.me header.b="L/9teXmA" Received: from mail-4316.protonmail.ch (mail-4316.protonmail.ch [185.70.43.16]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3E37012DD97 for ; Fri, 29 Mar 2024 15:08:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.70.43.16 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711724890; cv=none; b=M72wIoLFZ+Fyg6Hh6yo6PoqZPY+bjpvlD7vh2GoXhqMRaSv3CcHnAFdDech8ud0AAwCOYEvjZqbfl1oOZfIzRZJVad/hhiNZhRzlrJsW+4b4s7faBD2YDnZ2dmv0zf1GPOBkHIop2wjJSn4WqcnvmIa2ow9UeENHlf1n1Paoaog= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711724890; c=relaxed/simple; bh=dxsK+A0zGzWuoyy/rv8SNAdBIJ4VUlSM+Fjev0Dd4os=; h=Date:To:From:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=UCc5Kha+KIWU4T4TXU/Ewd3+K5rknYBvQN26jpVdpfW0F21fI7UgHgaC1T/EZn4TDzfVa6Xd+wP0ZUNhqrU/XnchpBqZ1hiiG7bYX4XIFIFwpxUnctaNZZcrg1fKn/zvOOh30MdamWF/z14EJx/07gtvT0GJZzwvp4dE6SHKUg0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=proton.me; spf=pass smtp.mailfrom=proton.me; dkim=pass (2048-bit key) header.d=proton.me header.i=@proton.me header.b=L/9teXmA; arc=none smtp.client-ip=185.70.43.16 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=proton.me Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=proton.me DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=proton.me; s=protonmail; t=1711724880; x=1711984080; bh=TwY71wkAkVzxEFQEXuu91xb0QlVVxXbICyOBQ0qK7/Y=; h=Date:To:From:Cc:Subject:Message-ID:In-Reply-To:References: Feedback-ID:From:To:Cc:Date:Subject:Reply-To:Feedback-ID: Message-ID:BIMI-Selector; b=L/9teXmAuZm2PqAvmPxW8XhLSUIku4P5Cw6jwo0QLtWXE+zg367gaLokhspFzj2fJ oNfJyH1SKbPNQK/ua+A2HZWmx+fTTH9NrEPiNkjGJ2/KRLAoZvdA3qArVHKpc5gEts KKjDpfvLbRF7CW6LuLDOmh6JHQTAKRM04lm3Bhf5XCqA4xQqUgUtNN5J0LklXnCj2T cslNiUrNuAyNUicXsNdQyclAjtFWqazLMpUVqQ6MDRcWWmDognXxTe6Ok7XYRqMIsS 9Pn491iU9luYMFYz0GNGLb1/lN13eFI0+PiZwVqw9Vnr+iC1kCZ/HcZ7mF6QWO8sIc /s/WM2LjwKoog== Date: Fri, 29 Mar 2024 15:07:55 +0000 To: Wedson Almeida Filho From: Benno Lossin Cc: rust-for-linux@vger.kernel.org, Miguel Ojeda , Alex Gaynor , Boqun Feng , Gary Guo , =?utf-8?Q?Bj=C3=B6rn_Roy_Baron?= , Andreas Hindborg , Alice Ryhl , linux-kernel@vger.kernel.org, Wedson Almeida Filho Subject: Re: [PATCH 2/2] samples: rust: add in-place initialisation sample Message-ID: <6f789e0a-2e98-4ee8-a905-f2ae7c45cc48@proton.me> In-Reply-To: References: <20240327032337.188938-1-wedsonaf@gmail.com> <20240327032337.188938-3-wedsonaf@gmail.com> Feedback-ID: 71780778:user:proton Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 28.03.24 14:00, Wedson Almeida Filho wrote: > On Wed, 27 Mar 2024 at 10:53, Benno Lossin wrote= : >> On 27.03.24 04:23, Wedson Almeida Filho wrote: >>> + pr_info!("Am I built-in? {}\n", !cfg!(MODULE)); >>> + try_pin_init!(Self { >>> + numbers: { >>> + let mut numbers =3D Vec::new(); >>> + numbers.push(72, GFP_KERNEL)?; >>> + numbers.push(108, GFP_KERNEL)?; >>> + numbers.push(200, GFP_KERNEL)?; >>> + numbers >>> + }, >>> + }) >> >> I think it might be useful to also have a field that needs pin-init, eg >> a `Mutex` or similar. What about placing the `Vec` inside of a mutex? >=20 > I'm not sure this belongs in a "minimal" example. >=20 > But I added it in v2 because we're already violating minimality with > vectors anyway. Perhaps we should later have minimal samples and > rename these to something else. I think a fully minimal example would be less valuable as a learning resource. We can of course have both, but I think having real usage of pin-init in this example can help people get familiar with it. --=20 Cheers, Benno