Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp4129815rdb; Mon, 11 Dec 2023 09:36:07 -0800 (PST) X-Google-Smtp-Source: AGHT+IFDsLCYa2Z/vEnbbIdmjXKcG/76nvNkaCYQaaMZazyDScCrqPHRzzVAMvxJgEHTMSlOfRh1 X-Received: by 2002:a17:90a:bb01:b0:286:a454:6b44 with SMTP id u1-20020a17090abb0100b00286a4546b44mr2027802pjr.27.1702316166752; Mon, 11 Dec 2023 09:36:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702316166; cv=none; d=google.com; s=arc-20160816; b=r8k8CGTtV45cB24Lw0Iwng9Yy43wEDPuawPH86LWrTyxqF3F9R3NbPu0kNpKTxvO8Y BtOAUVNbxI4Hkn0ZiA4o58da58/KhFtBTffBCZzjT5+vfi2Up1sHnqDcetNyA4tPYJQ7 Jl+/J5zrmfQNMSjQ9VN6utBd8Z9Cf85Vl2Xns/+pv1nd4oZv6JnLbK9CZ72JsTtN1P1q 5FFNXDwmK1pjiT1Ms9GO0FWQtnxWVe28im0Zi9aoirUCuAclO37F9NWX7KB9ZbVAi20p pU/rXGNy4G2/4Wq45RF9JjVd8OQS8EAYbiPczxb2eQI8BrYVJgYIUkb1MsNsYZ7+YOL6 TcEA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:feedback-id :dkim-signature; bh=M/fg+fv8iUKsYhs2M+RJ0ajm1ojAT51bfa8djh97RvU=; fh=yFyAexpovPZnYCT+bKNGPzfqRAco3+EBfsQF5ylZ8zI=; b=fiSz9oWUkk8MMeM6QDFhrVzPXeLCBeAzehE5ZN5IuLbsa1EAqAHwL+He3cQVZm4IJ/ MQdTM6qUqr+5QzYFEo+tgBG6itHp1fH8cZG6w8tBDwJ2ezrxWxxcMPNN6ty9tumseIgG Czw+xzVfqB7+BPG8FpInH59vd2wrWWAZhjVu6c6RUysbOTw13wkWdTxZG00B12D7z8u0 D2JJD/Q8qMna4E1YlQa98K/pn2cP202OQohKuorvoOUipXV/6YTKeBEp3D4elvmvJjGj JyOvmEL0e65hgTuHKbgArUH9c6iWuyzV7cqXIu4uGK1TWIaEhvyh6EQupdakFgtjjZ/z Ga2Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=CP3Jq4I1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id u23-20020a17090ae01700b00288795e256fsi6404364pjy.120.2023.12.11.09.36.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Dec 2023 09:36:06 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=CP3Jq4I1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 7E2438092224; Mon, 11 Dec 2023 09:36:05 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344724AbjLKRfx (ORCPT + 99 others); Mon, 11 Dec 2023 12:35:53 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33410 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344741AbjLKRfj (ORCPT ); Mon, 11 Dec 2023 12:35:39 -0500 Received: from mail-oi1-x22c.google.com (mail-oi1-x22c.google.com [IPv6:2607:f8b0:4864:20::22c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D4D8FEA; Mon, 11 Dec 2023 09:35:45 -0800 (PST) Received: by mail-oi1-x22c.google.com with SMTP id 5614622812f47-3b9e2a014e8so3139960b6e.2; Mon, 11 Dec 2023 09:35:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1702316145; x=1702920945; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:feedback-id:from:to:cc:subject:date :message-id:reply-to; bh=M/fg+fv8iUKsYhs2M+RJ0ajm1ojAT51bfa8djh97RvU=; b=CP3Jq4I1Y02qHoqb0qWcgX0JAcPeAVZkT/zrigeAZ63XjOtvmaFoaRPOCh8oGdle/E 659t0Cqq9vwxfVzUnZEYkujXvjenFSymFnF2wn5KMkozGqr5VAEkRG4WlLyW6qSrkJpR ZiMwSfge/HSBrgaQeXoCKiaH0gA5DMWKBzfS8IuoYqortNoBw4stEkLTMwT60HdryXyQ GeGxxvBtOSCoCwhz/OOw+onOAKkeI1M152kgV3xzm6VeyJpIKtRKIDZBNxKA1PEyGwcf sdb6SxfnnbCojImLFcgufskb9jZL4zv0rFZRqHyDh4LTWKrxDisbCacPZ+g8PJQdSCo6 lc7Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702316145; x=1702920945; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:feedback-id:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=M/fg+fv8iUKsYhs2M+RJ0ajm1ojAT51bfa8djh97RvU=; b=YUhCcYXwQUqIJx4Lkbd/hlMATx7JbBIvW3oOzMq6bHBZUODq5nU5sH05YJK4hzCTbY 8w3Cas9sOuWDPN/YSVTxDTGJf5xfo0ZwBU80+/yQ5eSQNGhPBQKEp1UxW2kS+5+/ffoZ 4+5+CN2So8iix7pQTU3+yO9QbnH3ftpEFCtQTEdfXt0gvAICQH10koS8J07vBmsqrkzK aFOmgv2gD1/VeOcdBtBBD34vUp+VOOOJz9hSBFw1IVXyKwG36TgXxqzm0fv7jpdLItt4 133aBOeDtSF3xxD2UELtO+JIKFaFVe8u0nsu7ca8wgClnR7fihy01yA0qg6kvhxj2YIN UicA== X-Gm-Message-State: AOJu0YxnsiFvHrrYl7oFnNwzzIs9/IUe+Gjs5b4wISiEyTr0Qu6CMb8V 6x9128CNQhUVJhIpn8x0GIQ= X-Received: by 2002:a05:6359:2d02:b0:16e:29eb:98c8 with SMTP id rl2-20020a0563592d0200b0016e29eb98c8mr2011101rwb.30.1702316144995; Mon, 11 Dec 2023 09:35:44 -0800 (PST) Received: from auth1-smtp.messagingengine.com (auth1-smtp.messagingengine.com. [66.111.4.227]) by smtp.gmail.com with ESMTPSA id i19-20020a056214031300b0067aa164861dsm3467797qvu.35.2023.12.11.09.35.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Dec 2023 09:35:44 -0800 (PST) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailauth.nyi.internal (Postfix) with ESMTP id E6B6A27C005B; Mon, 11 Dec 2023 12:35:43 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute1.internal (MEProxy); Mon, 11 Dec 2023 12:35:43 -0500 X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrudelvddguddthecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpeffhffvvefukfhfgggtuggjsehttdertddttddvnecuhfhrohhmpeeuohhq uhhnucfhvghnghcuoegsohhquhhnrdhfvghnghesghhmrghilhdrtghomheqnecuggftrf grthhtvghrnhephedugfduffffteeutddvheeuveelvdfhleelieevtdeguefhgeeuveei udffiedvnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomh epsghoqhhunhdomhgvshhmthhprghuthhhphgvrhhsohhnrghlihhthidqieelvdeghedt ieegqddujeejkeehheehvddqsghoqhhunhdrfhgvnhhgpeepghhmrghilhdrtghomhesfh higihmvgdrnhgrmhgv X-ME-Proxy: Feedback-ID: iad51458e:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 11 Dec 2023 12:35:42 -0500 (EST) Date: Mon, 11 Dec 2023 09:35:40 -0800 From: Boqun Feng To: Alice Ryhl Cc: a.hindborg@samsung.com, alex.gaynor@gmail.com, arve@android.com, benno.lossin@proton.me, bjorn3_gh@protonmail.com, brauner@kernel.org, cmllamas@google.com, dan.j.williams@intel.com, dxu@dxuuu.xyz, gary@garyguo.net, gregkh@linuxfoundation.org, joel@joelfernandes.org, keescook@chromium.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, maco@android.com, ojeda@kernel.org, peterz@infradead.org, rust-for-linux@vger.kernel.org, surenb@google.com, tglx@linutronix.de, tkjos@android.com, viro@zeniv.linux.org.uk, wedsonaf@gmail.com, willy@infradead.org Subject: Re: [PATCH v2 2/7] rust: cred: add Rust abstraction for `struct cred` Message-ID: References: <20231211153429.4161511-1-aliceryhl@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231211153429.4161511-1-aliceryhl@google.com> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Mon, 11 Dec 2023 09:36:05 -0800 (PST) On Mon, Dec 11, 2023 at 03:34:29PM +0000, Alice Ryhl wrote: > Boqun Feng writes: > > On Wed, Dec 06, 2023 at 11:59:47AM +0000, Alice Ryhl wrote: > > [...] > > > @@ -151,6 +152,21 @@ pub fn as_ptr(&self) -> *mut bindings::file { > > > self.0.get() > > > } > > > > > > + /// Returns the credentials of the task that originally opened the file. > > > + pub fn cred(&self) -> &Credential { > > > > I wonder whether it would be helpful if we use explicit lifetime here: > > > > pub fn cred<'file>(&'file self) -> &'file Credential > > > > It might be easier for people to get. For example, the lifetime of the > > returned Credential reference is constrainted by 'file, the lifetime of > > the file reference. > > > > But yes, maybe need to hear others' feedback first. > > > > Regards, > > Boqun > > That would trigger a compiler warning because the lifetime is > unnecessary. > We can disable that warning if people need the information. Code is mostly for reading, less often for compilation and changes. > The safety comment explains what the signature means. I think that > should be enough. > For someone who has a good understanding of Rust lifetime (and the elision), yes. But I'm wondering whether all the people feel the same way. Regards, Boqun > Alice