diff options
author | Ian Moffett <ian@osmora.org> | 2024-06-25 23:08:27 -0400 |
---|---|---|
committer | Ian Moffett <ian@osmora.org> | 2024-06-25 23:08:27 -0400 |
commit | e1b26186029d2ebbe5b0a6bd09c5b5eb3937020f (patch) | |
tree | dfe717dc1de43b919db343ca9149c48c7569da21 | |
parent | 6a6e374db6bbd47c54be7a9e552a2b54b5e4f928 (diff) |
kernel: initramfs: Implement getattr vop
Signed-off-by: Ian Moffett <ian@osmora.org>
-rw-r--r-- | sys/fs/initramfs.c | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/sys/fs/initramfs.c b/sys/fs/initramfs.c index 57b6456..810d691 100644 --- a/sys/fs/initramfs.c +++ b/sys/fs/initramfs.c @@ -193,6 +193,25 @@ initramfs_lookup(struct vop_lookup_args *args) } static int +initramfs_getattr(struct vop_getattr_args *args) +{ + struct vnode *vp; + struct initramfs_node *n; + struct vattr attr; + + if ((vp = args->vp) == NULL) + return -EIO; + if ((n = vp->data) == NULL) + return -EIO; + + memset(&attr, VNOVAL, sizeof(attr)); + attr.mode = n->mode; + attr.size = n->size; + *args->res = attr; + return 0; +} + +static int initramfs_read(struct vnode *vp, struct sio_txn *sio) { struct initramfs_node *n = vp->data; @@ -256,7 +275,8 @@ initramfs_init(struct fs_info *fip) const struct vops g_initramfs_vops = { .lookup = initramfs_lookup, .read = initramfs_read, - .reclaim = initramfs_reclaim + .reclaim = initramfs_reclaim, + .getattr = initramfs_getattr }; const struct vfsops g_initramfs_vfsops = { |