From owner-freebsd-current@FreeBSD.ORG Wed Mar 10 11:16:50 2004 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id CA10316A4CE; Wed, 10 Mar 2004 11:16:50 -0800 (PST) Received: from mailout1.pacific.net.au (mailout1.pacific.net.au [61.8.0.84]) by mx1.FreeBSD.org (Postfix) with ESMTP id 1B7B243D62; Wed, 10 Mar 2004 11:16:47 -0800 (PST) (envelope-from bde@zeta.org.au) Received: from mailproxy2.pacific.net.au (mailproxy2.pacific.net.au [61.8.0.87])i2AJGjUe008983; Thu, 11 Mar 2004 06:16:45 +1100 Received: from gamplex.bde.org (katana.zip.com.au [61.8.7.246]) i2AJGhGg011156; Thu, 11 Mar 2004 06:16:44 +1100 Date: Thu, 11 Mar 2004 06:16:43 +1100 (EST) From: Bruce Evans X-X-Sender: bde@gamplex.bde.org To: John Baldwin In-Reply-To: <200403101309.32292.jhb@FreeBSD.org> Message-ID: <20040311054522.T2459@gamplex.bde.org> References: <7m7jxth70h.wl@black.imgsrc.co.jp> <200403101309.32292.jhb@FreeBSD.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII cc: Jun Kuriyama cc: freebsd-current@FreeBSD.org Subject: Re: Expand libdisk to use 64bit size/offset X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Mar 2004 19:16:50 -0000 On Wed, 10 Mar 2004, John Baldwin wrote: > On Tuesday 09 March 2004 07:37 pm, Jun Kuriyama wrote: > > I found sysinstall(8) cannot handle TB class storage. It looks > > both of libdisk and sysinstall should be fixed. > > > > I'm trying to improve this situation, but I'm not sure I'm going to > > the right direction. Please look this patch (including my debugging > > stuff and XXX comments which should be resolved/removed). This will probably need EFI, since DOS partitions are limited to 2^31 or 2^32 sectors and the sector size may be restricted to 512. > > http://www.imgsrc.co.jp/~kuriyama/BSD/libdisk-20040310.diff I didn't look closely. > > I choose daddr_t as larger storage for offset, size and end member of > > "struct chunk". I think offset and end is okay, but I don't know > > daddr_t for offset is correct or not. > > dadd_t is a uint32_t, so it won't help. Just use off_t for chunk > offset/size/end. Erm, daddr_t is (signed) int64_t. It is the correct type for storing counts of DEV_BSIZE'd blocks (DEV_BSIZE = 512), so it is correct for sector counts in libdisk to the extent that libdisk is limited to DEV_BSIZE'd sectors. Counts of blocks of other sizes should use a different typedef. E.g., ufs uses types ufs1_daddr_t (32-bit ufs1 block numbers), ufs2_daddr_t (64-bit ufs2 block numbers) and ufs_lbn_t (64-bit ufs logical block numbers). libdisk never uses DEV_BSIZE or even its own macro for the units. It hard-codes 512-all over :-(. So using daddr_t would not be logically correct but would be less worse than what libdisk already does. Using off_t for block counts is very bogus. off_t is for byte offsets. libdisk's "offset" is actually a block number, so it should have the same [foo_]daddr_t type as "size" and "end". Bruce