[PATCH 5 of 6] osutil: add a C function getting filesystem type

Jun Wu quark at fb.com
Wed Mar 22 12:15:08 EDT 2017


Excerpts from Yuya Nishihara's message of 2017-03-22 23:38:17 +0900:
> On Mon, 20 Mar 2017 17:04:38 -0700, Jun Wu wrote:
> > # HG changeset patch
> > # User Jun Wu <quark at fb.com>
> > # Date 1490052299 25200
> > #      Mon Mar 20 16:24:59 2017 -0700
> > # Node ID f710d54d1985975d7d37aa58e9d5740ebdcf5b7b
> > # Parent  8a3c7ac9923732e980a3660f0555c2e109ee93e0
> > # Available At https://bitbucket.org/quark-zju/hg-draft 
> > #              hg pull https://bitbucket.org/quark-zju/hg-draft  -r f710d54d1985
> > osutil: add a C function getting filesystem type
> 
> > +#ifdef EXT2_SUPER_MAGIC
> > +    if (buf.f_type == EXT2_SUPER_MAGIC)
> > +        return "ext2";
> > +#endif
> > +#ifdef EXT3_SUPER_MAGIC
> > +    if (buf.f_type == EXT3_SUPER_MAGIC)
> > +        return "ext3";
> > +#endif
> > +#ifdef EXT4_SUPER_MAGIC
> > +    if (buf.f_type == EXT4_SUPER_MAGIC)
> > +        return "ext4";
> > +#endif
> 
> Just FYI, my /home drive was reported as ext2 since ext[234] magics are
> identical.
> 
>               EXT2_SUPER_MAGIC      0xef53
>               EXT3_SUPER_MAGIC      0xef53
>               EXT4_SUPER_MAGIC      0xef53
> 
> Anyway, this series looks promising, thanks.

Yeah, I noticed that when I was using "switch" and the compiler reported
there are duplicated values.


More information about the Mercurial-devel mailing list