diff mbox series

xfs_io: Avoid using __kernel_rwf_t for older kernels

Message ID 20241125222618.1276708-1-florian.fainelli@broadcom.com (mailing list archive)
State New
Headers show
Series xfs_io: Avoid using __kernel_rwf_t for older kernels | expand

Commit Message

Florian Fainelli Nov. 25, 2024, 10:26 p.m. UTC
__kernel_rwf_t was defined with upstream Linux commit
ddef7ed2b5cbafae692d1d580bb5a07808926a9c ("annotate RWF_... flags")
which has been included in Linux v4.14 and newer. When building xfsprogs
against older kernel headers, this type is not defined, leading to the
following build error:

pwrite.c: In function 'pwrite_f':
../include/xfs/linux.h:236:22: error: '__kernel_rwf_t' undeclared (first use in this function); did you mean '__kernel_off_t'?
 #define RWF_ATOMIC ((__kernel_rwf_t)0x00000040)
                      ^~~~~~~~~~~~~~
pwrite.c:329:22: note: in expansion of macro 'RWF_ATOMIC'
    pwritev2_flags |= RWF_ATOMIC;

Fixes: ee6c5941352a ("xfs_io: add RWF_ATOMIC support to pwrite")
Signed-off-by: Florian Fainelli <florian.fainelli@broadcom.com>
---
 include/linux.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Darrick J. Wong Nov. 26, 2024, 1:22 a.m. UTC | #1
On Mon, Nov 25, 2024 at 02:26:18PM -0800, Florian Fainelli wrote:
> __kernel_rwf_t was defined with upstream Linux commit
> ddef7ed2b5cbafae692d1d580bb5a07808926a9c ("annotate RWF_... flags")
> which has been included in Linux v4.14 and newer. When building xfsprogs

/methinks you should upgrade your kernel, 4.14 is quite dead now, and
you're not even running something /that/ new.

> against older kernel headers, this type is not defined, leading to the
> following build error:
> 
> pwrite.c: In function 'pwrite_f':
> ../include/xfs/linux.h:236:22: error: '__kernel_rwf_t' undeclared (first use in this function); did you mean '__kernel_off_t'?
>  #define RWF_ATOMIC ((__kernel_rwf_t)0x00000040)
>                       ^~~~~~~~~~~~~~
> pwrite.c:329:22: note: in expansion of macro 'RWF_ATOMIC'
>     pwritev2_flags |= RWF_ATOMIC;
> 
> Fixes: ee6c5941352a ("xfs_io: add RWF_ATOMIC support to pwrite")
> Signed-off-by: Florian Fainelli <florian.fainelli@broadcom.com>

That said, if this doesn't break anything with a ~2020s distro then I
don't have any objections to this, so:

Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>

--D

> ---
>  include/linux.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/include/linux.h b/include/linux.h
> index e9eb7bfb26a1..68b43393aad7 100644
> --- a/include/linux.h
> +++ b/include/linux.h
> @@ -233,7 +233,7 @@ struct fsxattr {
>  
>  /* Atomic Write */
>  #ifndef RWF_ATOMIC
> -#define RWF_ATOMIC	((__kernel_rwf_t)0x00000040)
> +#define RWF_ATOMIC	(0x00000040)
>  #endif
>  
>  /*
> -- 
> 2.34.1
> 
>
diff mbox series

Patch

diff --git a/include/linux.h b/include/linux.h
index e9eb7bfb26a1..68b43393aad7 100644
--- a/include/linux.h
+++ b/include/linux.h
@@ -233,7 +233,7 @@  struct fsxattr {
 
 /* Atomic Write */
 #ifndef RWF_ATOMIC
-#define RWF_ATOMIC	((__kernel_rwf_t)0x00000040)
+#define RWF_ATOMIC	(0x00000040)
 #endif
 
 /*