svn commit: r344288 - stable/11/stand/libsa
Kyle Evans
kevans at FreeBSD.org
Tue Feb 19 18:37:46 UTC 2019
Author: kevans
Date: Tue Feb 19 18:37:45 2019
New Revision: 344288
URL: https://svnweb.freebsd.org/changeset/base/344288
Log:
MFC r334868: Add st_mtime, st_ino and st_dev for ufs_stat
Modified:
stable/11/stand/libsa/ufs.c
Directory Properties:
stable/11/ (props changed)
Modified: stable/11/stand/libsa/ufs.c
==============================================================================
--- stable/11/stand/libsa/ufs.c Tue Feb 19 18:35:49 2019 (r344287)
+++ stable/11/stand/libsa/ufs.c Tue Feb 19 18:37:45 2019 (r344288)
@@ -124,6 +124,7 @@ struct file {
ufs2_daddr_t f_buf_blkno; /* block number of data block */
char *f_buf; /* buffer for data block */
size_t f_buf_size; /* size of data block */
+ int f_inumber; /* inumber */
};
#define DIP(fp, field) \
((fp)->f_fs->fs_magic == FS_UFS1_MAGIC ? \
@@ -185,6 +186,7 @@ read_inode(inumber, f)
fp->f_buf_blkno = -1;
}
fp->f_seekp = 0;
+ fp->f_inumber = inumber;
out:
free(buf);
return (rc);
@@ -831,6 +833,20 @@ ufs_stat(f, sb)
sb->st_uid = DIP(fp, di_uid);
sb->st_gid = DIP(fp, di_gid);
sb->st_size = DIP(fp, di_size);
+ sb->st_mtime = DIP(fp, di_mtime);
+ /*
+ * The items below are ufs specific!
+ * Other fs types will need their own solution
+ * if these fields are needed.
+ */
+ sb->st_ino = fp->f_inumber;
+ /*
+ * We need something to differentiate devs.
+ * fs_id is unique but 64bit, we xor the two
+ * halves to squeeze it into 32bits.
+ */
+ sb->st_dev = (dev_t)(fp->f_fs->fs_id[0] ^ fp->f_fs->fs_id[1]);
+
return (0);
}
More information about the svn-src-all
mailing list