Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 25 May 2000 16:08:06 +0200
From:      Christoph Sold <so@server.i-clue.de>
To:        Don Lewis <Don.Lewis@tsc.tdk.com>
Cc:        Arun Sharma <adsharma@sharmas.dhs.org>, Peter Jeremy <peter.jeremy@alcatel.com.au>, hackers@FreeBSD.ORG
Subject:   Re: file creation times ?
Message-ID:  <392D33C5.D8C19205@i-clue.de>
References:  <00May25.110340est.115250@border.alcanet.com.au> <20000524185859.A19573@sharmas.dhs.org> <200005250932.CAA20546@salsa.gv.tsc.tdk.com>

next in thread | previous in thread | raw e-mail | index | archive | help


Don Lewis wrote:

> On May 24,  6:58pm, Arun Sharma wrote:
> } Subject: Re: file creation times ?
> } On Thu, May 25, 2000 at 11:03:38AM +1000, Peter Jeremy wrote:
> } > To put it another way, why _should_ FreeBSD store a file creation time?
> }
> } 0. I'm tired of seeing people putting "Created: mm/dd/yy" in their documents.
>
> When saving a document to "file", many editors will do the equivalent of
>         save document to "file.new"
>         ln "file" "file.bak"
>         mv "file.new" "file"
> in order to minimize the possibility of losing the document if the editor
> or the system crashes at just the wrong time.  The result of this would
> be to set the file creation time to the time it was last saved.  This
> won't be very helpful if you are relying on the file creation time to
> tell you when the *document* was first created.

To answer the question who needs this: Apple Macintosh MFS filesystems (long died
since the MacPlus) introduced the file creation date, and it lives on since then in
Apples HFS and HFS+ Filesystems. I found the information handy when searching for
files.

[snippety]

> What should the semantics of the creation time be across a backup and
> restore?  Should the original creation time be restored, or should the
> creation time be the time when the restored copy of the file is written?
> What about just copying a file?  If I make an exact copy of a document,
> should the two copies have the same or differing creation times?

To solve these questions (along with the one shown above in code), Apple has a
"Swap File Info" call. This way,

read document;
save document to file.tmp;
[work on the document, saving to the tempfile as you whish]
[when the user say to save now:]
save document to file.tmp;
exchange file info records of file.tmp and document;
{optionally rename file.tmp to document.bak -- remember, file info was swapped
before}

Now everything else is easy: after a backup, the file creation time is the time the
file was originally created (not the restored copy's creation time). A copied file
is created when you copy it. Exact copies should have different creation times.
That's the way HFS does it -- other opinions welcome. I like it this way.

If somebody can dream up an implementation in FFS, I'd love to see it realized (and
have some good use for it, since I tend to remember when something started...).

Hope this clarifies the topic a little
-Christoph Sold



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




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