build: check for FS_CONFIG_* header symbol in sys/mount.h

Fixes: #4176
Signed-off-by: Christian Brauner (Microsoft) <christian.brauner@ubuntu.com>
This commit is contained in:
Christian Brauner 2022-08-09 17:19:40 +02:00 committed by Christian Brauner (Microsoft)
parent ef1e0607b8
commit cbabe8abf1
No known key found for this signature in database
GPG Key ID: 91C61BC06578DCA2
2 changed files with 73 additions and 2 deletions

View File

@ -639,8 +639,7 @@ if cc.sizeof('struct mount_attr', prefix: decl_headers, args: '-D_GNU_SOURCE') >
found_types += 'struct mount_attr (sys/mount.h)'
else
srcconf.set10('HAVE_' + 'struct mount_attr'.underscorify().to_upper(), false)
missing_types += 'struct mount_attr (sys/mount.h)'
endif
missing_types += 'struct mount_attr (sys/mount.h)' endif
## Types.
decl_headers = '''
@ -656,6 +655,62 @@ else
missing_types += 'struct mount_attr (linux/mount.h)'
endif
if cc.has_header_symbol('sys/mount.h', 'FSCONFIG_SET_FLAG')
srcconf.set10('HAVE_' + 'FSCONFIG_SET_FLAG'.underscorify().to_upper(), true)
found_types += 'FSCONFIG_SET_FLAG'
else
srcconf.set10('HAVE_' + 'FSCONFIG_SET_FLAG'.underscorify().to_upper(), false)
missing_types += 'FSCONFIG_SET_FLAG'
endif
if cc.has_header_symbol('sys/mount.h', 'FS_CONFIG_SET_STRING')
srcconf.set10('HAVE_' + 'FS_CONFIG_SET_STRING'.underscorify().to_upper(), true)
found_types += 'FS_CONFIG_SET_STRING'
else
srcconf.set10('HAVE_' + 'FS_CONFIG_SET_STRING'.underscorify().to_upper(), false)
missing_types += 'FS_CONFIG_SET_STRING'
endif
if cc.has_header_symbol('sys/mount.h', 'FS_CONFIG_SET_BINARY')
srcconf.set10('HAVE_' + 'FS_CONFIG_SET_BINARY'.underscorify().to_upper(), true)
found_types += 'FS_CONFIG_SET_BINARY'
else
srcconf.set10('HAVE_' + 'FS_CONFIG_SET_BINARY'.underscorify().to_upper(), false)
missing_types += 'FS_CONFIG_SET_BINARY'
endif
if cc.has_header_symbol('sys/mount.h', 'FS_CONFIG_SET_PATH_EMPTY')
srcconf.set10('HAVE_' + 'FS_CONFIG_SET_PATH_EMPTY'.underscorify().to_upper(), true)
found_types += 'FS_CONFIG_SET_PATH_EMPTY'
else
srcconf.set10('HAVE_' + 'FS_CONFIG_SET_PATH_EMPTY'.underscorify().to_upper(), false)
missing_types += 'FS_CONFIG_SET_PATH_EMPTY'
endif
if cc.has_header_symbol('sys/mount.h', 'FS_CONFIG_SET_PATH_FD')
srcconf.set10('HAVE_' + 'FS_CONFIG_SET_PATH_FD'.underscorify().to_upper(), true)
found_types += 'FS_CONFIG_SET_PATH_FD'
else
srcconf.set10('HAVE_' + 'FS_CONFIG_SET_PATH_FD'.underscorify().to_upper(), false)
missing_types += 'FS_CONFIG_SET_PATH_FD'
endif
if cc.has_header_symbol('sys/mount.h', 'FS_CONFIG_SET_CMD_CREATE')
srcconf.set10('HAVE_' + 'FS_CONFIG_SET_CMD_CREATE'.underscorify().to_upper(), true)
found_types += 'FS_CONFIG_SET_CMD_CREATE'
else
srcconf.set10('HAVE_' + 'FS_CONFIG_SET_CMD_CREATE'.underscorify().to_upper(), false)
missing_types += 'FS_CONFIG_SET_CMD_CREATE'
endif
if cc.has_header_symbol('sys/mount.h', 'FS_CONFIG_SET_CMD_RECONFIGURE')
srcconf.set10('HAVE_' + 'FS_CONFIG_SET_CMD_RECONFIGURE'.underscorify().to_upper(), true)
found_types += 'FS_CONFIG_SET_CMD_RECONFIGURE'
else
srcconf.set10('HAVE_' + 'FS_CONFIG_SET_CMD_RECONFIGURE'.underscorify().to_upper(), false)
missing_types += 'FS_CONFIG_SET_CMD_RECONFIGURE'
endif
## Headers.
foreach ident: [
['bpf', '''#include <sys/syscall.h>

View File

@ -82,37 +82,53 @@ struct lxc_rootfs;
#endif
/* fsconfig() commands */
#if !HAVE_FSCONFIG_SET_FLAG
#ifndef FSCONFIG_SET_FLAG
#define FSCONFIG_SET_FLAG 0 /* Set parameter, supplying no value */
#endif
#endif
#if !HAVE_FSCONFIG_SET_STRING
#ifndef FSCONFIG_SET_STRING
#define FSCONFIG_SET_STRING 1 /* Set parameter, supplying a string value */
#endif
#endif
#if !HAVE_FSCONFIG_SET_BINARY
#ifndef FSCONFIG_SET_BINARY
#define FSCONFIG_SET_BINARY 2 /* Set parameter, supplying a binary blob value */
#endif
#endif
#if !HAVE_FSCONFIG_SET_PATH
#ifndef FSCONFIG_SET_PATH
#define FSCONFIG_SET_PATH 3 /* Set parameter, supplying an object by path */
#endif
#endif
#if !HAVE_FSCONFIG_SET_PATH_EMPTY
#ifndef FSCONFIG_SET_PATH_EMPTY
#define FSCONFIG_SET_PATH_EMPTY 4 /* Set parameter, supplying an object by (empty) path */
#endif
#endif
#if !HAVE_FSCONFIG_SET_FD
#ifndef FSCONFIG_SET_FD
#define FSCONFIG_SET_FD 5 /* Set parameter, supplying an object by fd */
#endif
#endif
#if !HAVE_FSCONFIG_CMD_CREATE
#ifndef FSCONFIG_CMD_CREATE
#define FSCONFIG_CMD_CREATE 6 /* Invoke superblock creation */
#endif
#endif
#if !FSCONFIG_CMD_RECONFIGURE
#ifndef FSCONFIG_CMD_RECONFIGURE
#define FSCONFIG_CMD_RECONFIGURE 7 /* Invoke superblock reconfiguration */
#endif
#endif
/* fsmount() flags */
#ifndef FSMOUNT_CLOEXEC