From 285cddba8b3ed2be1f6d7636a904a3492b522f34 Mon Sep 17 00:00:00 2001 From: Ian Moffett Date: Fri, 17 Oct 2025 19:55:12 -0400 Subject: kern: vfs: Add vop_getattr() for vnodes The vop_getattr() allows the caller to obtain information about a file represented by a specific vnode Signed-off-by: Ian Moffett --- src/sys/os/vfs_subr.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'src/sys/os') diff --git a/src/sys/os/vfs_subr.c b/src/sys/os/vfs_subr.c index adfcffb..2ae18af 100644 --- a/src/sys/os/vfs_subr.c +++ b/src/sys/os/vfs_subr.c @@ -246,3 +246,23 @@ vop_create(struct vnode *vp, struct nameidata *ndp) args.ndp = ndp; return vops->create(&args); } + +int +vop_getattr(struct vnode *vp, struct vattr *res) +{ + struct vop *vops; + + if (vp == NULL || res == NULL) { + return -EINVAL; + } + + if ((vops = vp->vops) == NULL) { + return -EIO; + } + + if (vops->getattr == NULL) { + return -EIO; + } + + return vops->getattr(vp, res); +} -- cgit v1.2.3