From 30b7f9ae2df26d2f0fc84b30e86fc4639da3972a Mon Sep 17 00:00:00 2001 From: Ralph Boehme Date: Thu, 27 Jun 2019 18:17:20 +0200 Subject: [PATCH] s3: add st_ex_file_id to struct stat_ex st_ex_file_id is an immutable, never reused numeric identifier for objects in a filesystem. Signed-off-by: Ralph Boehme Reviewed-by: Jeremy Allison --- source3/include/includes.h | 2 ++ source3/include/vfs.h | 1 + source3/lib/system.c | 2 ++ source3/modules/vfs_ceph.c | 2 ++ 4 files changed, 7 insertions(+) diff --git a/source3/include/includes.h b/source3/include/includes.h index 5a9150fe2fe..abe12ac0930 100644 --- a/source3/include/includes.h +++ b/source3/include/includes.h @@ -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; diff --git a/source3/include/vfs.h b/source3/include/vfs.h index 17cbf32ec19..33c54c884cd 100644 --- a/source3/include/vfs.h +++ b/source3/include/vfs.h @@ -264,6 +264,7 @@ /* 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 diff --git a/source3/lib/system.c b/source3/lib/system.c index 104d1abc1f2..486a775c8c3 100644 --- a/source3/lib/system.c +++ b/source3/lib/system.c @@ -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; } /******************************************************************* diff --git a/source3/modules/vfs_ceph.c b/source3/modules/vfs_ceph.c index 2f49ca24a18..1b293ddb1b0 100644 --- a/source3/modules/vfs_ceph.c +++ b/source3/modules/vfs_ceph.c @@ -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, -- 2.47.3