summaryrefslogtreecommitdiff
path: root/sys/fs/tmpfs.c
diff options
context:
space:
mode:
authorIan Moffett <ian@osmora.org>2025-07-01 04:08:40 -0400
committerIan Moffett <ian@osmora.org>2025-07-01 04:08:40 -0400
commit6c5eb39584887b999df8c382c0c43a2c82d4afa0 (patch)
treeada93a982b6b29690b9f9e9117d96e45d88cedcc /sys/fs/tmpfs.c
parent35c6690e0b1611134de032c281976a62e4d2c9fd (diff)
kernel: tmpfs: Add tmpfs getattr callback
Signed-off-by: Ian Moffett <ian@osmora.org>
Diffstat (limited to 'sys/fs/tmpfs.c')
-rw-r--r--sys/fs/tmpfs.c26
1 files changed, 25 insertions, 1 deletions
diff --git a/sys/fs/tmpfs.c b/sys/fs/tmpfs.c
index 895e1fa..a6e40e1 100644
--- a/sys/fs/tmpfs.c
+++ b/sys/fs/tmpfs.c
@@ -335,6 +335,30 @@ tmpfs_read(struct vnode *vp, struct sio_txn *sio)
return sio->len;
}
+/*
+ * TMPFS get attribute callback for VFS
+ */
+static int
+tmpfs_getattr(struct vop_getattr_args *args)
+{
+ struct vnode *vp;
+ struct tmpfs_node *np;
+ struct vattr attr;
+
+ if ((vp = args->vp) == NULL) {
+ return -EIO;
+ }
+ if ((np = vp->data) == NULL) {
+ return -EIO;
+ }
+
+ memset(&attr, VNOVAL, sizeof(attr));
+ attr.size = np->real_size;
+ attr.mode = np->mode;
+ *args->res = attr;
+ return 0;
+}
+
static int
tmpfs_reclaim(struct vnode *vp)
{
@@ -384,7 +408,7 @@ tmpfs_init(struct fs_info *fip)
const struct vops g_tmpfs_vops = {
.lookup = tmpfs_lookup,
- .getattr = NULL,
+ .getattr = tmpfs_getattr,
.read = tmpfs_read,
.write = tmpfs_write,
.reclaim = tmpfs_reclaim,