diff options
author | Ian Moffett <ian@osmora.org> | 2025-10-17 19:56:04 -0400 |
---|---|---|
committer | Ian Moffett <ian@osmora.org> | 2025-10-17 19:56:04 -0400 |
commit | a6ccf59fc56f90c97a82fe851f758decaeea9aef (patch) | |
tree | 900e658fedbdeac729452345a6729ccb2a5287f7 /src/sys | |
parent | 285cddba8b3ed2be1f6d7636a904a3492b522f34 (diff) |
kern: tmpfs: Implement getattr vop for tmpfs
Signed-off-by: Ian Moffett <ian@osmora.org>
Diffstat (limited to 'src/sys')
-rw-r--r-- | src/sys/fs/tmpfs.c | 20 |
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 = { |