git: ufs - Expand time_t support to 48 bits

Matthew Dillon dillon at crater.dragonflybsd.org
Sun Mar 10 23:06:19 PDT 2019


commit 712774a1b49e723b345fb8c6d80aa8957950d443
Author: Matthew Dillon <dillon at apollo.backplane.com>
Date:   Sun Mar 10 22:46:39 2019 -0700

    ufs - Expand time_t support to 48 bits
    
    * Fix time overflow issues in the original 32-bit UFS code in two
      ways.  First, treat the original 32-bit seconds fields as unsigned.
      Second, utilize the spare fields to expand these fields to 48 bits
      each.  Retain the nanosecond-grain accuracy of the nsec fields.
    
      These changes should be both forwards and backwards compatible within
      the respective supported timestamp ranges for filesystems created by
      DragonFlyBSD and for legacy UFS1 systems.
    
      However, DFly will no longer be compatible with any modern UFS1
      implementation in other operating systems which reuse the spare fields
      for other purposes.
    
      Also, dump and restore are still limited to 32-bit time stamps.  This
      should not be an issue since these utilities are basically no longer used
      in modern day.  UFS1 is still useful, but deprecated, and we don't really
      intend for it to be used with later incarnations that might still be in
      use by other OSes.  We do want to make sure that the time fields work
      properly, however, as UFS1 is still useful for certain things.
    
    * The original di_atime, di_mtime, and di_ctime fields were implemented
      as signed 32 bit fields.  Change these to unsigned, extending time_t
      support from 2036 into the 2100 range.
    
    * In addition, use the spare fields in the dinode to provide another
      16 bits to each of atime, mtime, and ctime, expanding the time fields
      to 48 bits (around 9 million years).
    
    Noticed-by: aly

Summary of changes:
 sys/vfs/ufs/dinode.h    | 24 +++++++++++++++---------
 sys/vfs/ufs/inode.h     |  3 +++
 sys/vfs/ufs/ufs_vnops.c | 32 +++++++++++++++++++++-----------
 3 files changed, 39 insertions(+), 20 deletions(-)

http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/712774a1b49e723b345fb8c6d80aa8957950d443


-- 
DragonFly BSD source repository


More information about the Commits mailing list