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

Yuya Nishihara yuya at tcha.org
Wed Mar 22 10:38:17 EDT 2017


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.


More information about the Mercurial-devel mailing list