aboutsummaryrefslogtreecommitdiff
path: root/sys/fs/initramfs.c
diff options
context:
space:
mode:
authorIan Moffett <ian@osmora.org>2024-06-25 23:08:27 -0400
committerIan Moffett <ian@osmora.org>2024-06-25 23:08:27 -0400
commite1b26186029d2ebbe5b0a6bd09c5b5eb3937020f (patch)
treedfe717dc1de43b919db343ca9149c48c7569da21 /sys/fs/initramfs.c
parent6a6e374db6bbd47c54be7a9e552a2b54b5e4f928 (diff)
kernel: initramfs: Implement getattr vop
Signed-off-by: Ian Moffett <ian@osmora.org>
Diffstat (limited to 'sys/fs/initramfs.c')
-rw-r--r--sys/fs/initramfs.c22
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 = {