diff mbox series

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

Message ID 713c4e61358b95bbdf95daca094abc73a230e52f.1734253505.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. 15, 2024, 9:17 a.m. UTC
This avoids open coding the magic number

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

Comments

Christoph Hellwig Dec. 16, 2024, 8:28 a.m. UTC | #1
On Sun, Dec 15, 2024 at 02:47:15PM +0530, Ojaswin Mujoo wrote:
> -	return (statfsbuf.f_type == 0x58465342);	/* XFSB */
> +	return (statfsbuf.f_type == XFS_SUPER_MAGIC);

Might be worth dropping the superfluous braces here while you're at it.

Otherwise looks good:

Reviewed-by: Christoph Hellwig <hch@lst.de>
Ojaswin Mujoo Dec. 17, 2024, 5:39 a.m. UTC | #2
On Mon, Dec 16, 2024 at 12:28:00AM -0800, Christoph Hellwig wrote:
> On Sun, Dec 15, 2024 at 02:47:15PM +0530, Ojaswin Mujoo wrote:
> > -	return (statfsbuf.f_type == 0x58465342);	/* XFSB */
> > +	return (statfsbuf.f_type == XFS_SUPER_MAGIC);
> 
> Might be worth dropping the superfluous braces here while you're at it.

Thanks for the review Christoph, I will fix the braces here.

regards,
ojaswin
> 
> Otherwise looks good:
> 
> Reviewed-by: Christoph Hellwig <hch@lst.de>
>
diff mbox series

Patch

diff --git a/include/linux.h b/include/linux.h
index e9eb7bfb26a1..306a31e092a7 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)