From a770caed0ff66ddc2d63ac83d20f4cd7fcc2caf5 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Tue, 17 Nov 2009 14:55:02 -0800 Subject: Remove "store create time" code, cause create time to be stored in the "user.DOSATTRIB" EA. From the docs: In Samba 3.5.0 and above the "user.DOSATTRIB" extended attribute has been extended to store the create time for a file as well as the DOS attributes. This is done in a backwards compatible way so files created by Samba 3.5.0 and above can still have the DOS attribute read from this extended attribute by earlier versions of Samba, but they will not be able to read the create time stored there. Storing the create time separately from the normal filesystem meta-data allows Samba to faithfully reproduce NTFS semantics on top of a POSIX filesystem. Passes make test but will need more testing. Jeremy. --- source3/lib/system.c | 7 +++++++ source3/lib/time.c | 27 +++++++++++++++++++++++++++ 2 files changed, 34 insertions(+) (limited to 'source3/lib') diff --git a/source3/lib/system.c b/source3/lib/system.c index 4331691746..8abcb3dc66 100644 --- a/source3/lib/system.c +++ b/source3/lib/system.c @@ -504,6 +504,13 @@ void update_stat_ex_mtime(struct stat_ex *dst, } } +void update_stat_ex_create_time(struct stat_ex *dst, + struct timespec create_time) +{ + dst->st_ex_btime = create_time; + dst->st_ex_calculated_birthtime = false; +} + static void init_stat_ex_from_stat (struct stat_ex *dst, const struct stat *src) { diff --git a/source3/lib/time.c b/source3/lib/time.c index f6ff6d3407..1d2fae3d17 100644 --- a/source3/lib/time.c +++ b/source3/lib/time.c @@ -680,6 +680,33 @@ void unix_timespec_to_nt_time(NTTIME *nt, struct timespec ts) *nt = d; } +#if 0 +void nt_time_to_unix_timespec(struct timespec *ts, NTTIME t) +{ + if (ts == NULL) { + return; + } + + /* t starts in 100 nsec units since 1601-01-01. */ + + t *= 100; + /* t is now in nsec units since 1601-01-01. */ + + t -= TIME_FIXUP_CONSTANT*1000*1000*100; + /* t is now in nsec units since the UNIX epoch 1970-01-01. */ + + ts->tv_sec = t / 1000000000LL; + + if (TIME_T_MIN > ts->tv_sec || ts->tv_sec > TIME_T_MAX) { + ts->tv_sec = 0; + ts->tv_nsec = 0; + return; + } + + ts->tv_nsec = t - ts->tv_sec*1000000000LL; +} +#endif + /**************************************************************************** Convert a time_t to a NTTIME structure -- cgit