1 /*
2 * Copyright (c) 1995 - 2000 Kungliga Tekniska Högskolan
3 * (Royal Institute of Technology, Stockholm, Sweden).
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 *
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 *
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
16 *
17 * 3. Neither the name of the Institute nor the names of its contributors
18 * may be used to endorse or promote products derived from this software
19 * without specific prior written permission.
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
22 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
25 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * SUCH DAMAGE.
32 */
33
34 /* $arla: xfs_fs.h,v 1.22 2002/12/19 09:49:19 lha Exp $ */
35
36 #ifndef _xfs_h
37 #define _xfs_h
38
39 #include <sys/types.h>
40
41 #include <xfs/xfs_common.h>
42 #include <xfs/xfs_node.h>
43 #include <xfs/xfs_attr.h>
44
45 #define NNNPFS 2 /* maximal number of filesystems on a single device */
46
47 /*
48 * Filesystem struct.
49 */
50
51 struct xfs {
52 u_int status; /* Inited, opened or mounted */
53 #define NNPFS_MOUNTED 0x1
54 struct mount *mp;
55 struct xfs_node *root;
56 u_int nnodes;
57 int fd;
58 struct xfs_nodelist_head nodehead;
59 };
60
61 #ifdef __osf__
62 #ifdef HAVE_STRUCT_MOUNT_M_INFO
63 #define VFS_TO_NNPFS(v) ((struct xfs *) ((v)->m_info))
64 #else
65 #define VFS_TO_NNPFS(v) ((struct xfs *) ((v)->m_data))
66 #endif
67 #else
68 #define VFS_TO_NNPFS(v) ((struct xfs *) ((v)->mnt_data))
69 #endif
70 #define NNPFS_TO_VFS(x) ((x)->mp)
71
72 #define NNPFS_FROM_VNODE(vp) VFS_TO_NNPFS((vp)->v_mount)
73 #define NNPFS_FROM_XNODE(xp) NNPFS_FROM_VNODE(XNODE_TO_VNODE(xp))
74
75 extern struct xfs xfs[];
76
77 extern struct vnodeops xfs_vnodeops;
78
79 int new_xfs_node(struct xfs *, struct xfs_msg_node *, struct xfs_node **,
80 d_thread_t *);
81 void free_xfs_node(struct xfs_node *);
82 int free_all_xfs_nodes(struct xfs *, int, int);
83
84 int xfs_dnlc_enter(struct vnode *, xfs_componentname *, struct vnode *);
85 int xfs_dnlc_enter_name(struct vnode *, const char *, struct vnode *);
86 void xfs_dnlc_purge_mp(struct mount *);
87 void xfs_dnlc_purge(struct vnode *);
88 int xfs_dnlc_lookup(struct vnode *, xfs_componentname *, struct vnode **);
89 int xfs_dnlc_lookup_name(struct vnode *, const char *, struct vnode **);
90
91 void vattr2xfs_attr(const struct vattr *, struct xfs_attr *);
92 void xfs_attr2vattr(const struct xfs_attr *, struct vattr *, int);
93
94 int xfs_has_pag(const struct xfs_node *, xfs_pag_t);
95
96 #endif /* _xfs_h */