summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorIan Moffett <ian@osmora.org>2025-10-17 19:56:04 -0400
committerIan Moffett <ian@osmora.org>2025-10-17 19:56:04 -0400
commita6ccf59fc56f90c97a82fe851f758decaeea9aef (patch)
tree900e658fedbdeac729452345a6729ccb2a5287f7 /src
parent285cddba8b3ed2be1f6d7636a904a3492b522f34 (diff)
kern: tmpfs: Implement getattr vop for tmpfs
Signed-off-by: Ian Moffett <ian@osmora.org>
Diffstat (limited to 'src')
-rw-r--r--src/sys/fs/tmpfs.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/src/sys/fs/tmpfs.c b/src/sys/fs/tmpfs.c
index 63e6577..af1537f 100644
--- a/src/sys/fs/tmpfs.c
+++ b/src/sys/fs/tmpfs.c
@@ -326,6 +326,23 @@ tmpfs_read(struct vop_rw_data *data)
}
static int
+tmpfs_getattr(struct vnode *vp, struct vattr *res)
+{
+ struct tmpfs_node *np;
+
+ if (vp == NULL || res == NULL) {
+ return -EINVAL;
+ }
+
+ if ((np = vp->data) == NULL) {
+ return -EIO;
+ }
+
+ res->size = np->real_len;
+ return 0;
+}
+
+static int
tmpfs_reclaim(struct vnode *vp, int flags)
{
return 0;
@@ -336,7 +353,8 @@ static struct vop tmpfs_vops = {
.create = tmpfs_create,
.reclaim = tmpfs_reclaim,
.write = tmpfs_write,
- .read = tmpfs_read
+ .read = tmpfs_read,
+ .getattr = tmpfs_getattr
};
struct vfsops g_tmpfs_vfsops = {