diff mbox series

[v2,1/3] include/linux.h: use linux/magic.h to get XFS_SUPER_MAGIC

Message ID 66f4220d2c2da6ce143114f9635ed8cd4e54af1d.1734611784.git.ojaswin@linux.ibm.com (mailing list archive)
State New
Headers show
Series xfs_io: enable extsize and stat -v support for ext4 | expand

Commit Message

Ojaswin Mujoo Dec. 19, 2024, 12:39 p.m. UTC
This avoids open coding the magic number

Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Ojaswin Mujoo <ojaswin@linux.ibm.com>
---
 include/linux.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Darrick J. Wong Dec. 19, 2024, 3:55 p.m. UTC | #1
On Thu, Dec 19, 2024 at 06:09:13PM +0530, Ojaswin Mujoo wrote:
> This avoids open coding the magic number
> 
> Reviewed-by: Christoph Hellwig <hch@lst.de>
> Signed-off-by: Ojaswin Mujoo <ojaswin@linux.ibm.com>

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

--D

> ---
>  include/linux.h | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/include/linux.h b/include/linux.h
> index e9eb7bfb26a1..b3516d54c51b 100644
> --- a/include/linux.h
> +++ b/include/linux.h
> @@ -37,6 +37,7 @@
>  #endif
>  #include <unistd.h>
>  #include <assert.h>
> +#include <linux/magic.h> /* super block magic numbers */
>  
>  static __inline__ int xfsctl(const char *path, int fd, int cmd, void *p)
>  {
> @@ -60,7 +61,7 @@ static __inline__ int platform_test_xfs_fd(int fd)
>  		return 0;
>  	if (!S_ISREG(statbuf.st_mode) && !S_ISDIR(statbuf.st_mode))
>  		return 0;
> -	return (statfsbuf.f_type == 0x58465342);	/* XFSB */
> +	return statfsbuf.f_type == XFS_SUPER_MAGIC;
>  }
>  
>  static __inline__ int platform_test_xfs_path(const char *path)
> -- 
> 2.43.5
> 
>
diff mbox series

Patch

diff --git a/include/linux.h b/include/linux.h
index e9eb7bfb26a1..b3516d54c51b 100644
--- a/include/linux.h
+++ b/include/linux.h
@@ -37,6 +37,7 @@ 
 #endif
 #include <unistd.h>
 #include <assert.h>
+#include <linux/magic.h> /* super block magic numbers */
 
 static __inline__ int xfsctl(const char *path, int fd, int cmd, void *p)
 {
@@ -60,7 +61,7 @@  static __inline__ int platform_test_xfs_fd(int fd)
 		return 0;
 	if (!S_ISREG(statbuf.st_mode) && !S_ISDIR(statbuf.st_mode))
 		return 0;
-	return (statfsbuf.f_type == 0x58465342);	/* XFSB */
+	return statfsbuf.f_type == XFS_SUPER_MAGIC;
 }
 
 static __inline__ int platform_test_xfs_path(const char *path)