Received: by 2002:a05:7412:b10a:b0:f3:1519:9f41 with SMTP id az10csp1099689rdb; Fri, 1 Dec 2023 07:07:06 -0800 (PST) X-Google-Smtp-Source: AGHT+IENwvW1gz6LDsUbPywQKAU+mBBjlJhPQxNceqrjD0+/jtS2ckdKHMy2I4i1ODmZdqJxLsr4 X-Received: by 2002:a17:90b:3ec8:b0:285:936a:8001 with SMTP id rm8-20020a17090b3ec800b00285936a8001mr23707829pjb.48.1701443226433; Fri, 01 Dec 2023 07:07:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701443226; cv=none; d=google.com; s=arc-20160816; b=GQ7HyFeQCHv0u766J7fjCxyk9SeRjIs/VBKr60MffKHKHoL4vADBdiqVyRVogleh23 usSFkR/FkLgjuUHmTTtIQmF3pZsoaAaoMUrUF2n70NvrZoemabs715g/8wk55DYcb2Om r/t1G27adG0CyMyfa8dPtZoEbLVhiBemR6P08c6cA3hymYyt/HDLpWZpsr8xaWfY8DIh 65OyMEMwaLL08rc79FCNDd2kcCeu14jmmk6Luqbgk9Sm4Af8i2D0RGt8SHN3MSertUWa UV1zcn5L9QZSGg2zIC55Qrv4jr1YiAVxP65EeOuQL02iEjev18z7E42bs9P97Ji4nmu7 EjIg== 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=b232xKygdMBKVyuYMmIG89ffhPZBtNMuA1DPdGrLdQc=; fh=xLujPPKTyMrViSOIfNfQxYit2uvBI+zUIP4UVmLT5xw=; b=dglTZcAqVuT83dRBv825+s171oXfE0t8ORe62CbZ8z5HgnjwcnAx51L7lo3VomcppP 2KLHwHr9Q4O9R5scKYwSNL9TWHRWY5a94yrHt1FY1efA1A4x16efC5xtzc321irY+YdE HN5PTGT1s+UQjzepzEuZsfGBY1x0axa8NleEPrOTkk61plSe2h6Hb8YkL7uAa6jx/+3n F9F97Q74Xj0LVrogD7Uyz4iJ6HMj4B3ohxaOexg6rbziUni8kg+vQ7nWtfhUWItg74Nd Py+C4ZHJtDEtlR1DLIjugpWzuQFjZz8OEoGApT7bjUjukA4n9LqDlGEk29Ss5uV+xCg7 Cz8w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mit.edu header.s=outgoing header.b=Tn0U8AZd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=mit.edu Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id r7-20020a17090aad0700b00285940c5d8dsi5734537pjq.81.2023.12.01.07.06.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Dec 2023 07:07:06 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; dkim=pass header.i=@mit.edu header.s=outgoing header.b=Tn0U8AZd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=mit.edu Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id D3581807C866; Fri, 1 Dec 2023 07:06:00 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1379299AbjLAPFq (ORCPT + 99 others); Fri, 1 Dec 2023 10:05:46 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51436 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379284AbjLAPFo (ORCPT ); Fri, 1 Dec 2023 10:05:44 -0500 Received: from outgoing.mit.edu (outgoing-auth-1.mit.edu [18.9.28.11]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 13CB210FD for ; Fri, 1 Dec 2023 07:05:50 -0800 (PST) Received: from cwcc.thunk.org (pool-173-48-111-98.bstnma.fios.verizon.net [173.48.111.98]) (authenticated bits=0) (User authenticated as tytso@ATHENA.MIT.EDU) by outgoing.mit.edu (8.14.7/8.12.4) with ESMTP id 3B1F4gCV018398 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 1 Dec 2023 10:04:44 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mit.edu; s=outgoing; t=1701443088; bh=b232xKygdMBKVyuYMmIG89ffhPZBtNMuA1DPdGrLdQc=; h=Date:From:Subject:Message-ID:MIME-Version:Content-Type; b=Tn0U8AZdsfDguoM56HrG6xTK4HaV3SnqaHky5rL9N1bgVcF2UEtN1Zyr4PBAf4L1m Uf7QW8crSJ7itqtKNDvMklkRIVQV3pPKcvpqa13PPO24G2zXz2gzTIN0ekUUoHnnEa yiPZQqVZUprsrxN9n2oYC+RFaw/xahZHk/QzkdpRT89K1O8ZCnLlv2YF4GQmX67bUB 1eZ0f1DF9GNymKUndRkYWnCz6ErWvlkuB0xsc5GGuqsRC8eLJCr4w8OU3V2s32/4kr QLmKEDUSo8AEZrpv2sRZi51n3lYqPofjA1izDafwSAyseWBWUZM1Gn38jmSbUREzO/ vAFEzKb+HBYrw== Received: by cwcc.thunk.org (Postfix, from userid 15806) id 5752115C027C; Fri, 1 Dec 2023 10:04:42 -0500 (EST) Date: Fri, 1 Dec 2023 10:04:42 -0500 From: "Theodore Ts'o" To: Alice Ryhl Cc: david.laight@aculab.com, a.hindborg@samsung.com, alex.gaynor@gmail.com, arve@android.com, benno.lossin@proton.me, 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: <20231201150442.GC509422@mit.edu> References: <386bbdee165d47338bc451a04e788dd6@AcuMS.aculab.com> <20231201122740.2214259-1-aliceryhl@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231201122740.2214259-1-aliceryhl@google.com> 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, 01 Dec 2023 07:06:01 -0800 (PST) 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, but it still means that we have to use the XYZ_* prefix, because otherwise, after something like use kernel::file::flags::RDONLY; use kernel::uapi::rwf::RDONLY; that will blow up. So that has to be use kernel::file::flags::O_RDONLY; use kernel::uapi::rwf::RWF_RDONLY; Which is a bit more verbose, at least things won't blow up spectacularly when you need to use both namespaces in the same codepath. Also note how we do things like this: #define IOCB_APPEND (__force int) RWF_APPEND In other words, the IOCB_* namespace and the RWF_* namespace partially share code points, and so they *have* to be assigned to the same value --- and note that since RWF_APPEND is defined as part of the UAPI, it might not even be the same across different architectures.... Cheers, - Ted