From owner-freebsd-current Wed Nov 1 11:39:27 2000 Delivered-To: freebsd-current@freebsd.org Received: from critter.freebsd.dk (flutter.freebsd.dk [212.242.40.147]) by hub.freebsd.org (Postfix) with ESMTP id AD20637B4C5 for ; Wed, 1 Nov 2000 11:39:23 -0800 (PST) Received: from critter (localhost [127.0.0.1]) by critter.freebsd.dk (8.11.1/8.9.3) with ESMTP id eA1JZWu22498; Wed, 1 Nov 2000 20:35:32 +0100 (CET) (envelope-from phk@critter.freebsd.dk) To: Marcel Moolenaar Cc: Andrew Gallatin , freebsd-current@FreeBSD.ORG Subject: Re: linux emulation In-Reply-To: Your message of "Wed, 01 Nov 2000 14:31:10 EST." <3A006F7E.C31E2A85@cup.hp.com> Date: Wed, 01 Nov 2000 20:35:32 +0100 Message-ID: <22496.973107332@critter> From: Poul-Henning Kamp Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG In message <3A006F7E.C31E2A85@cup.hp.com>, Marcel Moolenaar writes: >Poul-Henning Kamp wrote: >> >> I was just looking at that piece of code, and I couldn't entirely >> make out what it was even trying to do. Can somebody more >> linuxolator savy explain what the function linux_ustat() should >> produce. > >The following comment explains what linux_ustat should do: > > /* > * lu.f_fname and lu.f_fpack are not used. They are always zeroed. > * lu.f_tinode and lu.f_tfree are set from the device's super block. > */ > >linux_ustat fills in a structure with the above mention fields. The >meaning of f_tinode and f_tfree are explained by the following two >statements: > > lu.f_tfree = stat->f_bfree; > lu.f_tinode = stat->f_ffree; > >In short: given the (u)dev_t, get the FS statistics and return the >number of free blocks and inodes of the FS on that device. But the udev_t is a (32bit truncated to) 16bit one, right ? In that case it will usually not work: crw-r----- 1 root operator 116, 0x00010002 1 Jan 1970 /dev/ad0 crw-r----- 1 root operator 116, 0x00020000 1 Jan 1970 /dev/ad0s1a crw-r----- 1 root operator 116, 0x00020001 1 Jan 1970 /dev/ad0s1b crw-r----- 1 root operator 116, 0x00020004 1 Jan 1970 /dev/ad0s1e crw-r----- 1 root operator 116, 0x00020005 1 Jan 1970 /dev/ad0s1f crw-r----- 1 root operator 116, 0x00030002 1 Jan 1970 /dev/ad0s2c crw-r----- 1 root operator 116, 0x00040000 1 Jan 1970 /dev/ad0s3a crw-r----- 1 root operator 116, 0x00040003 1 Jan 1970 /dev/ad0s3d Considering the fact that we were likely to return statistics for the wrong filesystem with the old code, and most likely cannot return the right statistics anyway, I think we should just return zero for those values (or some other more sensible values) -- Poul-Henning Kamp | UNIX since Zilog Zeus 3.20 phk@FreeBSD.ORG | TCP/IP since RFC 956 FreeBSD committer | BSD since 4.3-tahoe Never attribute to malice what can adequately be explained by incompetence. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message