filecore_extern.h revision 1.12.12.1 1 /* $NetBSD: filecore_extern.h,v 1.12.12.1 2006/05/24 15:50:34 tron Exp $ */
2
3 /*-
4 * Copyright (c) 1994 The Regents of the University of California.
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 * 3. Neither the name of the University nor the names of its contributors
16 * may be used to endorse or promote products derived from this software
17 * without specific prior written permission.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
20 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
23 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29 * SUCH DAMAGE.
30 *
31 * filecore_extern.h 1.1 1998/6/26
32 */
33
34 /*-
35 * Copyright (c) 1998 Andrew McMurry
36 *
37 * Redistribution and use in source and binary forms, with or without
38 * modification, are permitted provided that the following conditions
39 * are met:
40 * 1. Redistributions of source code must retain the above copyright
41 * notice, this list of conditions and the following disclaimer.
42 * 2. Redistributions in binary form must reproduce the above copyright
43 * notice, this list of conditions and the following disclaimer in the
44 * documentation and/or other materials provided with the distribution.
45 * 3. All advertising materials mentioning features or use of this software
46 * must display the following acknowledgement:
47 * This product includes software developed by the University of
48 * California, Berkeley and its contributors.
49 * 4. Neither the name of the University nor the names of its contributors
50 * may be used to endorse or promote products derived from this software
51 * without specific prior written permission.
52 *
53 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
54 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
55 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
56 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
57 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
58 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
59 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
60 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
61 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
62 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
63 * SUCH DAMAGE.
64 *
65 * filecore_extern.h 1.1 1998/6/26
66 */
67
68 /*
69 * Definitions used in the kernel for Acorn Filecore file system support.
70 */
71 #if !defined(_KERNEL)
72 #error not supposed to be exposed to userland.
73 #endif
74
75 #ifndef FILECOREMNT_ROOT
76 #define FILECOREMNT_ROOT 0
77 #endif
78
79 #include <sys/mallocvar.h>
80
81 MALLOC_DECLARE(M_FILECOREMNT);
82
83 struct filecore_mnt {
84 struct mount *fc_mountp;
85 dev_t fc_dev;
86 struct vnode *fc_devvp;
87
88 u_int32_t blksize;
89 u_int32_t log2bsize;
90 u_int32_t map;
91 u_int32_t idspz;
92 u_int32_t mask;
93 u_int64_t nblks;
94
95 uid_t fc_uid; /* uid to set as owner of the files */
96 gid_t fc_gid; /* gid to set as owner of the files */
97 int fc_mntflags;
98 struct filecore_disc_record drec;
99 };
100
101 #define VFSTOFILECORE(mp) ((struct filecore_mnt *)((mp)->mnt_data))
102
103 #define blkoff(fcp, loc) ((loc) & ((fcp)->blksize-1))
104 #define lblktosize(fcp, blk) ((blk) << (fcp)->log2bsize)
105 #define lblkno(fcp, loc) ((loc) >> (fcp)->log2bsize)
106 #define blksize(fcp, ip, lbn) ((fcp)->blksize)
107
108 extern struct pool filecore_node_pool;
109
110 int filecore_mount __P((struct mount *,
111 const char *, void *, struct nameidata *, struct lwp *));
112 int filecore_start __P((struct mount *, int, struct lwp *));
113 int filecore_unmount __P((struct mount *, int, struct lwp *));
114 int filecore_root __P((struct mount *, struct vnode **));
115 int filecore_quotactl __P((struct mount *, int, uid_t, void *, struct lwp *));
116 int filecore_statvfs __P((struct mount *, struct statvfs *, struct lwp *));
117 int filecore_sync __P((struct mount *, int, kauth_cred_t, struct lwp *));
118 int filecore_vget __P((struct mount *, ino_t, struct vnode **));
119 int filecore_fhtovp __P((struct mount *, struct fid *, struct vnode **));
120 int filecore_checkexp __P((struct mount *, struct mbuf *, int *,
121 kauth_cred_t *));
122 int filecore_vptofh __P((struct vnode *, struct fid *));
123 void filecore_init __P((void));
124 void filecore_reinit __P((void));
125 void filecore_done __P((void));
126
127 #ifdef SYSCTL_SETUP_PROTO
128 SYSCTL_SETUP_PROTO(sysctl_vfs_filecore_setup);
129 #endif /* SYSCTL_SETUP_PROTO */
130
131 extern int (**filecore_vnodeop_p) __P((void *));
132
133 int filecore_bbchecksum __P((void *));
134 int filecore_bread __P((struct filecore_mnt *, u_int32_t, int,
135 kauth_cred_t, struct buf **));
136 int filecore_map __P((struct filecore_mnt *, u_int32_t, daddr_t, daddr_t *));
137