Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 03 Jun 2001 02:43:10 -0700
From:      Peter Wemm <peter@wemm.org>
To:        Poul-Henning Kamp <phk@critter.freebsd.dk>
Cc:        John Polstra <jdp@polstra.com>, arch@FreeBSD.ORG, drosih@rpi.edu
Subject:   Re: time_t definition is wrong 
Message-ID:  <20010603094310.8CF75380C@overcee.netplex.com.au>
In-Reply-To: <45913.991557175@critter> 

next in thread | previous in thread | raw e-mail | index | archive | help
Poul-Henning Kamp wrote:
> In message <20010603082153.E17C3380C@overcee.netplex.com.au>, Peter Wemm writ
    es
> :
> 
> >One other thing.. ufs/* should probably have int32_t in the on-disk records
> >(eg: struct dquot) rather than time_t.
> 
> Somebody beat you to it, by a fair margin even:
> 
> 1.5 (dyson 10-Feb-97): int32_t di_atime;     /*  16: Last access time. */
> 1.5 (dyson 10-Feb-97): int32_t di_atimensec; /*  20: Last access time. */
> 1.5 (dyson 10-Feb-97): int32_t di_mtime;     /*  24: Last modified time. */
> 1.5 (dyson 10-Feb-97): int32_t di_mtimensec; /*  28: Last modified time. */
> 1.5 (dyson 10-Feb-97): int32_t di_ctime;     /*  32: Last inode change time. 
    */
> 1.5 (dyson 10-Feb-97): int32_t di_ctimensec; /*  36: Last inode change time. 
    */

No, there are more than this.  Dyson's change was to switch from timeval/
timespec to seperate fields.

/* on-disk superblock */
struct fs {
  time_t   fs_time;               /* last time written */
};
/* on disk cylinder group */
struct cg {
  time_t   cg_time;               /* time last written */
};
/* old fs on-disk cylinder group */
struct ocg {
  time_t   cg_time;               /* time last written */
};
/* on-disk quota record */
struct dqblk {
  time_t    dqb_btime;            /* time limit for excessive disk use */
  time_t    dqb_itime;            /* time limit for excessive files */
};

There is no padding here.  Any change to the size of time_t will change
the on-disk format.  These should be fixed.  I was thinking of creating
ufs_time_t or something for this purpose (along the lines of ufs_daddr_t).

There is one other obvious place that is affected:

/* in memory array copies of on-disk data */
struct ufsmount {
  ...
  time_t  um_btime[MAXQUOTAS];            /* block quota time limit */
  time_t  um_itime[MAXQUOTAS];            /* inode quota time limit */
};

This is a cached copy of the on-disk records.  It would be unfortunate to
lose precision doing copies.

> Most of the trouble here is printf.  What we need is to be able to
> say something like
> 
> 	printf"time= %{time_t}\n", time_second);

Heh.  Wouldn't that be nice. :-)

IMHO, RELENG_4 should not have changed time_t.  -current is the place
to experiment with this and to thrash out a workable solution.

Cheers,
-Peter
--
Peter Wemm - peter@FreeBSD.org; peter@yahoo-inc.com; peter@netplex.com.au
"All of this is for nothing if we don't go to the stars" - JMS/B5


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-arch" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20010603094310.8CF75380C>