Using fstatfs on a ZFS disk

Willem Jan Withagen wjw at digiware.nl
Mon Feb 19 22:03:23 UTC 2018


On 19-2-2018 22:20, Andriy Gapon wrote:
> On 19/02/2018 20:33, Rodney W. Grimes wrote:
>>> Hi,
>>>
>>>> On 19 Feb 2018, at 15:50, Willem Jan Withagen <wjw at digiware.nl> wrote:
> 
>>>> Now 0xde != 27, so the question is, where is this 0xde specified.
>>>> And more important is this f_type constant over all FreeBSD ZFS filesystems?
>>>
>>> You got me. And a quick look at sys/kern/vfs_syscalls.c doesn?t help except to imply that the type is set when the filesystem is mounted. I have no idea where 0xde comes from.
>>
>> Could that 0xde be the start of 0xdeadcode?
>>
>> 0xde is 222 decimal, that does not ring a bell for me either.
> 
> This is simpler, I think.
> It is a hash value (calculated using a specific algorithm) of a filesystem type
> name.  See vfs_register().

Right in vfs_init.c

> There are no magic predefined constants for the types.

It is a bit of work doing the hashes, but there could very well be 
pre-calculated FS_<fs>_TYPE defines.

See my other post.

> BTW, lsvfs(1) and its source code could be of interest to the original poster.
> E.g., getvfsbyname(3).

lsvfs output could even be used to generate part of the ENUM list.

--WjW




More information about the freebsd-hackers mailing list