Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp1701198rwd; Sun, 28 May 2023 00:39:42 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5Apj2YxJlVwBpCQzuEnudlElGn6Wrawl5j8dD+E/SIWcAV1/U9tWkkCKGM6QU7C0lF6ZD/ X-Received: by 2002:a17:902:b70b:b0:1ac:8cd6:9323 with SMTP id d11-20020a170902b70b00b001ac8cd69323mr6886884pls.22.1685259582300; Sun, 28 May 2023 00:39:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685259582; cv=none; d=google.com; s=arc-20160816; b=U1r1XSMd7kI2wBqJ41Cx6vWGGS0Ha4UgdmSOaVP+rc18PZUmovUp70xh1448ZCaqqM hGAbaC061u4J14uOeunhDuL+nvhdm9iOACyhY1AAmtSopJyHCn5PwWHj5rLZ8ZJA0fI1 odzYrgVZiMthBpFDTO/RPzTD/lceAtEC9FkX+yftsrq/iA6iqdwvuUboQmZhYft5RIo0 5kJuLllwVgGGQ5TK+77QSCD8kSRK4+q3JiCS3XxVy7oMpHrMyRt52iZnVP/W13T+IFOA 3agIcvTaiOZjU6kx1o7POPoIg7hX6j68LvgjiPqSqMfwVrBWTaEXhw7la/ImrnJR4yE5 aRfA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=8cTLZuUMMVzOlrwj5hX4xW3r2PMNDsSANIkCzmNoHkc=; b=N/6YI/EI9m6yD7Xll0yTrTkMVAVzWhEmjBP+XDaqoZ0jnodf5jom91FAWY1886XABH pCnIHSAoTWVnnLJxHzA+xGf0KCk4Q2BJgnVlUd6/fnWMjdcSiKnp9TNPSLh15YNsUHP4 pmd34JZKshkxnPF7IyAiUtW4dprEMTx1NGT+BANRrN4vUUHG4fE7GXaoLzWibDmGykIG 6K8Fj3xdrZyWPwphAtcRLknpap3Oj1HK59rq9aTaLWSl8aM46uSyFbnMhUkypp/hBqcY 9MtaGqe9RPfoN8E8iyYKcIXSzvuQrhiH6JOOalxaqZTi5pgz4ohH4cbqSpOJMY2exLss H5dA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n9-20020a170903110900b001a9b29b6763si658153plh.399.2023.05.28.00.39.30; Sun, 28 May 2023 00:39:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229521AbjE1Hhj (ORCPT + 99 others); Sun, 28 May 2023 03:37:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60884 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229472AbjE1Hhh (ORCPT ); Sun, 28 May 2023 03:37:37 -0400 Received: from 1wt.eu (ded1.1wt.eu [163.172.96.212]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 15B6CB4; Sun, 28 May 2023 00:37:35 -0700 (PDT) Received: (from willy@localhost) by pcw.home.local (8.15.2/8.15.2/Submit) id 34S7bVDk001971; Sun, 28 May 2023 09:37:31 +0200 Date: Sun, 28 May 2023 09:37:31 +0200 From: Willy Tarreau To: Thomas =?iso-8859-1?Q?Wei=DFschuh?= Cc: Shuah Khan , linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org Subject: Re: [PATCH] tools/nolibc: support nanoseconds in stat() Message-ID: <20230528073730.GB1956@1wt.eu> References: <20230527-nolibc-stat-nanoseconds-v1-1-3f7825caae68@weissschuh.net> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20230527-nolibc-stat-nanoseconds-v1-1-3f7825caae68@weissschuh.net> User-Agent: Mutt/1.10.1 (2018-07-13) X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_PASS, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, May 27, 2023 at 02:56:42PM +0200, Thomas Wei?schuh wrote: > Keep backwards compatibility through unions. > > The compatibility macros like > > #define st_atime st_atim.tv_sec > > as documented in stat(3type) don't work for nolibc because it would > break with other stat-like structures that contain the field st_atime. Ah, good idea, I like this approach. Generally speaking I hate defining macros to access some struct members, even though it has been done for decades in various places of standard libs. Your solution making use of anonymous unions is an elegant alternative to this. Thanks! Willy