2 * Copyright (c) 2011-2012 The DragonFly Project. All rights reserved.
4 * This code is derived from software contributed to The DragonFly Project
5 * by Matthew Dillon <dillon@dragonflybsd.org>
6 * by Venkatesh Srinivas <vsrinivas@dragonflybsd.org>
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 * 2. Redistributions in binary form must reproduce the above copyright
15 * notice, this list of conditions and the following disclaimer in
16 * the documentation and/or other materials provided with the
18 * 3. Neither the name of The DragonFly Project nor the names of its
19 * contributors may be used to endorse or promote products derived
20 * from this software without specific, prior written permission.
22 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
25 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
26 * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
27 * INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING,
28 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
29 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
30 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
31 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
32 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
37 * This header file contains structures used internally by the HAMMER2
38 * implementation. See hammer2_disk.h for on-disk structures.
41 #ifndef _VFS_HAMMER2_HAMMER2_H_
42 #define _VFS_HAMMER2_HAMMER2_H_
44 #include <sys/param.h>
45 #include <sys/types.h>
46 #include <sys/kernel.h>
48 #include <sys/systm.h>
50 #include <sys/malloc.h>
51 #include <sys/mount.h>
52 #include <sys/vnode.h>
54 #include <sys/mountctl.h>
57 #include <sys/globaldata.h>
58 #include <sys/lockf.h>
60 #include <sys/queue.h>
61 #include <sys/limits.h>
63 #include <sys/signal2.h>
66 #include "hammer2_disk.h"
67 #include "hammer2_mount.h"
75 struct hammer2_inode {
76 struct hammer2_mount *mp;
84 #define HAMMER2_INODE_TYPE_DIR 0x01
85 #define HAMMER2_INODE_TYPE_FILE 0x02
86 #define HAMMER2_INODE_TYPE_ROOT 0x10
87 #define HAMMER2_INODE_TYPE_MASK 0x07
90 * Governing mount structure for filesystem (aka vp->v_mount)
92 struct hammer2_mount {
94 int hm_ronly; /* block device mounted read-only */
95 struct vnode *hm_devvp; /* device vnode */
99 struct hammer2_inode *hm_iroot;
101 /* Per-mount inode zone */
102 struct malloc_type *hm_inodes;
106 struct malloc_type *hm_ipstacks;
110 struct hammer2_volume_data hm_sb;
115 MALLOC_DECLARE(M_HAMMER2);
117 static inline struct mount *
118 H2TOMP(struct hammer2_mount *hmp)
120 return (struct mount *) hmp->hm_mp;
123 #define VTOI(vp) ((struct hammer2_inode *) (vp)->v_data)
124 #define ITOV(ip) ((ip)->vp)
126 static inline struct hammer2_mount *
127 MPTOH2(struct mount *mp)
129 return (struct hammer2_mount *) mp->mnt_data;
132 extern struct vop_ops hammer2_vnode_vops;
133 extern struct vop_ops hammer2_spec_vops;
134 extern struct vop_ops hammer2_fifo_vops;
136 /* hammer2_inode.c */
138 extern int hammer2_inactive(struct vop_inactive_args *);
139 extern int hammer2_reclaim(struct vop_reclaim_args *);
143 extern struct vnode *igetv(struct hammer2_inode *, int *);
145 extern void hammer2_mount_exlock(struct hammer2_mount *);
146 extern void hammer2_mount_shlock(struct hammer2_mount *);
147 extern void hammer2_mount_unlock(struct hammer2_mount *);
149 #endif /* !_KERNEL */
150 #endif /* !_VFS_HAMMER2_HAMMER2_H_ */