From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.1 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 Received: from second.openwall.net (second.openwall.net [193.110.157.125]) by inbox.vuxu.org (Postfix) with SMTP id 843412C7BD for ; Sat, 24 Aug 2024 17:01:03 +0200 (CEST) Received: (qmail 18218 invoked by uid 550); 24 Aug 2024 15:00:59 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Reply-To: musl@lists.openwall.com Received: (qmail 18180 invoked from network); 24 Aug 2024 15:00:59 -0000 Date: Sat, 24 Aug 2024 11:00:50 -0400 From: Rich Felker To: =?utf-8?B?0L3QsNCx?= Cc: Szabolcs Nagy , musl@lists.openwall.com Message-ID: <20240824150050.GC10433@brightrain.aerifal.cx> References: <20230624043939.GC3630668@port70.net> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Subject: Re: [musl] [PATCH v2] [f]statvfs: allocate spare for f_type On Thu, Aug 17, 2023 at 10:05:14PM +0200, наб wrote: > This is the only missing part in struct statvfs. > The LSB calls [f]statfs() deprecated, and its weird types are definitely > off-putting. However, its use is required to get f_type. > > Instead, allocate one of the six spares to f_type, > copied directly from struct statfs. > This then becomes a small extension to the standard interface on Linux, > instead of two different interfaces, one of which is quite odd due to > being an ABI type, and there no longer is any reason to use statfs(). > > The underlying kernel type is a mess, but all architectures agree on u32 > (or more) for the ABI, and all filesystem magicks are 32-bit integers. Revisiting this, the commit message was incorrect, particularly the wording: "This is the only missing part in struct statvfs." struct statvfs has unsigned long f_fsid, which is only a 32-bit field and does not represent the full (total 64-bit) pair fsid_t from struct statfs that Linux provides. I did some digging into what this actually is, and on filesystems that have a uuid in the superblock, it's a very basic hash (xor of upper and lower half) of the uuid into a 64-bit value. glibc combines the upper and lower half to a single 64-bit unsigned long on 64-bit archs, but uses only the first 32-bit part on 32-bit archs. On musl, I intentionally only used the first part to avoid a functionality discrepancy between 32- and 64-bit archs. Since then, gnu coreutils has switched from using statfs to statvfs, producing a "regression" on musl and 32-bit glibc archs. Arguably this "regression" does not matter, since the value itself is not meaningful and there's really nothing useful you can do with it, but it's probably worth noting. Rich