s3: add st_ex_file_id to struct stat_ex
authorRalph Boehme <slow@samba.org>
Thu, 27 Jun 2019 16:17:20 +0000 (18:17 +0200)
committerJeremy Allison <jra@samba.org>
Mon, 1 Jul 2019 21:43:23 +0000 (21:43 +0000)
st_ex_file_id is an immutable, never reused numeric identifier for objects in a
filesystem.

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 5a9150fe2fedafa0f28867bb8c103236ae881085..abe12ac0930c651f02164d7cdfa13425b6598b3e 100644 (file)
@@ -193,6 +193,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)
+#define ST_EX_IFLAG_CALCULATED_FILE_ID         (1 << 2)
 
 /*
  * Type for stat structure.
@@ -201,6 +202,7 @@ typedef uint64_t br_off;
 struct stat_ex {
        dev_t           st_ex_dev;
        ino_t           st_ex_ino;
+       uint64_t        st_ex_file_id;
        mode_t          st_ex_mode;
        nlink_t         st_ex_nlink;
        uid_t           st_ex_uid;
index 17cbf32ec194f2b396591a639c094ea8d624bb27..33c54c884cd1bffc6d3facdc870a46f91be15c1a 100644 (file)
 /* 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 */
+/* Version 41 - add st_ex_file_id to struct stat_ex */
 
 #define SMB_VFS_INTERFACE_VERSION 41
 
index 104d1abc1f26b7a87658605027f346cdcb0e9090..486a775c8c3ff2500f96275ea54d30ef1e2e389a 100644 (file)
@@ -376,6 +376,8 @@ void init_stat_ex_from_stat (struct stat_ex *dst,
 #else
        dst->st_ex_flags = 0;
 #endif
+       dst->st_ex_file_id = dst->st_ex_ino;
+       dst->st_ex_iflags |= ST_EX_IFLAG_CALCULATED_FILE_ID;
 }
 
 /*******************************************************************
index 2f49ca24a18dc415a2cdcbb0cc27db6865d6a1c4..1b293ddb1b0af3bea0662e2d78c17c297e674f45 100644 (file)
@@ -708,6 +708,8 @@ static void init_stat_ex_from_ceph_statx(struct stat_ex *dst, const struct ceph_
        dst->st_ex_iflags = ST_EX_IFLAG_CALCULATED_ITIME;
        dst->st_ex_blksize = stx->stx_blksize;
        dst->st_ex_blocks = stx->stx_blocks;
+       dst->st_ex_file_id = dst->st_ex_ino;
+       dst->st_ex_iflags |= ST_EX_IFLAG_CALCULATED_FILE_ID;
 }
 
 static int cephwrap_stat(struct vfs_handle_struct *handle,