]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3: add st_ex_itime to struct stat_ex
authorRalph Boehme <slow@samba.org>
Thu, 27 Jun 2019 16:14:43 +0000 (18:14 +0200)
committerJeremy Allison <jra@samba.org>
Mon, 1 Jul 2019 21:43:23 +0000 (21:43 +0000)
st_ex_itime is an immutable original birth time aka instantiation time. Set when
a file is created, never changes thereafter. May not be set by the client.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/include/includes.h
source3/include/vfs.h
source3/lib/system.c
source3/modules/vfs_ceph.c

index ec486be6efaaf3c8f91d224e37aa377d131ba01c..5a9150fe2fedafa0f28867bb8c103236ae881085 100644 (file)
@@ -192,6 +192,7 @@ typedef uint64_t br_off;
 
 /* Is birthtime real, or was it calculated ? */
 #define ST_EX_IFLAG_CALCULATED_BTIME           (1 << 0)
+#define ST_EX_IFLAG_CALCULATED_ITIME           (1 << 1)
 
 /*
  * Type for stat structure.
@@ -210,6 +211,11 @@ struct stat_ex {
        struct timespec st_ex_mtime;
        struct timespec st_ex_ctime;
        struct timespec st_ex_btime; /* birthtime */
+       /*
+        * Immutable original birth time aka instantiation time. Set when a file
+        * is created, never changes thereafter. May not be set by the client.
+        */
+       struct timespec st_ex_itime; /* instantiation time */
 
        blksize_t       st_ex_blksize;
        blkcnt_t        st_ex_blocks;
index ecac793b93df773760162e183d2f8e438a62d244..17cbf32ec194f2b396591a639c094ea8d624bb27 100644 (file)
 /* Version 41 - Remove SMB_VFS_BRL_CANCEL_WINDOWS */
 /* Version 41 - Remove unused st_ex_mask from struct stat_ex */
 /* Version 41 - convert struct stat_ex.st_ex_calculated_birthtime to flags */
+/* Version 41 - add st_ex_itime to struct stat_ex */
 
 #define SMB_VFS_INTERFACE_VERSION 41
 
index 4bfe3785118667c8064f08eaae2012850017522f..104d1abc1f26b7a87658605027f346cdcb0e9090 100644 (file)
@@ -313,6 +313,9 @@ static void make_create_timespec(const struct stat *pst, struct stat_ex *dst,
                dst->st_ex_btime = calc_create_time_stat(pst);
                dst->st_ex_iflags |= ST_EX_IFLAG_CALCULATED_BTIME;
        }
+
+       dst->st_ex_itime = dst->st_ex_btime;
+       dst->st_ex_iflags |= ST_EX_IFLAG_CALCULATED_ITIME;
 }
 
 /****************************************************************************
index e3e9bb65b0732ae5c0e6b00ab4dabf573f26adc9..2f49ca24a18dc415a2cdcbb0cc27db6865d6a1c4 100644 (file)
@@ -704,7 +704,8 @@ static void init_stat_ex_from_ceph_statx(struct stat_ex *dst, const struct ceph_
        dst->st_ex_btime = stx->stx_btime;
        dst->st_ex_ctime = stx->stx_ctime;
        dst->st_ex_mtime = stx->stx_mtime;
-       dst->st_ex_iflags = 0;
+       dst->st_ex_itime = dst->st_ex_btime;
+       dst->st_ex_iflags = ST_EX_IFLAG_CALCULATED_ITIME;
        dst->st_ex_blksize = stx->stx_blksize;
        dst->st_ex_blocks = stx->stx_blocks;
 }