This is an automated email from the ASF dual-hosted git repository. acassis pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/nuttx.git
commit b866245f56864af3b637d6abcab73f6bda9ef8f5 Author: Marco Casaroli <[email protected]> AuthorDate: Fri Oct 23 17:11:47 2026 +0200 include/sys/statfs.h: Hide the file system types with NUTTX_NO_EXTENSIONS. POSIX does not define the *_MAGIC names of statfs(). Programs from other systems define constants with these names themselves, for example TMPFS_MAGIC to check f_type, and did not compile because the macro replaced their name. With NUTTX_NO_EXTENSIONS, sys/statfs.h does not define them. The values are those of Linux, so a program that defines its own constants gets the same values. Assisted-by: Claude Code:claude-opus-5-5 Signed-off-by: Marco Casaroli <[email protected]> --- include/nuttx/compiler.h | 13 +++++++------ include/sys/statfs.h | 9 ++++++++- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/include/nuttx/compiler.h b/include/nuttx/compiler.h index d1a152d8bfb..495973df3bc 100644 --- a/include/nuttx/compiler.h +++ b/include/nuttx/compiler.h @@ -1620,12 +1620,13 @@ * keep some non-standard names free for its own use. Then the headers do * not define ERROR and OK (sys/types.h), set_errno() and get_errno() * (errno.h), zalloc() (stdlib.h), O_TEXT and O_BINARY (fcntl.h), utimens() - * and lutimens() (sys/stat.h), PANIC(), PANIC_WITH_REGS(), ASSERT(), - * VERIFY(), COMPILE_TIME_ASSERT() and BUILD_BUG_ON_ZERO() (assert.h) and - * the helper macros of this file below, such as memory_barrier() and - * UNUSED(). The headers that a program includes do not use these names. - * A definition that the program made before is restored (saved at the - * start of this file). + * and lutimens() (sys/stat.h), the file system types *_MAGIC + * (sys/statfs.h), PANIC(), PANIC_WITH_REGS(), ASSERT(), VERIFY(), + * COMPILE_TIME_ASSERT() and BUILD_BUG_ON_ZERO() (assert.h) and the helper + * macros of this file below, such as memory_barrier() and UNUSED(). The + * headers that a program includes do not use these names. A definition + * that the program made before is restored (saved at the start of this + * file). */ #ifdef NUTTX_NO_EXTENSIONS diff --git a/include/sys/statfs.h b/include/sys/statfs.h index b19a08f9472..81e80af5417 100644 --- a/include/sys/statfs.h +++ b/include/sys/statfs.h @@ -36,7 +36,12 @@ * Pre-processor Definitions ****************************************************************************/ -/* struct statfs file system types. */ +/* The file system types of struct statfs. POSIX does not define them: + * NUTTX_NO_EXTENSIONS (see nuttx/compiler.h) hides them, so that a + * program can use these names for its own constants. + */ + +#ifndef NUTTX_NO_EXTENSIONS #define ADFS_SUPER_MAGIC 0xadf5 #define AFFS_SUPER_MAGIC 0xadff @@ -101,6 +106,8 @@ #define XIPFS_MAGIC 0x58495046 #define V9FS_MAGIC 0x01021997 +#endif /* NUTTX_NO_EXTENSIONS */ + #if defined(CONFIG_FS_LARGEFILE) # define statfs64 statfs # define fstatfs64 fstatfs
