summaryrefslogtreecommitdiff
path: root/src/sys/fs
diff options
context:
space:
mode:
Diffstat (limited to 'src/sys/fs')
-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 = {