]> git.saurik.com Git - apple/xnu.git/blobdiff - bsd/sys/vnode_internal.h
xnu-4570.31.3.tar.gz
[apple/xnu.git] / bsd / sys / vnode_internal.h
index abc1566a45e2db046bc3c151858750efb4c2b281..d06102237dc2fe0015340f7285a489a56f7f57e6 100644 (file)
@@ -128,8 +128,8 @@ struct vnode {
        lck_mtx_t v_lock;                       /* vnode mutex */
        TAILQ_ENTRY(vnode) v_freelist;          /* vnode freelist */
        TAILQ_ENTRY(vnode) v_mntvnodes;         /* vnodes for mount point */
+        TAILQ_HEAD(, namecache) v_ncchildren;  /* name cache entries that regard us as their parent */
         LIST_HEAD(, namecache) v_nclinks;      /* name cache entries that name this vnode */
-        LIST_HEAD(, namecache) v_ncchildren;   /* name cache entries that regard us as their parent */
         vnode_t         v_defer_reclaimlist;           /* in case we have to defer the reclaim to avoid recursion */
         uint32_t v_listflag;                   /* flags protected by the vnode_list_lock (see below) */
        uint32_t v_flag;                        /* vnode flags (see below) */
@@ -260,6 +260,13 @@ struct vnode {
 #define VNEEDSSNAPSHOT 0x1000000
 #define VNOCS         0x2000000        /* is there no code signature available */
 #define VISDIRTY       0x4000000        /* vnode will need IO if reclaimed */  
+#define VFASTDEVCANDIDATE  0x8000000        /* vnode is a candidate to store on a fast device */
+#define VAUTOCANDIDATE 0x10000000       /* vnode was automatically marked as a fast-dev candidate */
+/*
+  0x20000000 not used
+  0x40000000 not used
+  0x80000000 not used.
+*/
 
 /*
  * This structure describes vnode data which is specific to a file descriptor.
@@ -311,12 +318,14 @@ extern    struct vnode *imgsrc_rootvnodes[];
  */
 #define VDESC_MAX_VPS          16
 /* Low order 16 flag bits are reserved for willrele flags for vp arguments. */
-#define VDESC_VP0_WILLRELE     0x0001
-#define VDESC_VP1_WILLRELE     0x0002
-#define VDESC_VP2_WILLRELE     0x0004
-#define VDESC_VP3_WILLRELE     0x0008
-#define VDESC_NOMAP_VPP                0x0100
-#define VDESC_VPP_WILLRELE     0x0200
+#define VDESC_VP0_WILLRELE     0x00001
+#define VDESC_VP1_WILLRELE     0x00002
+#define VDESC_VP2_WILLRELE     0x00004
+#define VDESC_VP3_WILLRELE     0x00008
+#define VDESC_NOMAP_VPP                0x00100
+#define VDESC_VPP_WILLRELE     0x00200
+
+#define VDESC_DISABLED         0x10000 /* descriptor defined but op is unused, has no op slot */
 
 /*
  * VDESC_NO_OFFSET is used to identify the end of the offset list
@@ -390,19 +399,11 @@ extern struct vnodeop_desc *vnodeop_descs[];
 
 struct ostat;
 
-#define BUILDPATH_NO_FS_ENTER     0x1 /* Use cache values, do not enter file system */
-#define BUILDPATH_CHECKACCESS     0x2 /* Check if parents have search rights */
-#define BUILDPATH_CHECK_MOVED     0x4 /* Return EAGAIN if the parent hierarchy is modified */
-#define BUILDPATH_VOLUME_RELATIVE 0x8 /* Return path relative to the nearest mount point */
-
-int    build_path(vnode_t first_vp, char *buff, int buflen, int *outlen, int flags, vfs_context_t ctx);
-
-int    bdevvp(dev_t dev, struct vnode **vpp);
+/* bdevvp moved to vnode.h as private KPI */
 void   cvtstat(struct stat *st, struct ostat *ost);
 void   vprint(const char *label, struct vnode *vp);
 
 
-__private_extern__ int is_package_name(const char *name, int len);
 __private_extern__ int set_package_extensions_table(user_addr_t data, int nentries, int maxwidth);
 int    vn_rdwr_64(enum uio_rw rw, struct vnode *vp, uint64_t base,
                        int64_t len, off_t offset, enum uio_seg segflg,
@@ -440,11 +441,17 @@ int       vn_authorize_unlink(vnode_t dvp, vnode_t vp, struct componentname *cnp, vfs_
 int    vn_authorize_rename(struct vnode *fdvp, struct vnode *fvp, struct componentname *fcnp,
                        struct vnode *tdvp, struct vnode *tvp, struct componentname *tcnp,
                vfs_context_t ctx, void *reserved);
+int vn_authorize_renamex(struct vnode *fdvp,  struct vnode *fvp,  struct componentname *fcnp,
+                                                struct vnode *tdvp,  struct vnode *tvp,  struct componentname *tcnp,
+                                                vfs_context_t ctx, vfs_rename_flags_t flags, void *reserved);
 int    vn_authorize_rmdir(vnode_t dvp, vnode_t vp, struct componentname *cnp, vfs_context_t ctx, void *reserved);
 
 typedef int (*vn_create_authorizer_t)(vnode_t, struct componentname *, struct vnode_attr *, vfs_context_t, void*);
 int vn_authorize_mkdir(vnode_t, struct componentname *, struct vnode_attr *, vfs_context_t, void*);
 int vn_authorize_null(vnode_t, struct componentname *, struct vnode_attr *, vfs_context_t, void*);
+int vnode_attr_authorize_dir_clone(struct vnode_attr *vap, kauth_action_t action,
+    struct vnode_attr *dvap, vnode_t sdvp, mount_t mp, dir_clone_authorizer_op_t vattr_op,
+    uint32_t flags, vfs_context_t ctx, void *reserved);
 /* End of authorization subroutines */
 
 #define VN_CREATE_NOAUTH               (1<<0)
@@ -479,7 +486,6 @@ void        name_cache_unlock(void);
 void   cache_enter_with_gen(vnode_t dvp, vnode_t vp, struct componentname *cnp, int gen);
 const char *cache_enter_create(vnode_t dvp, vnode_t vp, struct componentname *cnp);
 
-int vn_pathconf(vnode_t, int, int32_t *, vfs_context_t);
 extern int nc_disabled;        
 
 #define        vnode_lock_convert(v)   lck_mtx_convert_spin(&(v)->v_lock)
@@ -493,7 +499,6 @@ void        vnode_list_unlock(void);
 #define VNODE_REF_FORCE        0x1
 int    vnode_ref_ext(vnode_t, int, int);
 
-void   vnode_rele_ext(vnode_t, int, int);
 void   vnode_rele_internal(vnode_t, int, int, int);
 #ifdef BSD_KERNEL_PRIVATE
 int    vnode_getalways(vnode_t);
@@ -552,6 +557,22 @@ void       vfsinit(void);
 void vnode_lock(vnode_t);
 void vnode_unlock(vnode_t);
 
+void vn_print_state(vnode_t /* vp */, const char * /* fmt */, ...)
+    __printflike(2,3);
+
+#if DEVELOPMENT || DEBUG
+#define VNASSERT(exp, vp, msg)                                         \
+do {                                                                   \
+       if (__improbable(!(exp))) {                                     \
+               vn_print_state(vp, "VNASSERT failed %s:%d\n", __FILE__, \
+                   __LINE__);                                          \
+               panic msg;                                              \
+       }                                                               \
+} while (0)
+#else
+#define VNASSERT(exp, vp, msg)
+#endif /* DEVELOPMENT || DEBUG */
+
 /*
  * XXX exported symbols; should be static
  */
@@ -570,6 +591,9 @@ vnode_readdir64(struct vnode *vp, struct uio *uio, int flags, int *eofflag,
                 int *numdirent, vfs_context_t ctxp);
 
 void vnode_setswapmount(vnode_t);
+int64_t        vnode_getswappin_avail(vnode_t);
+
+int vnode_get_snapdir(vnode_t , vnode_t *, vfs_context_t);
 
 #if CONFIG_TRIGGERS
 /* VFS Internal Vnode Trigger Interfaces (Private) */
@@ -578,6 +602,8 @@ void vnode_trigger_rearm(vnode_t, vfs_context_t);
 void vfs_nested_trigger_unmounts(mount_t, int, vfs_context_t);
 #endif /* CONFIG_TRIGGERS */
 
+int    build_path_with_parent(vnode_t, vnode_t /* parent */, char *, int, int *, int, vfs_context_t);
+
 #endif /* BSD_KERNEL_PRIVATE */
 
 #endif /* !_SYS_VNODE_INTERNAL_H_ */