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