Received: by 2002:a05:7412:8521:b0:e2:908c:2ebd with SMTP id t33csp605934rdf; Fri, 3 Nov 2023 09:31:38 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFU8QT0vLR+iR00FM8nsM1Tl+Njtwl5YHsqpEfMerSD8oJfik3WmV0xLTLof+4CR3dDNnSJ X-Received: by 2002:a05:6830:4d8:b0:6b9:6a43:1f7c with SMTP id s24-20020a05683004d800b006b96a431f7cmr21793254otd.26.1699029098621; Fri, 03 Nov 2023 09:31:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1699029098; cv=none; d=google.com; s=arc-20160816; b=xJ7c4ugmIdGLZUaHJcbalE/DBikLwudYWcXmCbNOcQYZMjDdE3O9qkeaiASteAFsCh NHZVq+e/e+v2qQxLDmZ59OBetWcuu9hGIQ/QOt14Zd5XyonpAK5BQLZMbZuLk1w3pKiZ rfhz9ed939FQIVNGxDuetdoLt1rD13qkWqFosZypuYJfpRxKu3XlwkmtyaMyPvOB0tk2 oYEK16PhM1sXEJhkAnMhyQHTiw66IY0aulAwD0EgxZfPgQjpP/qXEh89luRqKN2ETuTo 9n7qPgDKzB5fix5grGVSLQU+ZhB7exuhcyPCPf80BcuVjYy1RlJdfeAtYI0UbbX8XHrO vAZg== 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:references:in-reply-to:message-id:subject:cc:from:to :date:dkim-signature; bh=ViFEkYUFoXULRyDJ1aSReLeNM1tEO6xO+D2YwVm/tH0=; fh=i7Q1IU2VKIxZqpleGvP3HDIBEj1umqof9mytmRdYBUo=; b=UN+yXZoSkKcO+4CAScW0eZVV5Y7MXY8JWzBI/TEnaM5WdpD6WeTb9dgutVSEZYFV+K QawIp5vFNBfbDK9ufQFAXXnqvX7b4rc6YuhZa5BRS0ltL2/S6pVxRsQ9hmgzmJBSkUSU 3HkUdUWl//HEseIxZnp9wN+JvUNwGaD3VdKx3/AIE5IKdSsvB1p6QyRuYnot2BfX4xgL TSjXlLCGMHeBocUz0ERkrMbYc6YYKA2u4de4hmghrhpIInMm69eWWdSX62LNRKidmg0c wA1dUHdSFUJ6+5e0Aj+L2w10k2Dl8Ft285WLwYtATq0p3woZUeIw5QCBbS93DtivyuNB lxcw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@proton.me header.s=protonmail header.b=XFIBMvdw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 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 lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id f15-20020a9d5e8f000000b006c4db7123fesi736905otl.116.2023.11.03.09.31.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Nov 2023 09:31:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; dkim=pass header.i=@proton.me header.s=protonmail header.b=XFIBMvdw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=proton.me Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id D81FE8246E26; Fri, 3 Nov 2023 09:31:33 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345139AbjKCQbK (ORCPT + 99 others); Fri, 3 Nov 2023 12:31:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42914 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344250AbjKCQbJ (ORCPT ); Fri, 3 Nov 2023 12:31:09 -0400 Received: from mail-4322.protonmail.ch (mail-4322.protonmail.ch [185.70.43.22]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8654EDC for ; Fri, 3 Nov 2023 09:31:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=proton.me; s=protonmail; t=1699029059; x=1699288259; bh=ViFEkYUFoXULRyDJ1aSReLeNM1tEO6xO+D2YwVm/tH0=; 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=XFIBMvdw7yJ6d9eEzBJE4Ty9VrpIIbCMSCmzco+5qmob7ZqyBZPqwCSvS9rxSIKxw uiWFoKtIA9zqhcxyEIoPfB+VqZb0R1+XEUjI00Gauu0LDVfvVau23Ial/ZmzpAY9wn WVoKfnjV4jNKVurI9lwIG0TIoORCYp9Tcrt7jaYgl38RWVoRFg80CyoXZvoGhZPskI 3Qyw9OfQ7GVY9zWJ903DPD1EB3MKq+lv4wybYxdc+6tJeDN3tf0pNE5K1QdWrD7+Kh TfBSDA0CnsBz9N8Co6ADH20z/K22pN+zn8IZe22w506HMchS4xWAYV1BUeQvLa7by7 RRTZ7JOWg1PlQ== Date: Fri, 03 Nov 2023 16:30:54 +0000 To: Alice Ryhl From: Benno Lossin Cc: Greg Kroah-Hartman , =?utf-8?Q?Arve_Hj=C3=B8nnev=C3=A5g?= , Todd Kjos , Martijn Coenen , Joel Fernandes , Christian Brauner , Carlos Llamas , Suren Baghdasaryan , Miguel Ojeda , Alex Gaynor , Wedson Almeida Filho , linux-kernel@vger.kernel.org, rust-for-linux@vger.kernel.org, Boqun Feng , Gary Guo , =?utf-8?Q?Bj=C3=B6rn_Roy_Baron?= , Andreas Hindborg , Matt Gilbride , Jeffrey Vander Stoep , Matthew Maurer Subject: Re: [PATCH RFC 02/20] rust_binder: add binderfs support to Rust binder Message-ID: In-Reply-To: <20231101-rust-binder-v1-2-08ba9197f637@google.com> References: <20231101-rust-binder-v1-0-08ba9197f637@google.com> <20231101-rust-binder-v1-2-08ba9197f637@google.com> 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=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Fri, 03 Nov 2023 09:31:34 -0700 (PDT) On 01.11.23 19:01, Alice Ryhl wrote: > +/// There is one context per binder file (/dev/binder, /dev/hwbinder, et= c) > +#[pin_data] > +pub(crate) struct Context { > + #[pin] > + manager: Mutex, > + pub(crate) name: CString, > + #[pin] > + links: ListLinks, > +} > + > +kernel::list::impl_has_list_links! { > + impl HasListLinks<0> for Context { self.links } > +} > +kernel::list::impl_list_arc_safe! { > + impl ListArcSafe<0> for Context { untracked; } > +} > +kernel::list::impl_list_item! { > + impl ListItem<0> for Context { > + using ListLinks; > + } > +} I think at some point it would be worth introducing a derive macro that does this for us. So for example: #[pin_data] #[derive(HasListLinks)] pub(crate) struct Context { #[pin] manager: Mutex, pub(crate) name: CString, #[pin] #[links] links: ListLinks, } And if you need multiple links you could do: #[pin_data] #[derive(HasListLinks)] struct Foo { #[links =3D 0] a_list: ListLinks, #[links =3D 1] b_list: ListLinks, } Same for `ListItem` and `HasWork`. I have not yet taken a look at your linked list implementation, so I don't know if this is possible (since `ListItem` seems to have multiple "backends"). I think this improvement can wait though, just wanted to mention it. --=20 Cheers, Benno