When building the project on a Linux Mint 20.3 (based on Ubuntu Focal) I get the following errors:
...
CC composefs/libcomposefs/libcomposefs_la-lcfs-writer.lo
CC composefs/libcomposefs/libcomposefs_la-lcfs-mount.lo
composefs/libcomposefs/lcfs-mount.c:112:13: warning: ‘struct mount_attr’ declared inside parameter list will not be visible outside of this definition or declaration
112 | struct mount_attr *attr, size_t usize)
| ^~~~~~~~~~
composefs/libcomposefs/lcfs-mount.c: In function ‘setup_loopback’:
composefs/libcomposefs/lcfs-mount.c:273:9: error: variable ‘loopconfig’ has initializer but incomplete type
273 | struct loop_config loopconfig = { 0 };
| ^~~~~~~~~~~
composefs/libcomposefs/lcfs-mount.c:273:36: warning: excess elements in struct initializer
273 | struct loop_config loopconfig = { 0 };
| ^
composefs/libcomposefs/lcfs-mount.c:273:36: note: (near initialization for ‘loopconfig’)
composefs/libcomposefs/lcfs-mount.c:273:21: error: storage size of ‘loopconfig’ isn’t known
273 | struct loop_config loopconfig = { 0 };
| ^~~~~~~~~~
composefs/libcomposefs/lcfs-mount.c:303:20: error: ‘LOOP_CONFIGURE’ undeclared (first use in this function)
303 | if (ioctl(loopfd, LOOP_CONFIGURE, &loopconfig) < 0) {
| ^~~~~~~~~~~~~~
composefs/libcomposefs/lcfs-mount.c:303:20: note: each undeclared identifier is reported only once for each function it appears in
composefs/libcomposefs/lcfs-mount.c:273:21: warning: unused variable ‘loopconfig’ [-Wunused-variable]
273 | struct loop_config loopconfig = { 0 };
| ^~~~~~~~~~
composefs/libcomposefs/lcfs-mount.c: In function ‘lcfs_mount_erofs’:
composefs/libcomposefs/lcfs-mount.c:384:10: error: variable ‘attr’ has initializer but incomplete type
384 | struct mount_attr attr = {
| ^~~~~~~~~~
composefs/libcomposefs/lcfs-mount.c:385:5: error: ‘struct mount_attr’ has no member named ‘attr_set’
385 | .attr_set = MOUNT_ATTR_IDMAP,
| ^~~~~~~~
composefs/libcomposefs/lcfs-mount.c:385:16: error: ‘MOUNT_ATTR_IDMAP’ undeclared (first use in this function); did you mean ‘MOUNT_ATTR_NODEV’?
385 | .attr_set = MOUNT_ATTR_IDMAP,
| ^~~~~~~~~~~~~~~~
| MOUNT_ATTR_NODEV
composefs/libcomposefs/lcfs-mount.c:385:16: warning: excess elements in struct initializer
composefs/libcomposefs/lcfs-mount.c:385:16: note: (near initialization for ‘attr’)
composefs/libcomposefs/lcfs-mount.c:386:5: error: ‘struct mount_attr’ has no member named ‘userns_fd’
386 | .userns_fd = state->options->idmap_fd,
| ^~~~~~~~~
composefs/libcomposefs/lcfs-mount.c:386:17: warning: excess elements in struct initializer
386 | .userns_fd = state->options->idmap_fd,
| ^~~~~
composefs/libcomposefs/lcfs-mount.c:386:17: note: (near initialization for ‘attr’)
composefs/libcomposefs/lcfs-mount.c:384:21: error: storage size of ‘attr’ isn’t known
384 | struct mount_attr attr = {
| ^~~~
composefs/libcomposefs/lcfs-mount.c:390:17: error: invalid application of ‘sizeof’ to incomplete type ‘struct mount_attr’
390 | sizeof(struct mount_attr));
| ^~~~~~
composefs/libcomposefs/lcfs-mount.c:384:21: warning: unused variable ‘attr’ [-Wunused-variable]
384 | struct mount_attr attr = {
| ^~~~
make[2]: *** [Makefile:5304: composefs/libcomposefs/libcomposefs_la-lcfs-mount.lo] Error 1
CC src/rofiles-fuse/rofiles_fuse-main.o
CC src/libostree/tests_test_rollsum_cli-ostree-rollsum.o
...
Basically, the build fails because of two reasons:
The header linux/mount.h misses the struct mount_attr and macro MOUNT_ATTR_IDMAP; this happens despite the fact that "new mount API" has been detected.
The header linux/loop.h misses the struct loop_config and macro LOOP_CONFIGURE.
I was wondering if it would make sense to solve these issues in the upstream project to allow the build on machines having older Linux headers. If it does, I have a patch that tries to tackle them and I could create a PR for it. What do you guys think?
I don't mind making this work on older kernels. The idmap is just about adding some checks, but for missing LOOP_CONFIGURE you eill need to have some alternative implementations of some things.
When building the project on a Linux Mint 20.3 (based on Ubuntu Focal) I get the following errors:
Basically, the build fails because of two reasons:
linux/mount.h
misses thestruct mount_attr
and macroMOUNT_ATTR_IDMAP
; this happens despite the fact that "new mount API" has been detected.linux/loop.h
misses thestruct loop_config
and macroLOOP_CONFIGURE
.I was wondering if it would make sense to solve these issues in the upstream project to allow the build on machines having older Linux headers. If it does, I have a patch that tries to tackle them and I could create a PR for it. What do you guys think?