Received: by 2002:a05:7412:419a:b0:f3:1519:9f41 with SMTP id i26csp4661158rdh; Wed, 29 Nov 2023 07:23:56 -0800 (PST) X-Google-Smtp-Source: AGHT+IGSwBQyRKZKSsO8mhckm36pAZSKLz7+kxUmWkfIpsz5ReKzMcWH4Fg4FmRhu/8nW9XikACX X-Received: by 2002:a05:6808:15a3:b0:3b8:94c0:87fb with SMTP id t35-20020a05680815a300b003b894c087fbmr2582601oiw.9.1701271435930; Wed, 29 Nov 2023 07:23:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701271435; cv=none; d=google.com; s=arc-20160816; b=fEPCecISS5emBw7dX0aYJ8k3Gi/GWfSMe1zq6oYIrs3faVFMJecDyOuREJquJKOpXk YHOOIMkw3655Y56z53xunLXhZT7Xxtaqt+/STqREOpsu5OZ9MhOOeZn4WffmM3YI2tp2 /rupv4U3pGKZZSmyqMlOIAObRu8KmG+4afg8mw15h+J1wGZlpT39O64WUiCTvwNVoqjZ rx9O8f8pvgOs+cgaWORlplZ7D4rIUKyDbZtIH/wyK5TZvg4pXdOLa9HnPd+vqBWEeoYG 4BflhjLvEsPcQsfupWnkBVUv8G2imRmcOYmhRYOx0grNswFgpw4WpTKs+uj1VvVRhtja kmPw== 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:dkim-signature; bh=7wC+SUX8Lci4mgC43CU9lNbkaIyYQmQqt28/ZZo7MdQ=; fh=Yhv1pc6OvUlfIkkzauvJ+SkAsJ474vori1jt/P/8YdQ=; b=G2jbv/+xXIBZI6HecbdtNFbVFPUdkk6+TqxcCk+FJQ1DrODoBicivivlvqDU8ZWAst dETu3kpbBD/HpF7MKKkL1JpSfMnN2gCLMcqGhQmixjEdcjYb/nqOjqjvbg7aKFuwbETy B+M6AL7oDCwTb3OmVsjVJ7PufWaziE7BUnYs5H3axRXUDDdGEfrNhWkvIFoX7KSJpnUF hyWrJm4YQT1uuI3JnZ+tBJVxhxsIynZeLB57W8oTQYq3P+JRT5YvZJTVNgfr+XjpKVYz QHz1ijaYWUJVGyvZQgdCxSAGrRh4YwGYRxCM0tIvlBkfC8LbodV1wTaanUGXBpoOcg2l +1bw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=gyVeEX6f; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id k2-20020a635a42000000b005be1ee5beb7si14256162pgm.534.2023.11.29.07.23.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Nov 2023 07:23:55 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=gyVeEX6f; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 42D9C80B83BA; Wed, 29 Nov 2023 07:23:53 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234873AbjK2PX1 (ORCPT + 99 others); Wed, 29 Nov 2023 10:23:27 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51830 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234925AbjK2PXX (ORCPT ); Wed, 29 Nov 2023 10:23:23 -0500 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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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 groat.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 (groat.vger.email [0.0.0.0]); Wed, 29 Nov 2023 07:23:53 -0800 (PST) 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.