From owner-freebsd-hackers@freebsd.org Mon Feb 19 22:03:23 2018 Return-Path: Delivered-To: freebsd-hackers@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9CECDF02A8E for ; Mon, 19 Feb 2018 22:03:23 +0000 (UTC) (envelope-from wjw@digiware.nl) Received: from smtp.digiware.nl (smtp.digiware.nl [176.74.240.9]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3A82F6E389; Mon, 19 Feb 2018 22:03:22 +0000 (UTC) (envelope-from wjw@digiware.nl) Received: from router.digiware.nl (localhost.digiware.nl [127.0.0.1]) by smtp.digiware.nl (Postfix) with ESMTP id B71B52E3FA; Mon, 19 Feb 2018 23:03:21 +0100 (CET) X-Virus-Scanned: amavisd-new at digiware.com Received: from smtp.digiware.nl ([127.0.0.1]) by router.digiware.nl (router.digiware.nl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id DyQfhJofetsy; Mon, 19 Feb 2018 23:03:21 +0100 (CET) Received: from [192.168.10.67] (opteron [192.168.10.67]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.digiware.nl (Postfix) with ESMTPSA id 338342E3F9; Mon, 19 Feb 2018 23:03:21 +0100 (CET) Subject: Re: Using fstatfs on a ZFS disk To: Andriy Gapon , "Rodney W. Grimes" , rb@gid.co.uk Cc: FreeBSD Hackers References: <456B0CAA-367F-478A-BB61-153942C3EB7A@gid.co.uk> <201802191833.w1JIXhVL078022@pdx.rh.CN85.dnsmgr.net> <45bd4a05-406b-d6ac-6679-6897ab1fc742@FreeBSD.org> From: Willem Jan Withagen Message-ID: <8134dba0-fdae-0109-4bae-3441d750566d@digiware.nl> Date: Mon, 19 Feb 2018 23:03:19 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <45bd4a05-406b-d6ac-6679-6897ab1fc742@FreeBSD.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Feb 2018 22:03:23 -0000 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 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__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