From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 96B8FC10DC2 for ; Thu, 30 Nov 2023 15:56:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346435AbjK3P4M (ORCPT ); Thu, 30 Nov 2023 10:56:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39690 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346411AbjK3P4L (ORCPT ); Thu, 30 Nov 2023 10:56:11 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8B55910D0 for ; Thu, 30 Nov 2023 07:56:17 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B66DDC433C7; Thu, 30 Nov 2023 15:56:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1701359777; bh=Atqz2R8S5CFNofHmkfbPck2yrnj1PJGSJBWuitp3Lps=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=1xfiPH0vRvQNxh0H18ebsiz+QfXIO8h49qtn0BttXKyyJSgU0KjgGqV7EineszNcM YfXWi3JxZnBYtdyoZLPf+lHo4BaXOhVIFSsRS6ZLrN4JIawZIMxnELgiDZvOoDIXKG IS9mpPQxycqq6pikqdDmy03gNorSUfMJRnf9Zav0= Date: Thu, 30 Nov 2023 15:56:14 +0000 From: Greg Kroah-Hartman To: Benno Lossin Cc: Alice Ryhl , Miguel Ojeda , Alex Gaynor , Wedson Almeida Filho , Boqun Feng , Gary Guo , =?iso-8859-1?Q?Bj=F6rn?= Roy Baron , Andreas Hindborg , Peter Zijlstra , Alexander Viro , Christian Brauner , Arve =?iso-8859-1?B?SGr4bm5lduVn?= , Todd Kjos , Martijn Coenen , Joel Fernandes , Carlos Llamas , Suren Baghdasaryan , Dan Williams , Kees Cook , Matthew Wilcox , 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: <2023113010-situated-brunch-d52d@gregkh> References: <20231129-alice-file-v1-0-f81afe8c7261@google.com> <20231129-alice-file-v1-1-f81afe8c7261@google.com> <2023113041-bring-vagrancy-a417@gregkh> <2gTL0hxPpSCcVa7uvDLOLcjqd_sgtacZ_6XWaEANBH9Gnz72M1JDmjcWNO9Z7UbIeWNoNqx8y-lb3MAq75pEXL6EQEIED0XLxuHvqaQ9K-g=@proton.me> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <2gTL0hxPpSCcVa7uvDLOLcjqd_sgtacZ_6XWaEANBH9Gnz72M1JDmjcWNO9Z7UbIeWNoNqx8y-lb3MAq75pEXL6EQEIED0XLxuHvqaQ9K-g=@proton.me> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Nov 30, 2023 at 03:46:55PM +0000, Benno Lossin wrote: > On 11/30/23 15:59, Greg Kroah-Hartman wrote: > > On Thu, Nov 30, 2023 at 02:53:35PM +0000, Benno Lossin wrote: > >> On 11/29/23 13:51, Alice Ryhl wrote: > >>> +/// Flags associated with a [`File`]. > >>> +pub mod flags { > >>> + /// File is opened in append mode. > >>> + pub const O_APPEND: u32 = bindings::O_APPEND; > >> > >> Why do all of these constants begin with `O_`? > > > > Because that is how they are defined in the kernel in the C code. Why > > would they not be the same here? > > Then why does the C side name them that way? Is it because `O_*` is > supposed to mean something, or is it done due to namespacing? Because this is a unix-like system, we all "know" what they mean. :) See 'man 2 open' for details. > In Rust we have namespacing, so we generally drop common prefixes. Fine, but we know what this namespace is, please don't override it to be something else. thanks, greg k-h