Skip to contentSkip to conversation

configure.ac: Add _GNU_SOURCE for struct fs_quota_statv check

PATCH In review Li Wang 3 participants 7 messages Jun 17, 2024 – Jun 19, 2024

lore
Share & tools
lore

Li Wang

author
#0 lore raw

PATCH 1/1 configure.ac: Add _GNU_SOURCE for struct fs_quota_statv check

These changes help ensure that the necessary features and definitions are available during the configuration process, preventing potential issues related to missing or incompatible definitions. This should resolve the compilation error related to struct fs_quota_statv:

/usr/include/xfs/xqm.h:167:8: error: redefinition of ‘struct fs_qfilestatv’

---
 configure.ac | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
configure.ac +5 -1
index 85c5739c4..82969b8d3 100644
@@ -181,7 +181,11 @@ AC_CHECK_TYPES([struct file_handle],,,[
 #include <fcntl.h>
 ])
 
-AC_CHECK_TYPES([struct fs_quota_statv],,,[#include <xfs/xqm.h>])
+AC_CHECK_TYPES([struct fs_quota_statv],,,[
+#define _GNU_SOURCE
+#include <xfs/xqm.h>
+])
+
 AC_CHECK_TYPES([struct if_nextdqblk],,,[#include <linux/quota.h>])
 AC_CHECK_TYPES([struct iovec],,,[#include <sys/uio.h>])
 AC_CHECK_TYPES([struct ipc64_perm],,,[#include <sys/ipcbuf.h>])
Signature · 5 lines
2.45.2


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
#2 lore raw
In reply to Li Wang

Hi Li,

Quoted 6 lines

These changes help ensure that the necessary features and definitions are available during the configuration process, preventing potential issues related to missing or incompatible definitions. This should resolve the compilation error related to struct fs_quota_statv:

/usr/include/xfs/xqm.h:167:8: error: redefinition of ‘struct fs_qfilestatv’

I wonder how _GNU_SOURCE influences any XFS header?
I haven't found anything in (<xfs/*.h>) or in <sys/quota.h>
I know that some quotactl0[23].c define _GNU_SOURCE, but it's interesting that this influence the header. Also, which RHEL (or whatever distro) version has this problem?

Kind regards,
Petr

Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
author
#3 lore raw

Hi Petr, XFS-Experts,

Quoted 7 lines · Petr Vorel

Hi Li,

Quoted 4 lines

These changes help ensure that the necessary features and definitions are available during the configuration process, preventing potential issues related to missing or incompatible definitions. This should resolve the compilation error related to struct fs_quota_statv:

Quoted 6 lines
Quoted 1 line

/usr/include/xfs/xqm.h:167:8: error: redefinition of ‘struct

fs_qfilestatv’

I wonder how _GNU_SOURCE influences any XFS header? I haven't found anything in (<xfs/*.h>) or in <sys/quota.h>

With installing a newer xfsprogs-dev package on RHEL, we got a problem in configuring our LTP test.

According to the inclusion relationship: "xfs/xqm.h" -> "xfs/xfs.h" -> "xfs/linux.h".
The linux.h header introduces an inlined function that needs '_GNU_SOURCE' and <fcnctl.h>.

$ git clone https://kernel.googlesource.com/pub/scm/fs/xfs/xfsprogs-dev
$ cd xfsprogs-dev/
$ git describe --contains 9d6023a856a1c4f84415dff59b0d5459cc8768db
v5.5.0-rc1~39

#if defined(FALLOC_FL_ZERO_RANGE)
static inline int
platform_zero_range(
int fd,
xfs_off_t start,
size_t len)

{
        int ret;

        ret = fallocate(fd, FALLOC_FL_ZERO_RANGE, start, len);
        if (!ret)
        return 0;
        return -errno;
}

#else
#define platform_zero_range(fd, s, l) (-EOPNOTSUPP) #endif

My test version is based on 6.5 so contains the inlined function to build.

# rpm -qf /usr/include/xfs/xqm.h
xfsprogs-devel-6.5.0-3.el10.x86_64
Quoted 5 lines

I know that some quotactl0[23].c define _GNU_SOURCE, but it's interesting that
this influence the header. Also, which RHEL (or whatever distro) version has
this problem?

The error occurred (with install xfsprogs-devel) during the configure script checking struct fs_quota_statv. It failed to compile conftest.c and report such errors:

configure:5697: checking for struct fs_quota_statv configure:5697: gcc -c -g -O2 conftest.c >&5 In file included from /usr/include/xfs/xfs.h:9,

                 from /usr/include/xfs/xqm.h:9,
                 from conftest.c:138:
/usr/include/xfs/linux.h: In function 'platform_zero_range':
/usr/include/xfs/linux.h:188:15: error: implicit declaration of function
'fallocate' [-Wimplicit-function-declaration]
  188 |         ret = fallocate(fd, FALLOC_FL_ZERO_RANGE, start, len);
      |               ^~~~~~~~~

configure:5697: $? = 1

It similarly to the above quotactl07 patch fix, so adding '#define _GNU_SOURCE'
is actually for making the fallocate() happy.

Or, another way is the change made in "xfsprogs-dev/include/linux.h" otherwise we can't
configure our LTP correctly.

Signature · 5 lines
Regards,
Li Wang

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
author
#4 lore raw

cc Eric Sandeen <[email protected]> who is the author of:

commit 9d6023a856a1c4f84415dff59b0d5459cc8768db

Author: Eric Sandeen <[email protected]>
Date:   Thu Feb 27 15:05:48 2020 -0500

libxfs: use FALLOC_FL_ZERO_RANGE in libxfs_device_zero

Quoted 94 lines · Li Wang

Hi Petr, XFS-Experts,

Quoted 7 lines · Petr Vorel

Hi Li,

Quoted 4 lines

These changes help ensure that the necessary features and definitions are available during the configuration process, preventing potential issues related to missing or incompatible definitions. This should resolve the compilation error related to struct fs_quota_statv:

Quoted 6 lines
Quoted 1 line

/usr/include/xfs/xqm.h:167:8: error: redefinition of ‘struct

fs_qfilestatv’

I wonder how _GNU_SOURCE influences any XFS header? I haven't found anything in (<xfs/*.h>) or in <sys/quota.h>

With installing a newer xfsprogs-dev package on RHEL, we got a problem in configuring our LTP test.

According to the inclusion relationship: "xfs/xqm.h" -> "xfs/xfs.h" -> "xfs/linux.h".
The linux.h header introduces an inlined function that needs '_GNU_SOURCE' and <fcnctl.h>.

$ git clone https://kernel.googlesource.com/pub/scm/fs/xfs/xfsprogs-dev
$ cd xfsprogs-dev/
$ git describe --contains 9d6023a856a1c4f84415dff59b0d5459cc8768db
v5.5.0-rc1~39

#if defined(FALLOC_FL_ZERO_RANGE)
static inline int
platform_zero_range(
int fd,
xfs_off_t start,
size_t len)

{
        int ret;

        ret = fallocate(fd, FALLOC_FL_ZERO_RANGE, start, len);
        if (!ret)
        return 0;
        return -errno;
}

#else
#define platform_zero_range(fd, s, l) (-EOPNOTSUPP) #endif

My test version is based on 6.5 so contains the inlined function to build.

# rpm -qf /usr/include/xfs/xqm.h
xfsprogs-devel-6.5.0-3.el10.x86_64
Quoted 5 lines

I know that some quotactl0[23].c define _GNU_SOURCE, but it's interesting that
this influence the header. Also, which RHEL (or whatever distro) version has
this problem?

The error occurred (with install xfsprogs-devel) during the configure script
checking struct fs_quota_statv. It failed to compile conftest.c and report such errors:

configure:5697: checking for struct fs_quota_statv configure:5697: gcc -c -g -O2 conftest.c >&5 In file included from /usr/include/xfs/xfs.h:9,

                 from /usr/include/xfs/xqm.h:9,
                 from conftest.c:138:
/usr/include/xfs/linux.h: In function 'platform_zero_range':
/usr/include/xfs/linux.h:188:15: error: implicit declaration of function
'fallocate' [-Wimplicit-function-declaration]
  188 |         ret = fallocate(fd, FALLOC_FL_ZERO_RANGE, start, len);
      |               ^~~~~~~~~

configure:5697: $? = 1

It similarly to the above quotactl07 patch fix, so adding '#define _GNU_SOURCE'
is actually for making the fallocate() happy.

Or, another way is the change made in "xfsprogs-dev/include/linux.h" otherwise we can't
configure our LTP correctly.

--
Regards,
Li Wang

Signature · 5 lines
Regards,
Li Wang

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
#5 lore raw
Quoted 1 line · Li Wang

cc Eric Sandeen <[email protected] <mailto:[email protected]>> who is the author of:

If adding _GNU_SOURCE to the LTP configure.ac fixes the problem, I have no concerns about that.

However, I also sent a patch to fix xfsprogs - having this wrapper in the header is really unnecessary, and will likely cause problems for others as well, so I just proposed removing it.

https://lore.kernel.org/linux-xfs/[email protected]/

(This problem only recently showed up due to other changes, see the explanation in the link above)

Thanks,
-Eric

Quoted 98 lines

commit 9d6023a856a1c4f84415dff59b0d5459cc8768db
Author: Eric Sandeen <[email protected] <mailto:[email protected]>>
Date:   Thu Feb 27 15:05:48 2020 -0500

    libxfs: use FALLOC_FL_ZERO_RANGE in libxfs_device_zero

On Wed, Jun 19, 2024 at 8:05 PM Li Wang <[email protected] <mailto:[email protected]>> wrote:

Hi Petr, XFS-Experts,

On Wed, Jun 19, 2024 at 5:27 PM Petr Vorel <[email protected] <mailto:[email protected]>> wrote:

Hi Li,

> These changes help ensure that the necessary features and definitions > are available during the configuration process, preventing potential > issues related to missing or incompatible definitions. This should > resolve the compilation error related to struct fs_quota_statv:

>  /usr/include/xfs/xqm.h:167:8: error: redefinition of ‘struct fs_qfilestatv’

I wonder how _GNU_SOURCE influences any XFS header? I haven't found anything in (<xfs/*.h>) or in <sys/quota.h>

With installing a newer xfsprogs-dev package on RHEL, we got a problem in configuring our LTP test.

According to the inclusion relationship: "xfs/xqm.h" -> "xfs/xfs.h" -> "xfs/linux.h". The linux.h header introduces an inlined function that needs '_GNU_SOURCE' and <fcnctl.h>.

$ git clone https://kernel.googlesource.com/pub/scm/fs/xfs/xfsprogs-dev <https://kernel.googlesource.com/pub/scm/fs/xfs/xfsprogs-dev>
$ cd xfsprogs-dev/
$ git describe --contains 9d6023a856a1c4f84415dff59b0d5459cc8768db
v5.5.0-rc1~39

#if defined(FALLOC_FL_ZERO_RANGE)
static inline int
platform_zero_range(
        int        fd,
        xfs_off_t        start,
        size_t        len)
{
        int ret;

        ret = fallocate(fd, FALLOC_FL_ZERO_RANGE, start, len); if (!ret)
        return 0;
        return -errno;
}
#else
#define platform_zero_range(fd, s, l) (-EOPNOTSUPP) #endif

My test version is based on 6.5 so contains the inlined function to build.

# rpm -qf /usr/include/xfs/xqm.h
xfsprogs-devel-6.5.0-3.el10.x86_64

I know that some quotactl0[23].c define _GNU_SOURCE, but it's interesting that this influence the header. Also, which RHEL (or whatever distro) version has this problem?

The error occurred (with install xfsprogs-devel) during the configure script checking struct fs_quota_statv. It failed to compile conftest.c and report such errors:

configure:5697: checking for struct fs_quota_statv
configure:5697: gcc -c -g -O2  conftest.c >&5
In file included from /usr/include/xfs/xfs.h:9,
                 from /usr/include/xfs/xqm.h:9,
                 from conftest.c:138:
/usr/include/xfs/linux.h: In function 'platform_zero_range':
/usr/include/xfs/linux.h:188:15: error: implicit declaration of function 'fallocate' [-Wimplicit-function-declaration] 188 |         ret = fallocate(fd, FALLOC_FL_ZERO_RANGE, start, len);
      |               ^~~~~~~~~
configure:5697: $? = 1

It similarly to the above quotactl07 patchfix, so adding '#define _GNU_SOURCE'
isactually formaking the fallocate()happy.

Or, another way is the change made in "xfsprogs-dev/include/linux.h" otherwise we can't configure our LTP correctly.

--
Regards,
Li Wang

Signature · 2 lines
Regards,
Li Wang
Reviewed-by
#6 lore raw
Quoted 9 lines · Li Wang
Quoted 1 line

cc Eric Sandeen <[email protected] <mailto:[email protected]>> who is the author of:

If adding _GNU_SOURCE to the LTP configure.ac fixes the problem, I have no concerns about that.

However, I also sent a patch to fix xfsprogs - having this wrapper in the header is really unnecessary, and will likely cause problems for others as well, so I just proposed removing it.

Interesting. OK, let's merge workaround.

Quoted 1 line

https://lore.kernel.org/linux-xfs/[email protected]/

Thanks for info! Your patch IMHO makes sense.

Kind regards,
Petr

Quoted 5 lines

(This problem only recently showed up due to other changes, see the explanation in the link above)

Thanks,
-Eric