Skip to content
Snippets Groups Projects
Commit 3651135a authored by Christoph Hellwig's avatar Christoph Hellwig
Browse files

vfs: add helper table to convert from mode_t to vnode type

parent 70583a58
No related branches found
No related tags found
No related merge requests found
...@@ -43,6 +43,12 @@ ...@@ -43,6 +43,12 @@
#include <osv/vnode.h> #include <osv/vnode.h>
#include "vfs.h" #include "vfs.h"
enum vtype iftovt_tab[16] = {
VNON, VFIFO, VCHR, VNON, VDIR, VNON, VBLK, VNON,
VREG, VNON, VLNK, VNON, VSOCK, VNON, VNON, VBAD,
};
/* /*
* Memo: * Memo:
* *
...@@ -216,7 +222,8 @@ vput(struct vnode *vp) ...@@ -216,7 +222,8 @@ vput(struct vnode *vp)
/* /*
* Deallocate fs specific vnode data * Deallocate fs specific vnode data
*/ */
VOP_INACTIVE(vp); if (vp->v_op->vop_inactive)
VOP_INACTIVE(vp);
vfs_unbusy(vp->v_mount); vfs_unbusy(vp->v_mount);
vp->v_nrlocks--; vp->v_nrlocks--;
ASSERT(vp->v_nrlocks == 0); ASSERT(vp->v_nrlocks == 0);
......
...@@ -56,7 +56,8 @@ enum vtype { ...@@ -56,7 +56,8 @@ enum vtype {
VCHR, /* character device */ VCHR, /* character device */
VLNK, /* symbolic link */ VLNK, /* symbolic link */
VSOCK, /* socks */ VSOCK, /* socks */
VFIFO /* FIFO */ VFIFO, /* FIFO */
VBAD
}; };
/* /*
...@@ -182,6 +183,9 @@ void vrele(struct vnode *); ...@@ -182,6 +183,9 @@ void vrele(struct vnode *);
int vcount(struct vnode *); int vcount(struct vnode *);
void vflush(struct mount *); void vflush(struct mount *);
extern enum vtype iftovt_tab[];
#define IFTOVT(mode) (iftovt_tab[((mode) & S_IFMT) >> 12])
__END_DECLS __END_DECLS
#endif /* !_SYS_VNODE_H_ */ #endif /* !_SYS_VNODE_H_ */
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment