xref: /netbsd-src/sys/fs/filecorefs/filecore_extern.h (revision e1610ba4cb3272a042c9339e926cbec0aa0715b1)
1*e1610ba4Sdholland /*	$NetBSD: filecore_extern.h,v 1.22 2013/06/23 07:28:36 dholland Exp $	*/
2aad01611Sagc 
3aad01611Sagc /*-
4aad01611Sagc  * Copyright (c) 1994 The Regents of the University of California.
5aad01611Sagc  * All rights reserved.
6aad01611Sagc  *
7aad01611Sagc  * Redistribution and use in source and binary forms, with or without
8aad01611Sagc  * modification, are permitted provided that the following conditions
9aad01611Sagc  * are met:
10aad01611Sagc  * 1. Redistributions of source code must retain the above copyright
11aad01611Sagc  *    notice, this list of conditions and the following disclaimer.
12aad01611Sagc  * 2. Redistributions in binary form must reproduce the above copyright
13aad01611Sagc  *    notice, this list of conditions and the following disclaimer in the
14aad01611Sagc  *    documentation and/or other materials provided with the distribution.
15aad01611Sagc  * 3. Neither the name of the University nor the names of its contributors
16aad01611Sagc  *    may be used to endorse or promote products derived from this software
17aad01611Sagc  *    without specific prior written permission.
18aad01611Sagc  *
19aad01611Sagc  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
20aad01611Sagc  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21aad01611Sagc  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22aad01611Sagc  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
23aad01611Sagc  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24aad01611Sagc  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25aad01611Sagc  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26aad01611Sagc  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27aad01611Sagc  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28aad01611Sagc  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29aad01611Sagc  * SUCH DAMAGE.
30aad01611Sagc  *
31aad01611Sagc  *	filecore_extern.h	1.1	1998/6/26
32aad01611Sagc  */
335356de15Sjdolecek 
345356de15Sjdolecek /*-
355356de15Sjdolecek  * Copyright (c) 1998 Andrew McMurry
365356de15Sjdolecek  *
375356de15Sjdolecek  * Redistribution and use in source and binary forms, with or without
385356de15Sjdolecek  * modification, are permitted provided that the following conditions
395356de15Sjdolecek  * are met:
405356de15Sjdolecek  * 1. Redistributions of source code must retain the above copyright
415356de15Sjdolecek  *    notice, this list of conditions and the following disclaimer.
425356de15Sjdolecek  * 2. Redistributions in binary form must reproduce the above copyright
435356de15Sjdolecek  *    notice, this list of conditions and the following disclaimer in the
445356de15Sjdolecek  *    documentation and/or other materials provided with the distribution.
455356de15Sjdolecek  * 3. All advertising materials mentioning features or use of this software
465356de15Sjdolecek  *    must display the following acknowledgement:
475356de15Sjdolecek  *	This product includes software developed by the University of
485356de15Sjdolecek  *	California, Berkeley and its contributors.
495356de15Sjdolecek  * 4. Neither the name of the University nor the names of its contributors
505356de15Sjdolecek  *    may be used to endorse or promote products derived from this software
515356de15Sjdolecek  *    without specific prior written permission.
525356de15Sjdolecek  *
535356de15Sjdolecek  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
545356de15Sjdolecek  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
555356de15Sjdolecek  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
565356de15Sjdolecek  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
575356de15Sjdolecek  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
585356de15Sjdolecek  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
595356de15Sjdolecek  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
605356de15Sjdolecek  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
615356de15Sjdolecek  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
625356de15Sjdolecek  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
635356de15Sjdolecek  * SUCH DAMAGE.
645356de15Sjdolecek  *
655356de15Sjdolecek  *	filecore_extern.h	1.1	1998/6/26
665356de15Sjdolecek  */
675356de15Sjdolecek 
685356de15Sjdolecek /*
695356de15Sjdolecek  * Definitions used in the kernel for Acorn Filecore file system support.
705356de15Sjdolecek  */
714bffed72Schristos #if !defined(_KERNEL)
724bffed72Schristos #error not supposed to be exposed to userland.
734bffed72Schristos #endif
745356de15Sjdolecek 
755356de15Sjdolecek #ifndef	FILECOREMNT_ROOT
765356de15Sjdolecek #define	FILECOREMNT_ROOT	0
775356de15Sjdolecek #endif
785356de15Sjdolecek 
795356de15Sjdolecek struct filecore_mnt {
805356de15Sjdolecek 	struct mount *fc_mountp;
815356de15Sjdolecek 	dev_t fc_dev;
825356de15Sjdolecek 	struct vnode *fc_devvp;
835356de15Sjdolecek 
845356de15Sjdolecek 	u_int32_t blksize;
855356de15Sjdolecek 	u_int32_t log2bsize;
865356de15Sjdolecek 	u_int32_t map;
875356de15Sjdolecek 	u_int32_t idspz;
885356de15Sjdolecek 	u_int32_t mask;
895356de15Sjdolecek 	u_int64_t nblks;
905356de15Sjdolecek 
915356de15Sjdolecek 	uid_t fc_uid;		/* uid to set as owner of the files */
925356de15Sjdolecek 	gid_t fc_gid;		/* gid to set as owner of the files */
935356de15Sjdolecek 	int fc_mntflags;
945356de15Sjdolecek 	struct filecore_disc_record drec;
955356de15Sjdolecek };
965356de15Sjdolecek 
975356de15Sjdolecek #define VFSTOFILECORE(mp)	((struct filecore_mnt *)((mp)->mnt_data))
985356de15Sjdolecek 
9946715543Sdholland #define filecore_blkoff(fcp, loc)	((loc) & ((fcp)->blksize-1))
100*e1610ba4Sdholland #define filecore_lblktosize(fcp, blk)	((blk) << (fcp)->log2bsize)
101*e1610ba4Sdholland #define filecore_lblkno(fcp, loc)	((loc) >> (fcp)->log2bsize)
10246715543Sdholland #define filecore_blksize(fcp, ip, lbn)	((fcp)->blksize)
1035356de15Sjdolecek 
1045356de15Sjdolecek extern struct pool filecore_node_pool;
1055356de15Sjdolecek 
1068d1f8992Spooka VFS_PROTOS(filecore);
1075356de15Sjdolecek 
10802cdf4d2Sdsl extern int (**filecore_vnodeop_p)(void *);
1095356de15Sjdolecek 
11002cdf4d2Sdsl int filecore_bbchecksum(void *);
11102cdf4d2Sdsl int filecore_bread(struct filecore_mnt *, u_int32_t, int,
11202cdf4d2Sdsl     kauth_cred_t, struct buf **);
11302cdf4d2Sdsl int filecore_map(struct filecore_mnt *, u_int32_t, daddr_t, daddr_t *);
114