summaryrefslogtreecommitdiffstats
path: root/include/sys
diff options
context:
space:
mode:
authorBrian Behlendorf <[email protected]>2011-01-11 11:53:05 -0800
committerBrian Behlendorf <[email protected]>2011-01-12 11:38:04 -0800
commit4295b530eeb68aaacbbeb5b2197ed14bf9295c2b (patch)
tree5ddb9621ba868c2e5a613568890cc5d1c595668f /include/sys
parent3f688a8c381d298062467a318994bb5849b1c8c1 (diff)
Add vn_mode_to_vtype/vn_vtype to_mode helpers
Add simple helpers to convert a vnode->v_type to a inode->i_mode. These should be used sparingly but they are handy to have.
Diffstat (limited to 'include/sys')
-rw-r--r--include/sys/mode.h4
-rw-r--r--include/sys/vnode.h2
2 files changed, 6 insertions, 0 deletions
diff --git a/include/sys/mode.h b/include/sys/mode.h
index f3d890944..ddd504f9f 100644
--- a/include/sys/mode.h
+++ b/include/sys/mode.h
@@ -25,4 +25,8 @@
#ifndef _SPL_MODE_H
#define _SPL_MODE_H
+#define IFTOVT(mode) vn_mode_to_vtype(mode)
+#define VTTOIF(vtype) vn_vtype_to_mode(vtype)
+#define MAKEIMODE(T, M) (VTTOIF(T) | ((M) & ~S_IFMT))
+
#endif /* SPL_MODE_H */
diff --git a/include/sys/vnode.h b/include/sys/vnode.h
index 104e65d15..b5969b352 100644
--- a/include/sys/vnode.h
+++ b/include/sys/vnode.h
@@ -202,6 +202,8 @@ typedef struct caller_context {
extern vnode_t *vn_alloc(int flag);
void vn_free(vnode_t *vp);
+extern vtype_t vn_mode_to_vtype(mode_t);
+extern mode_t vn_vtype_to_mode(vtype_t);
extern int vn_open(const char *path, uio_seg_t seg, int flags, int mode,
vnode_t **vpp, int x1, void *x2);
extern int vn_openat(const char *path, uio_seg_t seg, int flags, int mode,