[PATCH] linux: Fix sys/mount.h usage with kernel headers

Yann Droneaud ydroneaud@opteya.com
Tue Aug 9 17:43:03 GMT 2022


Hi,

Le 09/08/2022 à 19:22, Adhemerval Zanella via Libc-alpha a écrit :
> 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 <linux/mount.h> (for instance MS_RDONLY).
>
>    2. Include <linux/mount.h> 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.)
>
>    5. Undefine some macros also used on linux/fs.h.
>
> 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.

For the record there's a change submitted today for review:

[RFC][PATCH] uapi: Remove the inclusion of linux/mount.h from 
uapi/linux/fs.h  <https://lore.kernel.org/linux-api/163410.1659964655@warthog.procyon.org.uk/#r>

https://lore.kernel.org/linux-api/163410.1659964655@warthog.procyon.org.uk/


Regards.


-- 

Yann Droneaud

OPTEYA




More information about the Libc-alpha mailing list