From owner-cvs-sys Sat Oct 12 15:14:42 1996 Return-Path: owner-cvs-sys Received: (from root@localhost) by freefall.freebsd.org (8.7.5/8.7.3) id PAA03911 for cvs-sys-outgoing; Sat, 12 Oct 1996 15:14:42 -0700 (PDT) Received: (from bde@localhost) by freefall.freebsd.org (8.7.5/8.7.3) id PAA03800; Sat, 12 Oct 1996 15:12:55 -0700 (PDT) Date: Sat, 12 Oct 1996 15:12:55 -0700 (PDT) From: Bruce Evans Message-Id: <199610122212.PAA03800@freefall.freebsd.org> To: CVS-committers, cvs-all, cvs-sys Subject: cvs commit: src/sys/ufs/ffs fs.h Sender: owner-cvs-sys@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk bde 96/10/12 15:12:54 Modified: sys/ufs/ffs fs.h Log: Fixed lblktosize(). It overflowed at 2G. This bug only affected ufs_read() and ufs_write(). Found by: looking at warnings for comparing the result of lblktosize() (which is usually daddr_t = long) with file sizes (which are u_quad_t for ufs). File sizes should probably be off_t's to avoid warnings when the are compared with file offsets, so the fixed lblktosize() casts to off_t instead of u_quad_t. Added definition of smalllblksize(). It is the same as the old lblksize() and is more efficient for small block numbers on 32-bit machines. Use smalllblktosize() instead of its expansion in blksize() and dblksize(). This keeps the line length short and makes it more obvious that the shift can't overflow. Revision Changes Path 1.7 +7 -4 src/sys/ufs/ffs/fs.h