From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id 177E7385828A for ; Thu, 11 Aug 2022 21:57:59 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 177E7385828A Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-665-ZTDlhxDyOy-rSLmzO0jBeA-1; Thu, 11 Aug 2022 17:57:55 -0400 X-MC-Unique: ZTDlhxDyOy-rSLmzO0jBeA-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 4E43738005D5; Thu, 11 Aug 2022 21:57:55 +0000 (UTC) Received: from oldenburg.str.redhat.com (unknown [10.39.192.85]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 74AED40D296C; Thu, 11 Aug 2022 21:57:54 +0000 (UTC) From: Florian Weimer To: Adhemerval Zanella via Libc-alpha Subject: Re: [PATCH v2 5/5] linux: Fix sys/mount.h usage with kernel headers References: <20220810172447.1502169-1-adhemerval.zanella@linaro.org> <20220810172447.1502169-6-adhemerval.zanella@linaro.org> Date: Thu, 11 Aug 2022 23:57:52 +0200 In-Reply-To: <20220810172447.1502169-6-adhemerval.zanella@linaro.org> (Adhemerval Zanella via Libc-alpha's message of "Wed, 10 Aug 2022 14:24:47 -0300") Message-ID: <874jyisasf.fsf@oldenburg.str.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.11.54.2 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain X-Spam-Status: No, score=-5.8 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_NONE, TXREP, 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 server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Aug 2022 21:58:00 -0000 * Adhemerval Zanella via Libc-alpha: > Now that kernel exports linux/mount.h and includes it on linux/fs.h, > its definitions might clash with glibc exports sys/mount.h. To avoid > the need to rearrange the Linux header to be always after glibc one, > the glibc sys/mount.h is changed to: > > 1. Undefine the macros also used as enum constants. This covers prior > inclusion of (for instance MS_RDONLY). > > 2. Include based on the usual __has_include check > (needs to use __has_include ("linux/mount.h") to paper over GCC > bugs. > > 3. Define enum fsconfig_command only if FSOPEN_CLOEXEC is not defined. > (FSOPEN_CLOEXEC should be a very close proxy.) > > 4. Define struct mount_attr if MOUNT_ATTR_SIZE_VER0 is not defined. > (Added in the same commit on the Linux side.) > > This patch also adds some tests to check if including linux/fs.h and > linux/mount.h after and before sys/mount.h does work. > > Checked on x86_64-linux-gnu. Also built with build-many-glibcs.py. This version looks good. There is a gap with old compilers only (those that don't have __has_include), and if is included after , but I think that's an acceptable trade-off. Reviewed-by: Florian Weimer Thanks, Florian