id->extid = IVAL(buf, 16);
id->extid |= ((uint64_t)IVAL(buf,20))<<32;
}
+
+uint64_t make_file_id_from_itime(SMB_STRUCT_STAT *st)
+{
+ struct timespec itime = st->st_ex_itime;
+ ino_t ino = st->st_ex_ino;
+ uint64_t file_id_low;
+ uint64_t file_id;
+
+ if (st->st_ex_iflags & ST_EX_IFLAG_CALCULATED_ITIME) {
+ return ino;
+ }
+
+ file_id_low = itime.tv_nsec;
+ if (file_id_low == 0) {
+ /*
+ * This could be by coincidence, but more likely the filesystem
+ * is only giving us seconds granularity. We need more fine
+ * grained granularity for the File-ID, so combine with the
+ * inode number.
+ */
+ file_id_low = ino & ((1 << 30) - 1);
+ }
+
+ /*
+ * Set the high bit so ideally File-IDs based on inode numbers and
+ * File-IDs based on Birth Time use disjoint ranges, given inodes never
+ * have the high bit set.
+ */
+ file_id = ((uint64_t)1) << 63;
+ file_id |= (uint64_t)itime.tv_sec << 30;
+ file_id |= file_id_low;
+
+ return file_id;
+}
void push_file_id_16(char *buf, const struct file_id *id);
void push_file_id_24(char *buf, const struct file_id *id);
void pull_file_id_24(const char *buf, struct file_id *id);
+
+/*
+ * Make a SMB File-ID from itime
+ */
+uint64_t make_file_id_from_itime(SMB_STRUCT_STAT *st);