aboutsummaryrefslogtreecommitdiff
path: root/stand
diff options
context:
space:
mode:
authorSimon J. Gerraty <sjg@FreeBSD.org>2018-06-09 02:41:51 +0000
committerSimon J. Gerraty <sjg@FreeBSD.org>2018-06-09 02:41:51 +0000
commit5ad42d0f47634e5a28a6ac19c2318291026604a3 (patch)
tree1a1730c8de5deedf7b4f2a097ffe16e3a9efabf3 /stand
parent456eeabebc464774d0c13332c1a05b6485c6e894 (diff)
downloadsrc-5ad42d0f47634e5a28a6ac19c2318291026604a3.tar.gz
src-5ad42d0f47634e5a28a6ac19c2318291026604a3.zip
Add st_mtime, st_ino and st_dev for ufs_stat
Differential Revision: D15064
Notes
Notes: svn path=/head/; revision=334868
Diffstat (limited to 'stand')
-rw-r--r--stand/libsa/ufs.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/stand/libsa/ufs.c b/stand/libsa/ufs.c
index 2cad803e3c73..a0166acf536b 100644
--- a/stand/libsa/ufs.c
+++ b/stand/libsa/ufs.c
@@ -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 ? \
@@ -190,6 +191,7 @@ read_inode(inumber, f)
fp->f_buf_blkno = -1;
}
fp->f_seekp = 0;
+ fp->f_inumber = inumber;
out:
free(buf);
return (rc);
@@ -836,6 +838,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);
}