statfs: detect more filesystems on Linux
authorJun Wu <quark@fb.com>
Sat, 25 Mar 2017 12:58:55 -0700
changeset 31627 814733e4c02a
parent 31626 0febf8e4e2ce
child 31628 e86eb75e74ce
statfs: detect more filesystems on Linux Previously, the code only has what manpager says. In <linux/magic.h>, there are more defined. This patch adds filesystems that appear in the current Arch Linux's /proc/filesystems (autofs, overlay, securityfs) and f2fs, which was seen in news.
mercurial/osutil.c
--- a/mercurial/osutil.c	Thu Mar 23 23:47:23 2017 -0400
+++ b/mercurial/osutil.c	Sat Mar 25 12:58:55 2017 -0700
@@ -815,6 +815,10 @@
 	if (pbuf->f_type == AFFS_SUPER_MAGIC)
 		return "affs";
 #endif
+#ifdef AUTOFS_SUPER_MAGIC
+	if (pbuf->f_type == AUTOFS_SUPER_MAGIC)
+		return "autofs";
+#endif
 #ifdef BDEVFS_MAGIC
 	if (pbuf->f_type == BDEVFS_MAGIC)
 		return "bdevfs";
@@ -895,6 +899,10 @@
 	if (pbuf->f_type == EXT4_SUPER_MAGIC)
 		return "ext4";
 #endif
+#ifdef F2FS_SUPER_MAGIC
+	if (pbuf->f_type == F2FS_SUPER_MAGIC)
+		return "f2fs";
+#endif
 #ifdef FUSE_SUPER_MAGIC
 	if (pbuf->f_type == FUSE_SUPER_MAGIC)
 		return "fuse";
@@ -975,6 +983,10 @@
 	if (pbuf->f_type == OPENPROM_SUPER_MAGIC)
 		return "openprom";
 #endif
+#ifdef OVERLAYFS_SUPER_MAGIC
+	if (pbuf->f_type == OVERLAYFS_SUPER_MAGIC)
+		return "overlay";
+#endif
 #ifdef PIPEFS_MAGIC
 	if (pbuf->f_type == PIPEFS_MAGIC)
 		return "pipefs";
@@ -1007,6 +1019,10 @@
 	if (pbuf->f_type == ROMFS_MAGIC)
 		return "romfs";
 #endif
+#ifdef SECURITYFS_MAGIC
+	if (pbuf->f_type == SECURITYFS_MAGIC)
+		return "securityfs";
+#endif
 #ifdef SELINUX_MAGIC
 	if (pbuf->f_type == SELINUX_MAGIC)
 		return "selinux";