src/locktest.c: fix build failure of struct delegation
PATCH 1/1 src/locktest.c: fix build failure of struct delegation
Since glibc commit f2e3dacbff88 ("Add new constants from Linux 6.12, 6.18 and 6.19 to bits/fcntl-linux.h"), the F_GETDELEG and F_SETDELEG constants from Linux 6.19 have been added directly into <fcntl.h>. However, the corresponding full definition for 'struct delegation' was not included in glibc's userspace wrapper. That causes below build error:
locktest.c:1065:16: error: variable 'deleg' has initializer but incomplete type
1065 | struct delegation deleg = { .d_type = F_UNLCK };
...
Fix this by isolating the definition of 'struct delegation' from the command macros via autoconf capability probing:
1. Add an AC_CHECK_TYPES check for 'struct delegation' in configure.ac.
2. In locktest.c, unbind 'struct delegation' from the '#ifndef F_GETDELEG' guard and wrap it with '#ifndef HAVE_STRUCT_DELEGATION' instead.
---
Hi,
fstests currently fails to build against the latest glibc, with the root cause detailed in the commit log above.
The glibc now defines F_GETDELEG and F_SETDELEG, but leaves out the actual 'struct delegation' definition. The complete struct is available in <linux/fcntl.h>, but we cannot simply include both <fcntl.h> and <linux/fcntl.h> due to nasty namespace redefinition conflicts.
I am not entirely sure if glibc will bring in 'struct delegation', so for now, I chose to decouple and handle the structure definition independently via autoconf.
Any thoughts or better suggestions on how we should handle this transition?
Thanks,
Zorro
configure.ac | 4 ++++ src/locktest.c | 2 ++ 2 files changed, 6 insertions(+)
configure.ac +4 -0
@@ -111,6 +111,10 @@ AC_CHECK_TYPES([struct btrfs_ioctl_received_subvol_args], [], [], [[ #include <stddef.h> #include <linux/btrfs.h> ]]) +AC_CHECK_TYPES([struct delegation], [], [], [[ +#include <stddef.h> +#include <fcntl.h> +]]) AC_CHECK_HEADERS([linux/btrfs.h linux/btrfs_tree.h]) AC_CHECK_MEMBERS([struct btrfs_ioctl_vol_args_v2.subvolid], [], [], [[ #include <stddef.h>
src/locktest.c +2 -0
@@ -80,7 +80,9 @@ extern int h_errno;#ifndef F_GETDELEG #define F_GETDELEG (1024 + 15)#define F_SETDELEG (1024 + 16) +#endif +#ifndef HAVE_STRUCT_DELEGATION struct delegation { uint32_t d_flags; uint16_t d_type;
Signature · 1 line
2.55.0
Quoted 31 lines · Zorro Lang
Since glibc commit
f2e3dacbff88("Add new constants from Linux 6.12, 6.18 and 6.19 tobits/fcntl-linux.h"), theF_GETDELEGandF_SETDELEGconstants from Linux 6.19 have been added directly into <fcntl.h>. However, the corresponding full definition for 'struct delegation' was not included in glibc's userspace wrapper. That causes below build error:locktest.c:1065:16: error: variable 'deleg' has initializer but incomplete type
1065 | struct delegation deleg = { .d_type =F_UNLCK};
...Fix this by isolating the definition of 'struct delegation' from the command macros via autoconf capability probing:
1. Add an
AC_CHECK_TYPEScheck for 'struct delegation' in configure.ac.
2. Inlocktest.c, unbind 'struct delegation' from the '#ifndefF_GETDELEG' guard and wrap it with '#ifndefHAVE_STRUCT_DELEGATION' instead.Signed-off-by Zorro Lang <[email protected]>---
Hi,
fstests currently fails to build against the latest glibc, with the root cause detailed in the commit log above.
The glibc now defines
F_GETDELEGandF_SETDELEG, but leaves out the actual 'struct delegation' definition. The complete struct is available in <linux/fcntl.h>, but we cannot simply include both <fcntl.h> and <linux/fcntl.h> due to nasty namespace redefinition conflicts.
Quoted 5 lines
I am not entirely sure if glibc will bring in 'struct delegation', so for now, I chose to decouple and handle the structure definition independently via autoconf.
Any thoughts or better suggestions on how we should handle this transition?
Friendly ping...
Am I the only one seeing this? Without this patch, xfstests won't compile on the latest Fedora:
glibc-devel-2.44.9000-1.fc46.x86_64
gcc-16.2.1-2.fc46.x86_64
I keep running into the build error below [1].
Thanks,
Zorro
[1]locktest.c: In function 'initialize':
locktest.c:1018:17: warning: variable 'offset' set but not used [-Wunused-but-set-variable=]
1018 | int offset = 0;
| ^~~~~~
locktest.c: In function 'release_lease':
locktest.c:1065:16: error: variable 'deleg' has initializer but incomplete type
1065 | struct delegation deleg = { .d_type = F_UNLCK };
| ^~~~~~~~~~locktest.c:1065:38: error: 'struct delegation' has no member named 'd_type'
1065 | struct delegation deleg = { .d_type = F_UNLCK };
| ^~~~~~
locktest.c:1065:47: warning: excess elements in struct initializer
1065 | struct delegation deleg = { .d_type = F_UNLCK };
| ^~~~~~~
locktest.c:1065:47: note: (near initialization for 'deleg') locktest.c:1065:27: error: storage size of 'deleg' isn't known
1065 | struct delegation deleg = { .d_type = F_UNLCK };
| ^~~~~
locktest.c:1065:27: warning: unused variable 'deleg' [-Wunused-variable] locktest.c: In function 'do_deleg':
locktest.c:1365:12: error: variable 'deleg' has initializer but incomplete type
1365 | struct delegation deleg = { .d_type = arg };
| ^~~~~~~~~~locktest.c:1365:34: error: 'struct delegation' has no member named 'd_type'
1365 | struct delegation deleg = { .d_type = arg };
| ^~~~~~
locktest.c:1365:43: warning: excess elements in struct initializer
1365 | struct delegation deleg = { .d_type = arg };
| ^~~
locktest.c:1365:43: note: (near initialization for 'deleg') locktest.c:1365:23: error: storage size of 'deleg' isn't known
1365 | struct delegation deleg = { .d_type = arg };
| ^~~~~
locktest.c:1365:23: warning: unused variable 'deleg' [-Wunused-variable] locktest.c: In function 'main':
locktest.c:1615:16: error: variable 'deleg' has initializer but incomplete type
1615 | struct delegation deleg = { .d_type = F_UNLCK };
| ^~~~~~~~~~locktest.c:1615:38: error: 'struct delegation' has no member named 'd_type'
1615 | struct delegation deleg = { .d_type = F_UNLCK };
| ^~~~~~
locktest.c:1615:47: warning: excess elements in struct initializer
1615 | struct delegation deleg = { .d_type = F_UNLCK };
| ^~~~~~~
locktest.c:1615:47: note: (near initialization for 'deleg') locktest.c:1615:27: error: storage size of 'deleg' isn't known
1615 | struct delegation deleg = { .d_type = F_UNLCK };
| ^~~~~
locktest.c:1615:27: warning: unused variable 'deleg' [-Wunused-variable]
[CC] chprojid_fail
[CC] detached_mounts_propagation
gmake[2]: *** [Makefile:139: locktest] Error 1
gmake[2]: *** Waiting for unfinished jobs....
gmake[1]: *** [include/buildrules:30: src] Error 2
make: *** [Makefile:65: default] Error 2
Quoted 41 lines
Thanks,
Zorroconfigure.ac | 4 ++++ src/locktest.c | 2 ++ 2 files changed, 6 insertions(+)configure.ac +4
-0@@ -111,6 +111,10 @@ AC_CHECK_TYPES([struct btrfs_ioctl_received_subvol_args], [], [], [[ #include <stddef.h> #include <linux/btrfs.h> ]]) +AC_CHECK_TYPES([struct delegation], [], [], [[ +#include <stddef.h> +#include <fcntl.h> +]]) AC_CHECK_HEADERS([linux/btrfs.h linux/btrfs_tree.h]) AC_CHECK_MEMBERS([struct btrfs_ioctl_vol_args_v2.subvolid], [], [], [[ #include <stddef.h>src/locktest.c +2
-0@@ -80,7 +80,9 @@ extern int h_errno;#ifndef F_GETDELEG #define F_GETDELEG (1024 + 15)#define F_SETDELEG (1024 + 16) +#endif +#ifndef HAVE_STRUCT_DELEGATION struct delegation { uint32_t d_flags; uint16_t d_type;Signature · 1 line
2.55.0
Lukas Herbolt
Reviewed-byQuoted 143 lines · Zorro Lang
Quoted 32 lines · Zorro Lang
Since glibc commit
f2e3dacbff88("Add new constants from Linux 6.12, 6.18 and 6.19 tobits/fcntl-linux.h"), theF_GETDELEGandF_SETDELEGconstants from Linux 6.19 have been added directly into <fcntl.h>. However, the corresponding full definition for 'struct delegation' was not included in glibc's userspace wrapper. That causes below build error:locktest.c:1065:16: error: variable 'deleg' has initializer but
incomplete type
1065 | struct delegation deleg = { .d_type =F_UNLCK};
...Fix this by isolating the definition of 'struct delegation' from the command macros via autoconf capability probing:
1. Add an
AC_CHECK_TYPEScheck for 'struct delegation' in configure.ac.
2. Inlocktest.c, unbind 'struct delegation' from the '#ifndefF_GETDELEG' guard and wrap it with '#ifndefHAVE_STRUCT_DELEGATION' instead.Signed-off-by Zorro Lang <[email protected]>---
Hi,
fstests currently fails to build against the latest glibc, with the root cause detailed in the commit log above.
The glibc now defines
F_GETDELEGandF_SETDELEG, but leaves out the actual 'struct delegation' definition. The complete struct is available in <linux/fcntl.h>, but we cannot simply include both <fcntl.h> and <linux/fcntl.h> due to nasty namespace redefinition conflicts.Quoted 5 lines
I am not entirely sure if glibc will bring in 'struct delegation', so for now, I chose to decouple and handle the structure definition independently via autoconf.
Any thoughts or better suggestions on how we should handle this transition?
Friendly ping...
Am I the only one seeing this? Without this patch, xfstests won't compile on the latest Fedora:
glibc-devel-2.44.9000-1.fc46.x86_64
gcc-16.2.1-2.fc46.x86_64I keep running into the build error below [1].
Thanks,
Zorro[1]
locktest.c: In function 'initialize':
locktest.c:1018:17: warning: variable 'offset' set but not used [-Wunused-but-set-variable=]1018 | int offset = 0; | ^~~~~~ locktest.c: In function 'release_lease': locktest.c:1065:16: error: variable 'deleg' has initializer but incomplete type 1065 | struct delegation deleg = { .d_type = F_UNLCK }; | ^~~~~~~~~~locktest.c:1065:38: error: 'struct delegation' has no member named '
d_type'
1065 | struct delegation deleg = { .d_type =F_UNLCK};
| ^~~~~~
locktest.c:1065:47: warning: excess elements in struct initializer
1065 | struct delegation deleg = { .d_type =F_UNLCK};
| ^~~~~~~
locktest.c:1065:47: note: (near initialization for 'deleg') locktest.c:1065:27: error: storage size of 'deleg' isn't known
1065 | struct delegation deleg = { .d_type =F_UNLCK};
| ^~~~~
locktest.c:1065:27: warning: unused variable 'deleg' [-Wunused-variable]locktest.c: In function 'do_deleg':
locktest.c:1365:12: error: variable 'deleg' has initializer but incomplete type1365 | struct delegation deleg = { .d_type = arg }; | ^~~~~~~~~~locktest.c:1365:34: error: 'struct delegation' has no member named '
d_type'
1365 | struct delegation deleg = { .d_type = arg };
| ^~~~~~
locktest.c:1365:43: warning: excess elements in struct initializer
1365 | struct delegation deleg = { .d_type = arg };
| ^~~
locktest.c:1365:43: note: (near initialization for 'deleg') locktest.c:1365:23: error: storage size of 'deleg' isn't known
1365 | struct delegation deleg = { .d_type = arg };
| ^~~~~
locktest.c:1365:23: warning: unused variable 'deleg' [-Wunused-variable]locktest.c: In function 'main':
locktest.c:1615:16: error: variable 'deleg' has initializer but incomplete type1615 | struct delegation deleg = { .d_type = F_UNLCK }; | ^~~~~~~~~~locktest.c:1615:38: error: 'struct delegation' has no member named '
d_type'
1615 | struct delegation deleg = { .d_type =F_UNLCK};
| ^~~~~~
locktest.c:1615:47: warning: excess elements in struct initializer
1615 | struct delegation deleg = { .d_type =F_UNLCK};
| ^~~~~~~
locktest.c:1615:47: note: (near initialization for 'deleg') locktest.c:1615:27: error: storage size of 'deleg' isn't known
1615 | struct delegation deleg = { .d_type =F_UNLCK};
| ^~~~~
locktest.c:1615:27: warning: unused variable 'deleg' [-Wunused-variable]
[CC]chprojid_fail
[CC]detached_mounts_propagation
gmake[2]: *** [Makefile:139: locktest] Error 1
gmake[2]: *** Waiting for unfinished jobs....
gmake[1]: *** [include/buildrules:30: src] Error 2
make: *** [Makefile:65: default] Error 2Quoted 35 lines
Thanks,
Zorroconfigure.ac | 4 ++++ src/locktest.c | 2 ++ 2 files changed, 6 insertions(+)configure.ac +0
-0@@ -111,6 +111,10 @@ AC_CHECK_TYPES([struct
btrfs_ioctl_received_subvol_args], [], [], [[
#include <stddef.h>
#include <linux/btrfs.h>
]])configure.ac +4
-0+AC_CHECK_TYPES([struct delegation], [], [], [[ +#include <stddef.h> +#include <fcntl.h> +]]) AC_CHECK_HEADERS([linux/btrfs.h linux/btrfs_tree.h]) AC_CHECK_MEMBERS([struct btrfs_ioctl_vol_args_v2.subvolid], [], [],[[
#include <stddef.h>src/locktest.c +1
-0@@ -80,7 +80,9 @@ extern int h_errno;#ifndef F_GETDELEG #define F_GETDELEG (1024 + 15)#define F_SETDELEG (1024 + 16) +#endif
Quoted 8 lines
Quoted 8 lines
src/locktest.c +1
-1+#ifndef HAVE_STRUCT_DELEGATION struct delegation { uint32_t d_flags; uint16_t d_type; --2.55.0
Hit the same on fedora-rawhide looks good to me.
Signature · 1 line
-lhe
Quoted 171 lines · Lukas Herbolt
Quoted 160 lines · Zorro Lang
Quoted 38 lines · Zorro Lang
Since glibc commit
f2e3dacbff88("Add new constants from Linux 6.12, 6.18 and 6.19 tobits/fcntl-linux.h"), theF_GETDELEGandF_SETDELEGconstants from Linux 6.19 have been added directly into <fcntl.h>. However, the corresponding full definition for 'struct delegation' was not included in glibc's userspace wrapper. That causes below build error:locktest.c:1065:16: error: variable 'deleg' has initializer but
incomplete type
1065 | struct delegation deleg = { .d_type =F_UNLCK};
...Fix this by isolating the definition of 'struct delegation' from the command macros via autoconf capability probing:
1. Add an
AC_CHECK_TYPEScheck for 'struct delegation' in configure.ac.
2. Inlocktest.c, unbind 'struct delegation' from the '#ifndefF_GETDELEG'
guard and wrap it with '#ifndefHAVE_STRUCT_DELEGATION' instead.Signed-off-by Zorro Lang <[email protected]>---
Hi,
fstests currently fails to build against the latest glibc, with the root
cause detailed in the commit log above.The glibc now defines
F_GETDELEGandF_SETDELEG, but leaves out the actual
'struct delegation' definition. The complete struct is available in <linux/fcntl.h>,
but we cannot simply include both <fcntl.h> and <linux/fcntl.h> due to nasty
namespace redefinition conflicts.Quoted 8 lines
I am not entirely sure if glibc will bring in 'struct delegation', so for now,
I chose to decouple and handle the structure definition independently via
autoconf.Any thoughts or better suggestions on how we should handle this transition?
Friendly ping...
Am I the only one seeing this? Without this patch, xfstests won't compile on
the latest Fedora:
glibc-devel-2.44.9000-1.fc46.x86_64 gcc-16.2.1-2.fc46.x86_64I keep running into the build error below [1].
Thanks,
Zorro[1]
locktest.c: In function 'initialize':
locktest.c:1018:17: warning: variable 'offset' set but not used [-Wunused-but-set-variable=]1018 | int offset = 0; | ^~~~~~ locktest.c: In function 'release_lease': locktest.c:1065:16: error: variable 'deleg' has initializer but incomplete type 1065 | struct delegation deleg = { .d_type = F_UNLCK }; | ^~~~~~~~~~locktest.c:1065:38: error: 'struct delegation' has no member named '
d_type'
1065 | struct delegation deleg = { .d_type =F_UNLCK};
| ^~~~~~
locktest.c:1065:47: warning: excess elements in struct initializer
1065 | struct delegation deleg = { .d_type =F_UNLCK};
| ^~~~~~~
locktest.c:1065:47: note: (near initialization for 'deleg') locktest.c:1065:27: error: storage size of 'deleg' isn't known
1065 | struct delegation deleg = { .d_type =F_UNLCK};
| ^~~~~
locktest.c:1065:27: warning: unused variable 'deleg' [-Wunused-variable]locktest.c: In function 'do_deleg':
locktest.c:1365:12: error: variable 'deleg' has initializer but incomplete type1365 | struct delegation deleg = { .d_type = arg }; | ^~~~~~~~~~locktest.c:1365:34: error: 'struct delegation' has no member named '
d_type'
1365 | struct delegation deleg = { .d_type = arg };
| ^~~~~~
locktest.c:1365:43: warning: excess elements in struct initializer
1365 | struct delegation deleg = { .d_type = arg };
| ^~~
locktest.c:1365:43: note: (near initialization for 'deleg') locktest.c:1365:23: error: storage size of 'deleg' isn't known
1365 | struct delegation deleg = { .d_type = arg };
| ^~~~~
locktest.c:1365:23: warning: unused variable 'deleg' [-Wunused-variable]locktest.c: In function 'main':
locktest.c:1615:16: error: variable 'deleg' has initializer but incomplete type1615 | struct delegation deleg = { .d_type = F_UNLCK }; | ^~~~~~~~~~locktest.c:1615:38: error: 'struct delegation' has no member named '
d_type'
1615 | struct delegation deleg = { .d_type =F_UNLCK};
| ^~~~~~
locktest.c:1615:47: warning: excess elements in struct initializer
1615 | struct delegation deleg = { .d_type =F_UNLCK};
| ^~~~~~~
locktest.c:1615:47: note: (near initialization for 'deleg') locktest.c:1615:27: error: storage size of 'deleg' isn't known
1615 | struct delegation deleg = { .d_type =F_UNLCK};
| ^~~~~
locktest.c:1615:27: warning: unused variable 'deleg' [-Wunused-variable]
[CC]chprojid_fail
[CC]detached_mounts_propagation
gmake[2]: *** [Makefile:139: locktest] Error 1
gmake[2]: *** Waiting for unfinished jobs....
gmake[1]: *** [include/buildrules:30: src] Error 2
make: *** [Makefile:65: default] Error 2Quoted 35 lines
Thanks,
Zorroconfigure.ac | 4 ++++ src/locktest.c | 2 ++ 2 files changed, 6 insertions(+)configure.ac +0
-0@@ -111,6 +111,10 @@ AC_CHECK_TYPES([struct
btrfs_ioctl_received_subvol_args], [], [], [[
#include <stddef.h>
#include <linux/btrfs.h>
]])configure.ac +4
-0+AC_CHECK_TYPES([struct delegation], [], [], [[ +#include <stddef.h> +#include <fcntl.h> +]]) AC_CHECK_HEADERS([linux/btrfs.h linux/btrfs_tree.h]) AC_CHECK_MEMBERS([struct btrfs_ioctl_vol_args_v2.subvolid], [], [],[[
#include <stddef.h>src/locktest.c +1
-0@@ -80,7 +80,9 @@ extern int h_errno;#ifndef F_GETDELEG #define F_GETDELEG (1024 + 15)#define F_SETDELEG (1024 + 16) +#endif Quoted 8 lines
Quoted 8 lines
src/locktest.c +1
-1+#ifndef HAVE_STRUCT_DELEGATION struct delegation { uint32_t d_flags; uint16_t d_type; --2.55.0
Hit the same on fedora-rawhide looks good to me.
Quoted 1 line
Reviewed-by "Lukas Herbolt" <[email protected]>
Thanks! I finally don't have to keep rebasing this patch locally :)
Quoted 4 lines
Signature · 2 lines
-- -lhe