Received: by 2002:a05:7412:b10a:b0:f3:1519:9f41 with SMTP id az10csp1209397rdb; Fri, 1 Dec 2023 09:37:36 -0800 (PST) X-Google-Smtp-Source: AGHT+IE3sNts7dxm5dtdpootdZP1hpe5pZqQmTHUXbPcZO+VLEMoxoHJSINS3EmzwByNqRotjaxY X-Received: by 2002:a17:90b:1b01:b0:285:9d0d:89a with SMTP id nu1-20020a17090b1b0100b002859d0d089amr23750067pjb.13.1701452256565; Fri, 01 Dec 2023 09:37:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701452256; cv=none; d=google.com; s=arc-20160816; b=RrQwRjSRj2De2TTE19/gxYmyYWZx+83y4Y5rO1T4RhgDn56904V+5/aLCagtNVhy73 x/9Ph6zRadgaXRt/jdJEGVrIW8e0tpCwNVb6hnFW57YM6zCjjTmIqoVIX5nP5FKLbhaK hV4YkFRDpmyIeD7EfyeIeKfFxL7AFxSzL9cJsfwfroUttk6vbkk/D/Cf8YHilk49+KNo sV5JTrtmytsXOVnPrqniVQiQdEVrANER1brY8j+ASAGx9BGZLbbuV/l7TkIeKilzj549 J3Ah+Ru1HzQyTx2k587MTUR7QgqXYhvScFWUjZrUHysHIn4LWixD+xilMCPV6GFiBgO9 xNzA== 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=SDEs+kKoImcW0/37ZK07RqKOEiMzhsKpKss6HpH9yX8=; fh=0YyNuBMqBFTr23ZIaCrP650KQwyo+WoWqCeNJb+0omQ=; b=cb2k+zVzOhBR3xf2wia3Yj2Mvp5Shi16wbW9pBRtNOsJ81K/pjEuGqiKVs5xFoBG0o kjlM2HFzFauV8se6e/XyAnHOLoMG1P8AufGrPo0Ni2b6LQAbbx1RfbNY02Ez51+MT1Wo jdn15w9DOmZzuDw/GO2GW4KM2ksIDOuIfkNBYFVjJeOytTzBttFZXDqKBayl7Uai+Fuw 1Q67QPd87pCfdGFVgzWajFeubJRPWl75n+AheA25hoqD0mM2PEfy97uqoqBeJf1NN+r2 mzSFvOeaeuW54REuZNmpyqBN5/d/iszzyw67Di8vlN/xyFNQJK+9powd1JiNRVksX19F 6u6g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@proton.me header.s=733i7nh34fae7nqvhxrtxokxny.protonmail header.b=NGszqyCT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 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 howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id ij15-20020a170902ab4f00b001c5de4a5b4esi1778673plb.597.2023.12.01.09.37.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Dec 2023 09:37:36 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; dkim=pass header.i=@proton.me header.s=733i7nh34fae7nqvhxrtxokxny.protonmail header.b=NGszqyCT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 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 howler.vger.email (Postfix) with ESMTP id C3FD18297233; Fri, 1 Dec 2023 09:37:33 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230085AbjLARhT (ORCPT + 99 others); Fri, 1 Dec 2023 12:37:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59426 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229454AbjLARhS (ORCPT ); Fri, 1 Dec 2023 12:37:18 -0500 Received: from mail-40131.protonmail.ch (mail-40131.protonmail.ch [185.70.40.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E6287C4 for ; Fri, 1 Dec 2023 09:37:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=proton.me; s=733i7nh34fae7nqvhxrtxokxny.protonmail; t=1701452241; x=1701711441; bh=SDEs+kKoImcW0/37ZK07RqKOEiMzhsKpKss6HpH9yX8=; 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=NGszqyCTA9a++ZSjmKG7lMsbXMaRsYWcE1OOO82R9qa95qsfTr+JngRey35OgZdnf q8MOOHsKA7qRcFaqREzbnppBsmo1EcJ5ya4zmvuQXSApR+2svSWP95OwDbjdHhj3tD 26S3dYAXNkw3i3P0+X6festAERaAmDJ1CBEDuop4czT9JR559meWHij2vGgPA35jBH KG1S+NAMLsYbTOrbsybnT0KK7ilCDSHlqCMFQkxVvl/T+1UYnOx0IW+GEG4Jb6TU7t GNRon9RiE6BmQZOgJdK+bz5bydWReHzyb1cS7NRs4iT553RjNIS4B6HgcEWMjFY73/ nbOHG+G+GTqnQ== Date: Fri, 01 Dec 2023 17:37:06 +0000 To: David Laight From: Benno Lossin Cc: Theodore Ts'o , Alice Ryhl , "a.hindborg@samsung.com" , "alex.gaynor@gmail.com" , "arve@android.com" , "bjorn3_gh@protonmail.com" , "boqun.feng@gmail.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 1/7] rust: file: add Rust abstraction for `struct file` Message-ID: In-Reply-To: <70efae6ae16647ddbb2b2c887e90e7c8@AcuMS.aculab.com> References: <386bbdee165d47338bc451a04e788dd6@AcuMS.aculab.com> <20231201122740.2214259-1-aliceryhl@google.com> <20231201150442.GC509422@mit.edu> <70efae6ae16647ddbb2b2c887e90e7c8@AcuMS.aculab.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 howler.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 (howler.vger.email [0.0.0.0]); Fri, 01 Dec 2023 09:37:33 -0800 (PST) On 12/1/23 18:25, David Laight wrote: > From: Benno Lossin >> Sent: 01 December 2023 15:14 >> >> On 12/1/23 16:04, Theodore Ts'o wrote: >>> On Fri, Dec 01, 2023 at 12:27:40PM +0000, Alice Ryhl wrote: >>>> >>>> You can import it with a use statement. For example: >>>> >>>> use kernel::file::flags::O_RDONLY; >>>> // use as O_RDONLY >>> >>> That's good to hear, >=20 > Except that the examples here seem to imply you can't import > all of the values without listing them all. Alice has given an example above, but you might not have noticed: use kernel::file::flags::*; =20 // usage: O_RDONLY O_APPEND > From what I've seen of the rust patches the language seems > to have a lower SNR than ADA or VHDL. > Too much syntatic 'goop' makes it difficult to see what code > is actually doing. This is done for better readability, e.g. when you do not have rust-analyzer to help you jump to the right definition. But there are certainly instances where we use the `::*` imports (just look at the first patch). > .... >> Alternatively if we end up with multiple flags modules you can do this >> (the sixth option from Alice): >> >> use kernel::file::flags as file_flags; >> use kernel::foo::flags as foo_flags; >> >> // usage: >> >> file_flags::O_RDONLY >> >> foo_flags::O_RDONLY >=20 > That looks useful for the 'obfuscated rust' competition. > Consider: > =09use kernel::file::flags as foo_flags; > =09use kernel::foo::flags as file_flags; This is no worse than C preprocessor macros doing funky stuff. We will just have to catch this in review. --=20 Cheers, Benno