+extern void hfs_chashinit_finish(struct hfsmount *hfsmp);
+extern void hfs_delete_chash(struct hfsmount *hfsmp);
+extern int hfs_chashremove(struct hfsmount *hfsmp, struct cnode *cp);
+extern void hfs_chash_abort(struct hfsmount *hfsmp, struct cnode *cp);
+extern void hfs_chash_rehash(struct hfsmount *hfsmp, struct cnode *cp1, struct cnode *cp2);
+extern void hfs_chashwakeup(struct hfsmount *hfsmp, struct cnode *cp, int flags);
+extern void hfs_chash_mark_in_transit(struct hfsmount *hfsmp, struct cnode *cp);
+
+extern struct vnode * hfs_chash_getvnode(struct hfsmount *hfsmp, ino_t inum, int wantrsrc,
+ int skiplock, int allow_deleted);
+extern struct cnode * hfs_chash_getcnode(struct hfsmount *hfsmp, ino_t inum, struct vnode **vpp,
+ int wantrsrc, int skiplock, int *out_flags, int *hflags);
+extern int hfs_chash_snoop(struct hfsmount *, ino_t, int, int (*)(const struct cat_desc *,
+ const struct cat_attr *, void *), void *);
+extern int hfs_valid_cnode(struct hfsmount *hfsmp, struct vnode *dvp, struct componentname *cnp,
+ cnid_t cnid, struct cat_attr *cattr, int *error);
+
+extern int hfs_chash_set_childlinkbit(struct hfsmount *hfsmp, cnid_t cnid);
+
+/*
+ * HFS cnode lock functions.
+ *
+ * HFS Locking Order:
+ *
+ * 1. cnode truncate lock (if needed)
+ * hfs_vnop_pagein/out can skip grabbing of this lock by flag option by
+ * HFS_LOCK_SKIP_IF_EXCLUSIVE if the truncate lock is already held exclusive
+ * by current thread from an earlier vnop.
+ * 2. cnode lock (in parent-child order if related, otherwise by address order)
+ * 3. journal (if needed)
+ * 4. system files (as needed)
+ * A. Catalog B-tree file
+ * B. Attributes B-tree file
+ * C. Startup file (if there is one)
+ * D. Allocation Bitmap file (always exclusive, supports recursion)
+ * E. Overflow Extents B-tree file (always exclusive, supports recursion)
+ * 5. hfs mount point (always last)
+ *
+ *
+ * I. HFS cnode hash lock (must not acquire any new locks while holding this lock, always taken last)
+ */
+
+
+enum hfs_locktype {
+ HFS_SHARED_LOCK = 1,
+ HFS_EXCLUSIVE_LOCK = 2
+};
+
+/* Option flags for cnode and truncate lock functions */
+enum hfs_lockflags {
+ HFS_LOCK_DEFAULT = 0x0, /* Default flag, no options provided */
+ HFS_LOCK_ALLOW_NOEXISTS = 0x1, /* Allow locking of all cnodes, including cnode marked deleted with no catalog entry */
+ HFS_LOCK_SKIP_IF_EXCLUSIVE = 0x2 /* Skip locking if the current thread already holds the lock exclusive */
+};
+#define HFS_SHARED_OWNER (void *)0xffffffff
+
+int hfs_lock(struct cnode *, enum hfs_locktype, enum hfs_lockflags);
+int hfs_lockpair(struct cnode *, struct cnode *, enum hfs_locktype);
+int hfs_lockfour(struct cnode *, struct cnode *, struct cnode *, struct cnode *,
+ enum hfs_locktype, struct cnode **);
+
+void hfs_unlock(struct cnode *);
+void hfs_unlockpair(struct cnode *, struct cnode *);
+void hfs_unlockfour(struct cnode *, struct cnode *, struct cnode *, struct cnode *);
+
+void hfs_lock_truncate(struct cnode *, enum hfs_locktype, enum hfs_lockflags);
+void hfs_unlock_truncate(struct cnode *, enum hfs_lockflags);
+int hfs_try_trunclock(struct cnode *, enum hfs_locktype, enum hfs_lockflags);