From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="gyVeEX6f" Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 27C3210E5; Wed, 29 Nov 2023 07:23:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=7wC+SUX8Lci4mgC43CU9lNbkaIyYQmQqt28/ZZo7MdQ=; b=gyVeEX6f4oIWr2q5CEBXAuvFHX L37ewXQQCp97LuXd0NiaKmcLhHzgr7ud1rq8JsFVvO5qMYWUFb21Sr7j2PtB0g86Y/p+1OQjgwzYW g+LHXhLTi5LWseAZNSd+t187jv9HgYH/+5cflPOVNL4fpwvXeS/c0di/iLR6ZLGkQCF0WOUSw8V7J RWDGsdSQFlY7Xo4KGoodUI3ENP7k6VnrV/T0zBGm/wjFyhDmmSlTH8MVh0uC7hGTRr1+vYzhKruYS h4Wvp95Jh8msaACPgUlESic0u3FzS6utXWuXU+WhidPrRGT8w+qI6253g2cNF7zKiE59vQZaIKgtA /ZLtF3bA==; Received: from j130084.upc-j.chello.nl ([24.132.130.84] helo=noisy.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1r8MP4-00DWAy-Cf; Wed, 29 Nov 2023 15:23:06 +0000 Received: by noisy.programming.kicks-ass.net (Postfix, from userid 1000) id A817530017D; Wed, 29 Nov 2023 16:23:05 +0100 (CET) Date: Wed, 29 Nov 2023 16:23:05 +0100 From: Peter Zijlstra To: Matthew Wilcox Cc: Alice Ryhl , Miguel Ojeda , Alex Gaynor , Wedson Almeida Filho , Boqun Feng , Gary Guo , =?iso-8859-1?Q?Bj=F6rn?= Roy Baron , Benno Lossin , Andreas Hindborg , Alexander Viro , Christian Brauner , Greg Kroah-Hartman , Arve =?iso-8859-1?B?SGr4bm5lduVn?= , Todd Kjos , Martijn Coenen , Joel Fernandes , Carlos Llamas , Suren Baghdasaryan , Dan Williams , Kees Cook , Thomas Gleixner , Daniel Xu , linux-kernel@vger.kernel.org, rust-for-linux@vger.kernel.org, linux-fsdevel@vger.kernel.org Subject: Re: [PATCH 1/7] rust: file: add Rust abstraction for `struct file` Message-ID: <20231129152305.GB23596@noisy.programming.kicks-ass.net> References: <20231129-alice-file-v1-0-f81afe8c7261@google.com> <20231129-alice-file-v1-1-f81afe8c7261@google.com> Precedence: bulk X-Mailing-List: rust-for-linux@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: On Wed, Nov 29, 2023 at 03:13:22PM +0000, Matthew Wilcox wrote: > > @@ -157,6 +158,12 @@ void rust_helper_init_work_with_key(struct work_struct *work, work_func_t func, > > } > > EXPORT_SYMBOL_GPL(rust_helper_init_work_with_key); > > > > +struct file *rust_helper_get_file(struct file *f) > > +{ > > + return get_file(f); > > +} > > +EXPORT_SYMBOL_GPL(rust_helper_get_file); > > This is ridiculous. A function call instead of doing the > atomic_long_inc() in Rust? Yeah, I complained about something similar a while ago. And recently talked to Boqun about this as well, Bindgen *could* in theory 'compile' the inline C headers into (unsafe) Rust, the immediate problem is that Rust has a wildly different inline asm syntax (because Rust needs terrible syntax or whatever). Boqun said it should all be fixable, but is a non-trivial amount of work.