xref: /freebsd/usr.sbin/makefs/ffs/ffs_extern.h (revision 8a7b61203704d362cfbc66c00619f51b24106b55)
1d347a0daSSam Leffler /*	$NetBSD: ffs_extern.h,v 1.6 2003/08/07 11:25:33 agc Exp $	*/
2d347a0daSSam Leffler /* From: NetBSD: ffs_extern.h,v 1.19 2001/08/17 02:18:48 lukem Exp */
3d347a0daSSam Leffler 
4d347a0daSSam Leffler /*-
58a16b7a1SPedro F. Giffuni  * SPDX-License-Identifier: BSD-3-Clause
68a16b7a1SPedro F. Giffuni  *
7d347a0daSSam Leffler  * Copyright (c) 1991, 1993, 1994
8d347a0daSSam Leffler  *	The Regents of the University of California.  All rights reserved.
9d347a0daSSam Leffler  *
10d347a0daSSam Leffler  * Redistribution and use in source and binary forms, with or without
11d347a0daSSam Leffler  * modification, are permitted provided that the following conditions
12d347a0daSSam Leffler  * are met:
13d347a0daSSam Leffler  * 1. Redistributions of source code must retain the above copyright
14d347a0daSSam Leffler  *    notice, this list of conditions and the following disclaimer.
15d347a0daSSam Leffler  * 2. Redistributions in binary form must reproduce the above copyright
16d347a0daSSam Leffler  *    notice, this list of conditions and the following disclaimer in the
17d347a0daSSam Leffler  *    documentation and/or other materials provided with the distribution.
18d347a0daSSam Leffler  * 3. Neither the name of the University nor the names of its contributors
19d347a0daSSam Leffler  *    may be used to endorse or promote products derived from this software
20d347a0daSSam Leffler  *    without specific prior written permission.
21d347a0daSSam Leffler  *
22d347a0daSSam Leffler  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
23d347a0daSSam Leffler  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24d347a0daSSam Leffler  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25d347a0daSSam Leffler  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
26d347a0daSSam Leffler  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27d347a0daSSam Leffler  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28d347a0daSSam Leffler  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29d347a0daSSam Leffler  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30d347a0daSSam Leffler  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31d347a0daSSam Leffler  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32d347a0daSSam Leffler  * SUCH DAMAGE.
33d347a0daSSam Leffler  */
34d347a0daSSam Leffler 
35d347a0daSSam Leffler #include "ffs/buf.h"
36d347a0daSSam Leffler 
3755a1bde9SEd Schouten struct inode;
3855a1bde9SEd Schouten 
39d347a0daSSam Leffler /*
40d347a0daSSam Leffler  * Structure used to pass around logical block paths generated by
41d347a0daSSam Leffler  * ufs_getlbns and used by truncate and bmap code.
42d347a0daSSam Leffler  */
43d347a0daSSam Leffler struct indir {
44d347a0daSSam Leffler 	daddr_t in_lbn;		/* Logical block number. */
45d347a0daSSam Leffler 	int	in_off;			/* Offset in buffer. */
46d347a0daSSam Leffler };
47d347a0daSSam Leffler 
48d347a0daSSam Leffler 	/* ffs.c */
4955a1bde9SEd Schouten _Noreturn void panic(const char *, ...) __printflike(1, 2);
50d347a0daSSam Leffler 
51d347a0daSSam Leffler 	/* ffs_alloc.c */
52d347a0daSSam Leffler int ffs_alloc(struct inode *, daddr_t, daddr_t, int, daddr_t *);
53d347a0daSSam Leffler daddr_t ffs_blkpref_ufs1(struct inode *, daddr_t, int, int32_t *);
54d347a0daSSam Leffler daddr_t ffs_blkpref_ufs2(struct inode *, daddr_t, int, int64_t *);
55d347a0daSSam Leffler void ffs_blkfree(struct inode *, daddr_t, long);
56d347a0daSSam Leffler void ffs_clusteracct(struct fs *, struct cg *, int32_t, int);
57d347a0daSSam Leffler 
58d347a0daSSam Leffler 	/* ffs_balloc.c */
59*d485c77fSKonstantin Belousov int ffs_balloc(struct inode *, off_t, int, struct m_buf **);
60d347a0daSSam Leffler 
61d347a0daSSam Leffler 	/* ffs_bswap.c */
62d347a0daSSam Leffler void ffs_sb_swap(struct fs*, struct fs *);
63d347a0daSSam Leffler void ffs_dinode1_swap(struct ufs1_dinode *, struct ufs1_dinode *);
64d347a0daSSam Leffler void ffs_dinode2_swap(struct ufs2_dinode *, struct ufs2_dinode *);
65d347a0daSSam Leffler void ffs_csum_swap(struct csum *, struct csum *, int);
66d347a0daSSam Leffler void ffs_cg_swap(struct cg *, struct cg *, struct fs *);
67d347a0daSSam Leffler 
68d347a0daSSam Leffler 	/* ffs_subr.c */
69d347a0daSSam Leffler void ffs_fragacct(struct fs *, int, int32_t[], int, int);
70d347a0daSSam Leffler int ffs_isblock(struct fs *, u_char *, int32_t);
71d347a0daSSam Leffler int ffs_isfreeblock(struct fs *, u_char *, int32_t);
72d347a0daSSam Leffler void ffs_clrblock(struct fs *, u_char *, int32_t);
73d347a0daSSam Leffler void ffs_setblock(struct fs *, u_char *, int32_t);
74d347a0daSSam Leffler 
75d347a0daSSam Leffler 	/* ufs_bmap.c */
76d347a0daSSam Leffler int ufs_getlbns(struct inode *, daddr_t, struct indir *, int *);
77