From owner-freebsd-hackers Tue Aug 18 17:55:31 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id RAA14639 for freebsd-hackers-outgoing; Tue, 18 Aug 1998 17:55:31 -0700 (PDT) (envelope-from owner-freebsd-hackers@FreeBSD.ORG) Received: from alcanet.com.au (border.alcanet.com.au [203.62.196.10]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id RAA14618 for ; Tue, 18 Aug 1998 17:55:21 -0700 (PDT) (envelope-from peter.jeremy@auss2.alcatel.com.au) Received: by border.alcanet.com.au id <40322>; Wed, 19 Aug 1998 10:54:12 +1000 Date: Wed, 19 Aug 1998 10:54:27 +1000 From: Peter Jeremy Subject: Re: proposal to not change time_t To: hackers@FreeBSD.ORG Message-Id: <98Aug19.105412est.40322@border.alcanet.com.au> Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On Tue, 18 Aug 1998 14:52:17 -0500 (CDT), Jim Bryant wrote: >what i would like to propose here is to create alternate, look-alike >functions. Note that time() is not a system call, it's a library function calling gettimeofday(2). And struct timeval (which gettimeofday() uses) uses longs rather than time_t. (I don't have a -current handy, so I'm not quite sure how the transition from struct timeval to struct timespec is handled). Overall, I don't believe that creating a new interface using a new q_time_t is warranted. BSD managed to change off_t from 32-bits to 64-bits without breaking everything. It should be possible to similarly change time_t. On Tue, 18 Aug 1998 20:40:15 +0000 (GMT), Terry Lambert wrote: >How do you propose to deal with the fact that the file timestamp >for FFS is a 32 bit value, and the spare fields that were intended >to be used to resolve the 2039 bug have been stolen to store >nanoseconds? One solution would be to add a creation time to the superblock (I think struct fs has still got free space) and then just store offsets from that creation time in the disk inodes (which are the critical structure, size-wise). The times in struct stat would be the sum of the fs_creat time and the relevant times in the disk inode. Whether struct inode contains a 32-bit or 64-bit seconds counter would depend on the relative efficiency/convenience of inode <-> dinode mapping vs inode time updating (and stat()ing). If the unused parts of the superblock are zero-filled, existing filesystems won't need updating immediately to be compatible with the changed definition. Storing the creation time as seconds only would mean that you don't need to add/subtract the tv_nsec fields (which is particularly messy because it wraps at an inconvenient 0x3b9aca00). This approach does mean that a filesystem won't last more than 69 years, but that seems adequate. A timestamp update tool would be trivial to write, but will need exclusive access to a partition for the time to read/write all the inodes (about the same as an fsck takes now). For a somewhat higher cost (and with kernel assistance), it should be possible to build a tool that can update the `fs_creat' and all associated inode timestamps for an active filesystem. Alternatively, do we really need nsec timestamps in inodes? We could store a 64-bit seconds timestamp in the inode and have SYS_stat() map it to a struct timespec with a zero tv_nsec. (Less convenient options which address the make's difficulties in chronologically ordering rapidly created files would be to use a 64-bit fixed-point number with 8, 16 or even 24 fractional bits). Peter == Peter Jeremy (VK2PJ) peter.jeremy@alcatel.com.au Alcatel Australia Limited 41 Mandible St Phone: +61 2 9690 5019 ALEXANDRIA NSW 2015 Fax: +61 2 9690 5247 To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message