aboutsummaryrefslogtreecommitdiff
path: root/sys/include
diff options
context:
space:
mode:
authorIan Moffett <ian@osmora.org>2024-11-13 21:45:04 -0500
committerIan Moffett <ian@osmora.org>2024-11-13 21:47:04 -0500
commit140972727f77ae91085be934ca5376a66676a7c9 (patch)
tree4a9d1b041d00b68008cdfdf1b4b96fa50cdd3626 /sys/include
parentbb2210b76c8757cb4263c881a350f2b7921a67ff (diff)
kernel: vfs: Add vnode cache implementation
Signed-off-by: Ian Moffett <ian@osmora.org>
Diffstat (limited to 'sys/include')
-rw-r--r--sys/include/sys/sysctl.h1
-rw-r--r--sys/include/sys/vnode.h15
2 files changed, 16 insertions, 0 deletions
diff --git a/sys/include/sys/sysctl.h b/sys/include/sys/sysctl.h
index 0f1df26..9623137 100644
--- a/sys/include/sys/sysctl.h
+++ b/sys/include/sys/sysctl.h
@@ -39,6 +39,7 @@
#define KERN_OSTYPE 0
#define KERN_OSRELEASE 1
#define KERN_VERSION 2
+#define KERN_VCACHE_TYPE 3
/*
* Option types (i.e., int, string, etc) for
diff --git a/sys/include/sys/vnode.h b/sys/include/sys/vnode.h
index 3f3b011..33d5b17 100644
--- a/sys/include/sys/vnode.h
+++ b/sys/include/sys/vnode.h
@@ -31,6 +31,7 @@
#define _SYS_VNODE_H_
#include <sys/types.h>
+#include <sys/queue.h>
#include <sys/atomic.h>
#include <sys/sio.h>
@@ -44,10 +45,18 @@ struct vnode {
void *data;
const struct vops *vops;
uint32_t refcount;
+ TAILQ_ENTRY(vnode) vcache_link;
};
#define vfs_vref(VP) (atomic_inc_int(&(VP)->refcount))
+/* vcache types */
+#if defined(_KERNEL)
+#define VCACHE_TYPE_NONE 0
+#define VCACHE_TYPE_PROC 1
+#define VCACHE_TYPE_GLOBAL 2
+#endif /* KERNEL */
+
/* Vnode type flags */
#define VNON 0x00 /* Uninitialized */
#define VREG 0x01 /* Regular file */
@@ -86,6 +95,12 @@ struct vops {
extern struct vnode *g_root_vnode;
+int vfs_vcache_type(void);
+int vfs_vcache_migrate(int newtype);
+
+int vfs_vcache_enter(struct vnode *vp);
+struct vnode *vfs_recycle_vnode(void);
+
int vfs_alloc_vnode(struct vnode **res, int type);
int vfs_release_vnode(struct vnode *vp);