From owner-freebsd-arch@FreeBSD.ORG Wed Nov 5 22:45:32 2003 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 7C4A516A4CE; Wed, 5 Nov 2003 22:45:32 -0800 (PST) Received: from smtp01.syd.iprimus.net.au (smtp01.syd.iprimus.net.au [210.50.30.52]) by mx1.FreeBSD.org (Postfix) with ESMTP id C721D43FAF; Wed, 5 Nov 2003 22:45:31 -0800 (PST) (envelope-from tim@robbins.dropbear.id.au) Received: from robbins.dropbear.id.au (210.50.203.152) by smtp01.syd.iprimus.net.au (7.0.020) id 3F8B009E00917232; Thu, 6 Nov 2003 17:45:30 +1100 Received: by robbins.dropbear.id.au (Postfix, from userid 1000) id 20B6160FD; Thu, 6 Nov 2003 17:45:29 +1100 (EST) Date: Thu, 6 Nov 2003 17:45:28 +1100 From: Tim Robbins To: Kirk McKusick Message-ID: <20031106064528.GA1440@wombat.robbins.dropbear.id.au> References: <200311060504.hA654feN034044@beastie.mckusick.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200311060504.hA654feN034044@beastie.mckusick.com> User-Agent: Mutt/1.4.1i cc: Robert Watson cc: arch@freebsd.org cc: Peter Wemm Subject: Re: >0x7fffffff blocksize filesystem reporting X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Nov 2003 06:45:32 -0000 On Wed, Nov 05, 2003 at 09:04:41PM -0800, Kirk McKusick wrote: > + /* > + * Convert a new format statfs structure to an old format statfs structure. > + */ > + static void > + cvtstatfs(td, nsp, osp) > + struct thread *td; > + struct statfs *nsp; > + struct ostatfs *osp; > + { > + > + bzero(osp, sizeof(*osp)); > + osp->f_bsize = nsp->f_bsize; > + osp->f_iosize = nsp->f_iosize; > + osp->f_blocks = nsp->f_blocks; > + osp->f_bfree = nsp->f_bfree; > + osp->f_bavail = nsp->f_bavail; > + osp->f_files = nsp->f_files; > + osp->f_ffree = nsp->f_ffree; > + osp->f_owner = nsp->f_owner; > + osp->f_type = nsp->f_type; > + osp->f_flags = nsp->f_flags; > + osp->f_syncwrites = nsp->f_syncwrites; > + osp->f_asyncwrites = nsp->f_asyncwrites; > + osp->f_syncreads = nsp->f_syncreads; > + osp->f_asyncreads = nsp->f_asyncreads; It may be better to return LONG_MAX for some of these members than to truncate the value. Alternatively, the block size could be adjusted to ensure that f_blocks fits in a "long" even though f_blocks * f_bsize may overflow it, but this is messy and can't help if f_files or f_{sync,async}{reads,writes} are too big. > + bcopy(nsp->f_fstypename, osp->f_fstypename, MFSNAMELEN); > + bcopy(nsp->f_mntonname, osp->f_mntonname, MNAMELEN); > + bcopy(nsp->f_mntfromname, osp->f_mntfromname, MNAMELEN); On architectures where longs are not 32 bits (amd64), OMNAMELEN != MNAMELEN, so this may do the wrong thing. Tim