[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: how to query filesystem type?
From: |
Jim Meyering |
Subject: |
Re: how to query filesystem type? |
Date: |
Tue, 05 Jul 2011 22:54:47 +0200 |
Eric Blake wrote:
> [adding coreutils]
>
> On 07/05/2011 10:28 AM, Jim Edwards wrote:
>>> the 'stat -f /path/to/file_system' command can give you the
>>> information you want:
>>>
>>> % stat -c %T -f /
>>> ext2/ext3
>>>
>>>
>> Running this on /tmp/work/$USER on jaguarpf gives
>>
>> UNKNOWN (0xbd00bd0)
>
> Which version of coreutils? Is this still happening in the latest
> coreutils.git (in which case, this is a sign that coreutils needs to be
> taught a new magic number)?
>
>>> If you use the system call statfs(2) you can determine the fs type at
>>> runtime. Nowadays it's even reasonably (but not entirely) portable:
>>>
>>> struct statfs has a f_fsid member. The magic number for Lustre is "#define
>>> LL_SUPER_MAGIC 0x0BD00BD0" (defined in lustre_user.h). The magic number
stat -f support for Lustre file systems was added in 2008 (coreutils-7.1):
http://git.savannah.gnu.org/cgit/coreutils.git/commit/?id=a36f4cb451e9627
>>> GPFS is ... 0x47504653 I guess?
I see that GPFS_SUPER_MAGIC is the symbol name
http://publib.boulder.ibm.com/infocenter/clresctr/vxrx/topic/com.ibm.cluster.gpfs32.basicadm.doc/bl1adm_admxafg.html
and several sources confirm that value of 0x47504653
So I expect to add support for it with this:
>From 86d19b44a5357158359e06e5db99cf7608470956 Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Tue, 5 Jul 2011 22:49:56 +0200
Subject: [PATCH] stat: recognize GPFS as a file system type
* src/stat.c (human_fstype) [S_MAGIC_GPFS]: Add a case,
to handle GPFS_SUPER_MAGIC/0x47504653. Prompted by discussion
http://thread.gmane.org/gmane.comp.sysutils.autoconf.general/14007
* NEWS (Improvements): Mention it.
---
NEWS | 2 ++
src/stat.c | 2 ++
2 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/NEWS b/NEWS
index d58df26..f7e7823 100644
--- a/NEWS
+++ b/NEWS
@@ -37,6 +37,8 @@ GNU coreutils NEWS -*-
outline -*-
cp and ls now support HP-UX 11.11's ACLs, thanks to improved support
in gnulib.
+ stat -f now also recognizes the GPFS file system type.
+
** Build-related
Changes inherited from gnulib address a build failure on HP-UX 11.11
diff --git a/src/stat.c b/src/stat.c
index 273bb4b..ab235d4 100644
--- a/src/stat.c
+++ b/src/stat.c
@@ -289,6 +289,8 @@ human_fstype (STRUCT_STATVFS const *statfsbuf)
return "futexfs";
case S_MAGIC_GFS: /* 0x1161970 */
return "gfs/gfs2";
+ case S_MAGIC_GPFS: /* 0x47504653 */
+ return "gpfs";
case S_MAGIC_HFS: /* 0x4244 */
return "hfs";
case S_MAGIC_HPFS: /* 0xF995E849 */
--
1.7.6.370.gfeac5