xref: /freebsd/sbin/ffsinfo/ffsinfo.c (revision 719747125bbbc91039ead3177a4360f502c8b1e0)
1df57947fSPedro F. Giffuni /*-
2df57947fSPedro F. Giffuni  * SPDX-License-Identifier: BSD-4-Clause
3df57947fSPedro F. Giffuni  *
43d500078SThomas-Henning von Kamptz  * Copyright (c) 2000 Christoph Herrmann, Thomas-Henning von Kamptz
53d500078SThomas-Henning von Kamptz  * Copyright (c) 1980, 1989, 1993 The Regents of the University of California.
63d500078SThomas-Henning von Kamptz  * All rights reserved.
73d500078SThomas-Henning von Kamptz  *
83d500078SThomas-Henning von Kamptz  * This code is derived from software contributed to Berkeley by
93d500078SThomas-Henning von Kamptz  * Christoph Herrmann and Thomas-Henning von Kamptz, Munich and Frankfurt.
103d500078SThomas-Henning von Kamptz  *
113d500078SThomas-Henning von Kamptz  * Redistribution and use in source and binary forms, with or without
123d500078SThomas-Henning von Kamptz  * modification, are permitted provided that the following conditions
133d500078SThomas-Henning von Kamptz  * are met:
143d500078SThomas-Henning von Kamptz  * 1. Redistributions of source code must retain the above copyright
153d500078SThomas-Henning von Kamptz  *    notice, this list of conditions and the following disclaimer.
163d500078SThomas-Henning von Kamptz  * 2. Redistributions in binary form must reproduce the above copyright
173d500078SThomas-Henning von Kamptz  *    notice, this list of conditions and the following disclaimer in the
183d500078SThomas-Henning von Kamptz  *    documentation and/or other materials provided with the distribution.
193d500078SThomas-Henning von Kamptz  * 3. All advertising materials mentioning features or use of this software
203d500078SThomas-Henning von Kamptz  *    must display the following acknowledgment:
213d500078SThomas-Henning von Kamptz  *      This product includes software developed by the University of
223d500078SThomas-Henning von Kamptz  *      California, Berkeley and its contributors, as well as Christoph
233d500078SThomas-Henning von Kamptz  *      Herrmann and Thomas-Henning von Kamptz.
243d500078SThomas-Henning von Kamptz  * 4. Neither the name of the University nor the names of its contributors
253d500078SThomas-Henning von Kamptz  *    may be used to endorse or promote products derived from this software
263d500078SThomas-Henning von Kamptz  *    without specific prior written permission.
273d500078SThomas-Henning von Kamptz  *
283d500078SThomas-Henning von Kamptz  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
293d500078SThomas-Henning von Kamptz  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
303d500078SThomas-Henning von Kamptz  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
313d500078SThomas-Henning von Kamptz  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
323d500078SThomas-Henning von Kamptz  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
333d500078SThomas-Henning von Kamptz  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
343d500078SThomas-Henning von Kamptz  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
353d500078SThomas-Henning von Kamptz  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
363d500078SThomas-Henning von Kamptz  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
373d500078SThomas-Henning von Kamptz  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
383d500078SThomas-Henning von Kamptz  * SUCH DAMAGE.
393d500078SThomas-Henning von Kamptz  *
404020c5bcSThomas-Henning von Kamptz  * $TSHeader: src/sbin/ffsinfo/ffsinfo.c,v 1.4 2000/12/12 19:30:55 tomsoft Exp $
413d500078SThomas-Henning von Kamptz  *
423d500078SThomas-Henning von Kamptz  */
433d500078SThomas-Henning von Kamptz 
443d500078SThomas-Henning von Kamptz /* ********************************************************** INCLUDES ***** */
453d500078SThomas-Henning von Kamptz #include <sys/param.h>
463d500078SThomas-Henning von Kamptz #include <sys/disklabel.h>
47942d2e02SRobert Watson #include <sys/mount.h>
483d500078SThomas-Henning von Kamptz #include <sys/stat.h>
493d500078SThomas-Henning von Kamptz 
50d485c77fSKonstantin Belousov #include <ufs/ufs/extattr.h>
51d485c77fSKonstantin Belousov #include <ufs/ufs/quota.h>
52942d2e02SRobert Watson #include <ufs/ufs/ufsmount.h>
53942d2e02SRobert Watson #include <ufs/ufs/dinode.h>
54942d2e02SRobert Watson #include <ufs/ffs/fs.h>
55942d2e02SRobert Watson 
563d500078SThomas-Henning von Kamptz #include <ctype.h>
573d500078SThomas-Henning von Kamptz #include <err.h>
587bb84191SRobert Watson #include <errno.h>
593d500078SThomas-Henning von Kamptz #include <fcntl.h>
60942d2e02SRobert Watson #include <libufs.h>
61942d2e02SRobert Watson #include <paths.h>
629b337054SGleb Kurtsou #include <stdint.h>
63942d2e02SRobert Watson #include <stdio.h>
643d500078SThomas-Henning von Kamptz #include <stdlib.h>
653d500078SThomas-Henning von Kamptz #include <string.h>
663d500078SThomas-Henning von Kamptz #include <unistd.h>
673d500078SThomas-Henning von Kamptz 
683d500078SThomas-Henning von Kamptz #include "debug.h"
693d500078SThomas-Henning von Kamptz 
703d500078SThomas-Henning von Kamptz /* *********************************************************** GLOBALS ***** */
713d500078SThomas-Henning von Kamptz #ifdef FS_DEBUG
723d500078SThomas-Henning von Kamptz int	_dbg_lvl_ = (DL_INFO); /* DL_TRC */
733d500078SThomas-Henning von Kamptz #endif /* FS_DEBUG */
743d500078SThomas-Henning von Kamptz 
751efe3c6bSEd Schouten static struct uufsd disk;
76942d2e02SRobert Watson 
77942d2e02SRobert Watson #define sblock disk.d_fs
78942d2e02SRobert Watson #define acg    disk.d_cg
79942d2e02SRobert Watson 
803d500078SThomas-Henning von Kamptz static union {
813d500078SThomas-Henning von Kamptz 	struct fs fs;
82942d2e02SRobert Watson 	char pad[SBLOCKSIZE];
83942d2e02SRobert Watson } fsun;
843d500078SThomas-Henning von Kamptz 
85942d2e02SRobert Watson #define osblock fsun.fs
863d500078SThomas-Henning von Kamptz 
873d500078SThomas-Henning von Kamptz static char	i1blk[MAXBSIZE];
883d500078SThomas-Henning von Kamptz static char	i2blk[MAXBSIZE];
893d500078SThomas-Henning von Kamptz static char	i3blk[MAXBSIZE];
903d500078SThomas-Henning von Kamptz 
913d500078SThomas-Henning von Kamptz static struct csum	*fscs;
923d500078SThomas-Henning von Kamptz 
933d500078SThomas-Henning von Kamptz /* ******************************************************** PROTOTYPES ***** */
944020c5bcSThomas-Henning von Kamptz static void	usage(void);
95942d2e02SRobert Watson static void	dump_whole_ufs1_inode(ino_t, int);
96942d2e02SRobert Watson static void	dump_whole_ufs2_inode(ino_t, int);
973d500078SThomas-Henning von Kamptz 
98942d2e02SRobert Watson #define DUMP_WHOLE_INODE(A,B) \
99942d2e02SRobert Watson 	( disk.d_ufs == 1 \
100942d2e02SRobert Watson 		? dump_whole_ufs1_inode((A),(B)) : dump_whole_ufs2_inode((A),(B)) )
1013d500078SThomas-Henning von Kamptz 
1023d500078SThomas-Henning von Kamptz /* ************************************************************** main ***** */
1033d500078SThomas-Henning von Kamptz /*
1043d500078SThomas-Henning von Kamptz  * ffsinfo(8) is a tool to dump all metadata of a file system. It helps to find
1053d500078SThomas-Henning von Kamptz  * errors is the file system much easier. You can run ffsinfo before and  after
1063d500078SThomas-Henning von Kamptz  * an  fsck(8),  and compare the two ascii dumps easy with diff, and  you  see
1073d500078SThomas-Henning von Kamptz  * directly where the problem is. You can control how much detail you want  to
1083d500078SThomas-Henning von Kamptz  * see  with some command line arguments. You can also easy check  the  status
1093d500078SThomas-Henning von Kamptz  * of  a file system, like is there is enough space for growing  a  file system,
1103d500078SThomas-Henning von Kamptz  * or  how  many active snapshots do we have. It provides much  more  detailed
1113d500078SThomas-Henning von Kamptz  * information  then dumpfs. Snapshots, as they are very new, are  not  really
1123d500078SThomas-Henning von Kamptz  * supported.  They  are just mentioned currently, but it is  planned  to  run
1133d500078SThomas-Henning von Kamptz  * also over active snapshots, to even get that output.
1143d500078SThomas-Henning von Kamptz  */
1153d500078SThomas-Henning von Kamptz int
main(int argc,char ** argv)1163d500078SThomas-Henning von Kamptz main(int argc, char **argv)
1173d500078SThomas-Henning von Kamptz {
1183d500078SThomas-Henning von Kamptz 	DBG_FUNC("main")
119942d2e02SRobert Watson 	char	*device, *special;
120f901ebcfSStefan Farfeleder 	int	ch;
1213d500078SThomas-Henning von Kamptz 	size_t	len;
1223d500078SThomas-Henning von Kamptz 	struct stat	st;
1233d500078SThomas-Henning von Kamptz 	struct csum	*dbg_csp;
1243d500078SThomas-Henning von Kamptz 	int	dbg_csc;
1253d500078SThomas-Henning von Kamptz 	char	dbg_line[80];
1263d500078SThomas-Henning von Kamptz 	int	cylno,i;
1273d500078SThomas-Henning von Kamptz 	int	cfg_cg, cfg_in, cfg_lv;
1283d500078SThomas-Henning von Kamptz 	int	cg_start, cg_stop;
1293d500078SThomas-Henning von Kamptz 	ino_t	in;
1303d500078SThomas-Henning von Kamptz 	char	*out_file;
1313d500078SThomas-Henning von Kamptz 
1323d500078SThomas-Henning von Kamptz 	DBG_ENTER;
1333d500078SThomas-Henning von Kamptz 
1343d500078SThomas-Henning von Kamptz 	cfg_lv = 0xff;
1353d500078SThomas-Henning von Kamptz 	cfg_in = -2;
1363d500078SThomas-Henning von Kamptz 	cfg_cg = -2;
1375c68d108SXin LI 	out_file = strdup("-");
1383d500078SThomas-Henning von Kamptz 
139942d2e02SRobert Watson 	while ((ch = getopt(argc, argv, "g:i:l:o:")) != -1) {
1403d500078SThomas-Henning von Kamptz 		switch (ch) {
1413d500078SThomas-Henning von Kamptz 		case 'g':
1427bb84191SRobert Watson 			cfg_cg = strtol(optarg, NULL, 0);
1437bb84191SRobert Watson 			if (errno == EINVAL || errno == ERANGE)
1447bb84191SRobert Watson 				err(1, "%s", optarg);
14589f0730dSBrian Somers 			if (cfg_cg < -1)
1464020c5bcSThomas-Henning von Kamptz 				usage();
1473d500078SThomas-Henning von Kamptz 			break;
1483d500078SThomas-Henning von Kamptz 		case 'i':
1497bb84191SRobert Watson 			cfg_in = strtol(optarg, NULL, 0);
1507bb84191SRobert Watson 			if (errno == EINVAL || errno == ERANGE)
1517bb84191SRobert Watson 				err(1, "%s", optarg);
15289f0730dSBrian Somers 			if (cfg_in < 0)
1534020c5bcSThomas-Henning von Kamptz 				usage();
1543d500078SThomas-Henning von Kamptz 			break;
1553d500078SThomas-Henning von Kamptz 		case 'l':
1567bb84191SRobert Watson 			cfg_lv = strtol(optarg, NULL, 0);
1577bb84191SRobert Watson 			if (errno == EINVAL||errno == ERANGE)
1587bb84191SRobert Watson 				err(1, "%s", optarg);
15989f0730dSBrian Somers 			if (cfg_lv < 0x1 || cfg_lv > 0x3ff)
1604020c5bcSThomas-Henning von Kamptz 				usage();
1613d500078SThomas-Henning von Kamptz 			break;
1623d500078SThomas-Henning von Kamptz 		case 'o':
1633d500078SThomas-Henning von Kamptz 			free(out_file);
1643d500078SThomas-Henning von Kamptz 			out_file = strdup(optarg);
16589f0730dSBrian Somers 			if (out_file == NULL)
1664020c5bcSThomas-Henning von Kamptz 				errx(1, "strdup failed");
1673d500078SThomas-Henning von Kamptz 			break;
1683d500078SThomas-Henning von Kamptz 		case '?':
1693d500078SThomas-Henning von Kamptz 			/* FALLTHROUGH */
1703d500078SThomas-Henning von Kamptz 		default:
1714020c5bcSThomas-Henning von Kamptz 			usage();
1723d500078SThomas-Henning von Kamptz 		}
1733d500078SThomas-Henning von Kamptz 	}
1743d500078SThomas-Henning von Kamptz 	argc -= optind;
1753d500078SThomas-Henning von Kamptz 	argv += optind;
1763d500078SThomas-Henning von Kamptz 
17789f0730dSBrian Somers 	if (argc != 1)
1784020c5bcSThomas-Henning von Kamptz 		usage();
1793d500078SThomas-Henning von Kamptz 	device = *argv;
1803d500078SThomas-Henning von Kamptz 
1813d500078SThomas-Henning von Kamptz 	/*
1823d500078SThomas-Henning von Kamptz 	 * Now we try to guess the (raw)device name.
1833d500078SThomas-Henning von Kamptz 	 */
18489f0730dSBrian Somers 	if (0 == strrchr(device, '/') && stat(device, &st) == -1) {
18589f0730dSBrian Somers 		/*-
18689f0730dSBrian Somers 		 * No path prefix was given, so try in this order:
1873d500078SThomas-Henning von Kamptz 		 *     /dev/r%s
1883d500078SThomas-Henning von Kamptz 		 *     /dev/%s
1893d500078SThomas-Henning von Kamptz 		 *
1903d500078SThomas-Henning von Kamptz 		 * FreeBSD now doesn't distinguish between raw and block
1913d500078SThomas-Henning von Kamptz 		 * devices any longer, but it should still work this way.
1923d500078SThomas-Henning von Kamptz 		 */
193*71974712SJohn Baldwin 		len = strlen(device) + strlen(_PATH_DEV) + 2;
1943d500078SThomas-Henning von Kamptz 		special = (char *)malloc(len);
19589f0730dSBrian Somers 		if (special == NULL)
1964020c5bcSThomas-Henning von Kamptz 			errx(1, "malloc failed");
1973d500078SThomas-Henning von Kamptz 		snprintf(special, len, "%sr%s", _PATH_DEV, device);
1983d500078SThomas-Henning von Kamptz 		if (stat(special, &st) == -1) {
19989f0730dSBrian Somers 			/* For now this is the 'last resort' */
200*71974712SJohn Baldwin 			snprintf(special, len, "%s%s", _PATH_DEV, device);
2013d500078SThomas-Henning von Kamptz 		}
2023d500078SThomas-Henning von Kamptz 		device = special;
2033d500078SThomas-Henning von Kamptz 	}
2043d500078SThomas-Henning von Kamptz 
205e6886616SKirk McKusick 	if (ufs_disk_fillout_blank(&disk, device) == -1 ||
206e6886616SKirk McKusick 	    sbfind(&disk, 0) == -1)
207e6886616SKirk McKusick 		err(1, "superblock fetch(%s) failed: %s", device, disk.d_error);
2083d500078SThomas-Henning von Kamptz 
2093d500078SThomas-Henning von Kamptz 	DBG_OPEN(out_file);	/* already here we need a superblock */
2103d500078SThomas-Henning von Kamptz 
21189f0730dSBrian Somers 	if (cfg_lv & 0x001)
21289f0730dSBrian Somers 		DBG_DUMP_FS(&sblock, "primary sblock");
2133d500078SThomas-Henning von Kamptz 
21489f0730dSBrian Somers 	/* Determine here what cylinder groups to dump */
2153d500078SThomas-Henning von Kamptz 	if (cfg_cg==-2) {
2163d500078SThomas-Henning von Kamptz 		cg_start = 0;
2173d500078SThomas-Henning von Kamptz 		cg_stop = sblock.fs_ncg;
2183d500078SThomas-Henning von Kamptz 	} else if (cfg_cg == -1) {
2193d500078SThomas-Henning von Kamptz 		cg_start = sblock.fs_ncg - 1;
2203d500078SThomas-Henning von Kamptz 		cg_stop = sblock.fs_ncg;
2213d500078SThomas-Henning von Kamptz 	} else if (cfg_cg < sblock.fs_ncg) {
2223d500078SThomas-Henning von Kamptz 		cg_start = cfg_cg;
2233d500078SThomas-Henning von Kamptz 		cg_stop = cfg_cg + 1;
2243d500078SThomas-Henning von Kamptz 	} else {
2253d500078SThomas-Henning von Kamptz 		cg_start = sblock.fs_ncg;
2263d500078SThomas-Henning von Kamptz 		cg_stop = sblock.fs_ncg;
2273d500078SThomas-Henning von Kamptz 	}
2283d500078SThomas-Henning von Kamptz 
2293d500078SThomas-Henning von Kamptz 	if (cfg_lv & 0x004) {
230adcaff07SThomas-Henning von Kamptz 		fscs = (struct csum *)calloc((size_t)1,
231adcaff07SThomas-Henning von Kamptz 		    (size_t)sblock.fs_cssize);
23289f0730dSBrian Somers 		if (fscs == NULL)
2334020c5bcSThomas-Henning von Kamptz 			errx(1, "calloc failed");
2343d500078SThomas-Henning von Kamptz 
23589f0730dSBrian Somers 		/* get the cylinder summary into the memory ... */
2363d500078SThomas-Henning von Kamptz 		for (i = 0; i < sblock.fs_cssize; i += sblock.fs_bsize) {
23789f0730dSBrian Somers 			if (bread(&disk, fsbtodb(&sblock,
23889f0730dSBrian Somers 			    sblock.fs_csaddr + numfrags(&sblock, i)),
239942d2e02SRobert Watson 			    (void *)(((char *)fscs)+i),
24089f0730dSBrian Somers 			    (size_t)(sblock.fs_cssize-i < sblock.fs_bsize ?
24189f0730dSBrian Somers 			    sblock.fs_cssize - i : sblock.fs_bsize)) == -1)
242942d2e02SRobert Watson 				err(1, "bread: %s", disk.d_error);
243942d2e02SRobert Watson 		}
2443d500078SThomas-Henning von Kamptz 
2453d500078SThomas-Henning von Kamptz 		dbg_csp = fscs;
24689f0730dSBrian Somers 		/* ... and dump it */
2473d500078SThomas-Henning von Kamptz 		for (dbg_csc = 0; dbg_csc < sblock.fs_ncg; dbg_csc++) {
248adcaff07SThomas-Henning von Kamptz 			snprintf(dbg_line, sizeof(dbg_line),
249adcaff07SThomas-Henning von Kamptz 			    "%d. csum in fscs", dbg_csc);
2504020c5bcSThomas-Henning von Kamptz 			DBG_DUMP_CSUM(&sblock,
2514020c5bcSThomas-Henning von Kamptz 			    dbg_line,
2524020c5bcSThomas-Henning von Kamptz 			    dbg_csp++);
2533d500078SThomas-Henning von Kamptz 		}
2543d500078SThomas-Henning von Kamptz 	}
2553d500078SThomas-Henning von Kamptz 
25630e3c0faSBrian Somers 	if (cfg_lv & 0xf8) {
25789f0730dSBrian Somers 		/* for each requested cylinder group ... */
2583d500078SThomas-Henning von Kamptz 		for (cylno = cg_start; cylno < cg_stop; cylno++) {
259adcaff07SThomas-Henning von Kamptz 			snprintf(dbg_line, sizeof(dbg_line), "cgr %d", cylno);
2603d500078SThomas-Henning von Kamptz 			if (cfg_lv & 0x002) {
26189f0730dSBrian Somers 				/* dump the superblock copies */
26289f0730dSBrian Somers 				if (bread(&disk, fsbtodb(&sblock,
26389f0730dSBrian Somers 				    cgsblock(&sblock, cylno)),
26489f0730dSBrian Somers 				    (void *)&osblock, SBLOCKSIZE) == -1)
265942d2e02SRobert Watson 					err(1, "bread: %s", disk.d_error);
26689f0730dSBrian Somers 				DBG_DUMP_FS(&osblock, dbg_line);
267942d2e02SRobert Watson 			}
26889f0730dSBrian Somers 
2693d500078SThomas-Henning von Kamptz 			/*
27089f0730dSBrian Somers 			 * Read the cylinder group and dump whatever was
27189f0730dSBrian Somers 			 * requested.
2723d500078SThomas-Henning von Kamptz 			 */
27389f0730dSBrian Somers 			if (bread(&disk, fsbtodb(&sblock,
27489f0730dSBrian Somers 			    cgtod(&sblock, cylno)), (void *)&acg,
27589f0730dSBrian Somers 			    (size_t)sblock.fs_cgsize) == -1)
276942d2e02SRobert Watson 				err(1, "bread: %s", disk.d_error);
27789f0730dSBrian Somers 
27889f0730dSBrian Somers 			if (cfg_lv & 0x008)
27989f0730dSBrian Somers 				DBG_DUMP_CG(&sblock, dbg_line, &acg);
28089f0730dSBrian Somers 			if (cfg_lv & 0x010)
28189f0730dSBrian Somers 				DBG_DUMP_INMAP(&sblock, dbg_line, &acg);
28289f0730dSBrian Somers 			if (cfg_lv & 0x020)
28389f0730dSBrian Somers 				DBG_DUMP_FRMAP(&sblock, dbg_line, &acg);
2843d500078SThomas-Henning von Kamptz 			if (cfg_lv & 0x040) {
28589f0730dSBrian Somers 				DBG_DUMP_CLMAP(&sblock, dbg_line, &acg);
28689f0730dSBrian Somers 				DBG_DUMP_CLSUM(&sblock, dbg_line, &acg);
2873d500078SThomas-Henning von Kamptz 			}
288942d2e02SRobert Watson 	#ifdef NOT_CURRENTLY
289942d2e02SRobert Watson 			/*
290942d2e02SRobert Watson 			 * See the comment in sbin/growfs/debug.c for why this
291942d2e02SRobert Watson 			 * is currently disabled, and what needs to be done to
292942d2e02SRobert Watson 			 * re-enable it.
293942d2e02SRobert Watson 			 */
29489f0730dSBrian Somers 			if (disk.d_ufs == 1 && cfg_lv & 0x080)
29589f0730dSBrian Somers 				DBG_DUMP_SPTBL(&sblock, dbg_line, &acg);
296942d2e02SRobert Watson 	#endif
2973d500078SThomas-Henning von Kamptz 		}
29830e3c0faSBrian Somers 	}
29989f0730dSBrian Somers 
30030e3c0faSBrian Somers 	if (cfg_lv & 0x300) {
30189f0730dSBrian Somers 		/* Dump the requested inode(s) */
30289f0730dSBrian Somers 		if (cfg_in != -2)
303942d2e02SRobert Watson 			DUMP_WHOLE_INODE((ino_t)cfg_in, cfg_lv);
30489f0730dSBrian Somers 		else {
30589f0730dSBrian Somers 			for (in = cg_start * sblock.fs_ipg;
30689f0730dSBrian Somers 			    in < (ino_t)cg_stop * sblock.fs_ipg;
30789f0730dSBrian Somers 			    in++)
308942d2e02SRobert Watson 				DUMP_WHOLE_INODE(in, cfg_lv);
3093d500078SThomas-Henning von Kamptz 		}
31030e3c0faSBrian Somers 	}
3113d500078SThomas-Henning von Kamptz 
3123d500078SThomas-Henning von Kamptz 	DBG_CLOSE;
3133d500078SThomas-Henning von Kamptz 	DBG_LEAVE;
31489f0730dSBrian Somers 
3153d500078SThomas-Henning von Kamptz 	return 0;
3163d500078SThomas-Henning von Kamptz }
3173d500078SThomas-Henning von Kamptz 
318942d2e02SRobert Watson /* ********************************************** dump_whole_ufs1_inode ***** */
3193d500078SThomas-Henning von Kamptz /*
3203d500078SThomas-Henning von Kamptz  * Here we dump a list of all blocks allocated by this inode. We follow
3213d500078SThomas-Henning von Kamptz  * all indirect blocks.
3223d500078SThomas-Henning von Kamptz  */
3233d500078SThomas-Henning von Kamptz void
dump_whole_ufs1_inode(ino_t inode,int level)324942d2e02SRobert Watson dump_whole_ufs1_inode(ino_t inode, int level)
3253d500078SThomas-Henning von Kamptz {
326942d2e02SRobert Watson 	DBG_FUNC("dump_whole_ufs1_inode")
3279fc5d538SKirk McKusick 	union dinodep dp;
3289fc5d538SKirk McKusick 	int	rb;
3293d500078SThomas-Henning von Kamptz 	unsigned int	ind2ctr, ind3ctr;
330942d2e02SRobert Watson 	ufs1_daddr_t	*ind2ptr, *ind3ptr;
3313d500078SThomas-Henning von Kamptz 	char	comment[80];
3323d500078SThomas-Henning von Kamptz 
3333d500078SThomas-Henning von Kamptz 	DBG_ENTER;
3343d500078SThomas-Henning von Kamptz 
3353d500078SThomas-Henning von Kamptz 	/*
3363d500078SThomas-Henning von Kamptz 	 * Read the inode from disk/cache.
3373d500078SThomas-Henning von Kamptz 	 */
3389fc5d538SKirk McKusick 	if (getinode(&disk, &dp, inode) == -1)
3399fc5d538SKirk McKusick 		err(1, "getinode: %s", disk.d_error);
3403d500078SThomas-Henning von Kamptz 
3419fc5d538SKirk McKusick 	if (dp.dp1->di_nlink == 0) {
3423d500078SThomas-Henning von Kamptz 		DBG_LEAVE;
3433d500078SThomas-Henning von Kamptz 		return;	/* inode not in use */
3443d500078SThomas-Henning von Kamptz 	}
3453d500078SThomas-Henning von Kamptz 
3463d500078SThomas-Henning von Kamptz 	/*
3473d500078SThomas-Henning von Kamptz 	 * Dump the main inode structure.
3483d500078SThomas-Henning von Kamptz 	 */
3499b337054SGleb Kurtsou 	snprintf(comment, sizeof(comment), "Inode 0x%08jx", (uintmax_t)inode);
3503d500078SThomas-Henning von Kamptz 	if (level & 0x100) {
3514020c5bcSThomas-Henning von Kamptz 		DBG_DUMP_INO(&sblock,
3524020c5bcSThomas-Henning von Kamptz 		    comment,
3539fc5d538SKirk McKusick 		    dp.dp1);
3543d500078SThomas-Henning von Kamptz 	}
3553d500078SThomas-Henning von Kamptz 
3563d500078SThomas-Henning von Kamptz 	if (!(level & 0x200)) {
3573d500078SThomas-Henning von Kamptz 		DBG_LEAVE;
3583d500078SThomas-Henning von Kamptz 		return;
3593d500078SThomas-Henning von Kamptz 	}
3603d500078SThomas-Henning von Kamptz 
3613d500078SThomas-Henning von Kamptz 	/*
3623d500078SThomas-Henning von Kamptz 	 * Ok, now prepare for dumping all direct and indirect pointers.
3633d500078SThomas-Henning von Kamptz 	 */
3649fc5d538SKirk McKusick 	rb = howmany(dp.dp1->di_size, sblock.fs_bsize) - UFS_NDADDR;
3653d500078SThomas-Henning von Kamptz 	if (rb > 0) {
3663d500078SThomas-Henning von Kamptz 		/*
3673d500078SThomas-Henning von Kamptz 		 * Dump single indirect block.
3683d500078SThomas-Henning von Kamptz 		 */
3699fc5d538SKirk McKusick 		if (bread(&disk, fsbtodb(&sblock, dp.dp1->di_ib[0]),
3709fc5d538SKirk McKusick 		    (void *)&i1blk, (size_t)sblock.fs_bsize) == -1) {
371942d2e02SRobert Watson 			err(1, "bread: %s", disk.d_error);
372942d2e02SRobert Watson 		}
3739b337054SGleb Kurtsou 		snprintf(comment, sizeof(comment), "Inode 0x%08jx: indirect 0",
3749b337054SGleb Kurtsou 		    (uintmax_t)inode);
3754020c5bcSThomas-Henning von Kamptz 		DBG_DUMP_IBLK(&sblock,
3764020c5bcSThomas-Henning von Kamptz 		    comment,
3774020c5bcSThomas-Henning von Kamptz 		    i1blk,
3784020c5bcSThomas-Henning von Kamptz 		    (size_t)rb);
379942d2e02SRobert Watson 		rb -= howmany(sblock.fs_bsize, sizeof(ufs1_daddr_t));
3803d500078SThomas-Henning von Kamptz 	}
3813d500078SThomas-Henning von Kamptz 	if (rb > 0) {
3823d500078SThomas-Henning von Kamptz 		/*
3833d500078SThomas-Henning von Kamptz 		 * Dump double indirect blocks.
3843d500078SThomas-Henning von Kamptz 		 */
3859fc5d538SKirk McKusick 		if (bread(&disk, fsbtodb(&sblock, dp.dp1->di_ib[1]),
3869fc5d538SKirk McKusick 		    (void *)&i2blk, (size_t)sblock.fs_bsize) == -1) {
387942d2e02SRobert Watson 			err(1, "bread: %s", disk.d_error);
388942d2e02SRobert Watson 		}
3899b337054SGleb Kurtsou 		snprintf(comment, sizeof(comment), "Inode 0x%08jx: indirect 1",
3909b337054SGleb Kurtsou 		    (uintmax_t)inode);
3914020c5bcSThomas-Henning von Kamptz 		DBG_DUMP_IBLK(&sblock,
3924020c5bcSThomas-Henning von Kamptz 		    comment,
3934020c5bcSThomas-Henning von Kamptz 		    i2blk,
394942d2e02SRobert Watson 		    howmany(rb, howmany(sblock.fs_bsize, sizeof(ufs1_daddr_t))));
3953d500078SThomas-Henning von Kamptz 		for (ind2ctr = 0; ((ind2ctr < howmany(sblock.fs_bsize,
396942d2e02SRobert Watson 			sizeof(ufs1_daddr_t))) && (rb > 0)); ind2ctr++) {
397942d2e02SRobert Watson 			ind2ptr = &((ufs1_daddr_t *)(void *)&i2blk)[ind2ctr];
3983d500078SThomas-Henning von Kamptz 
3999fc5d538SKirk McKusick 			if (bread(&disk, fsbtodb(&sblock, *ind2ptr),
4009fc5d538SKirk McKusick 			    (void *)&i1blk, (size_t)sblock.fs_bsize) == -1) {
401942d2e02SRobert Watson 				err(1, "bread: %s", disk.d_error);
402942d2e02SRobert Watson 			}
403adcaff07SThomas-Henning von Kamptz 			snprintf(comment, sizeof(comment),
4049b337054SGleb Kurtsou 			    "Inode 0x%08jx: indirect 1->%d", (uintmax_t)inode,
4059b337054SGleb Kurtsou 			    ind2ctr);
4064020c5bcSThomas-Henning von Kamptz 			DBG_DUMP_IBLK(&sblock,
4074020c5bcSThomas-Henning von Kamptz 			    comment,
4084020c5bcSThomas-Henning von Kamptz 			    i1blk,
4094020c5bcSThomas-Henning von Kamptz 			    (size_t)rb);
410942d2e02SRobert Watson 			rb -= howmany(sblock.fs_bsize, sizeof(ufs1_daddr_t));
4113d500078SThomas-Henning von Kamptz 		}
4123d500078SThomas-Henning von Kamptz 	}
4133d500078SThomas-Henning von Kamptz 	if (rb > 0) {
4143d500078SThomas-Henning von Kamptz 		/*
4153d500078SThomas-Henning von Kamptz 		 * Dump triple indirect blocks.
4163d500078SThomas-Henning von Kamptz 		 */
4179fc5d538SKirk McKusick 		if (bread(&disk, fsbtodb(&sblock, dp.dp1->di_ib[2]),
4189fc5d538SKirk McKusick 		    (void *)&i3blk, (size_t)sblock.fs_bsize) == -1) {
419942d2e02SRobert Watson 			err(1, "bread: %s", disk.d_error);
420942d2e02SRobert Watson 		}
4219b337054SGleb Kurtsou 		snprintf(comment, sizeof(comment), "Inode 0x%08jx: indirect 2",
4229b337054SGleb Kurtsou 		    (uintmax_t)inode);
4233d500078SThomas-Henning von Kamptz #define SQUARE(a) ((a)*(a))
4244020c5bcSThomas-Henning von Kamptz 		DBG_DUMP_IBLK(&sblock,
4254020c5bcSThomas-Henning von Kamptz 		    comment,
4264020c5bcSThomas-Henning von Kamptz 		    i3blk,
4274020c5bcSThomas-Henning von Kamptz 		    howmany(rb,
428942d2e02SRobert Watson 		      SQUARE(howmany(sblock.fs_bsize, sizeof(ufs1_daddr_t)))));
4293d500078SThomas-Henning von Kamptz #undef SQUARE
4303d500078SThomas-Henning von Kamptz 		for (ind3ctr = 0; ((ind3ctr < howmany(sblock.fs_bsize,
431942d2e02SRobert Watson 			sizeof(ufs1_daddr_t))) && (rb > 0)); ind3ctr++) {
432942d2e02SRobert Watson 			ind3ptr = &((ufs1_daddr_t *)(void *)&i3blk)[ind3ctr];
4333d500078SThomas-Henning von Kamptz 
4349fc5d538SKirk McKusick 			if (bread(&disk, fsbtodb(&sblock, *ind3ptr),
4359fc5d538SKirk McKusick 			    (void *)&i2blk, (size_t)sblock.fs_bsize) == -1) {
436942d2e02SRobert Watson 				err(1, "bread: %s", disk.d_error);
437942d2e02SRobert Watson 			}
438adcaff07SThomas-Henning von Kamptz 			snprintf(comment, sizeof(comment),
4399b337054SGleb Kurtsou 			    "Inode 0x%08jx: indirect 2->%d", (uintmax_t)inode,
4409b337054SGleb Kurtsou 			    ind3ctr);
4414020c5bcSThomas-Henning von Kamptz 			DBG_DUMP_IBLK(&sblock,
4424020c5bcSThomas-Henning von Kamptz 			    comment,
4434020c5bcSThomas-Henning von Kamptz 			    i2blk,
4444020c5bcSThomas-Henning von Kamptz 			    howmany(rb,
445942d2e02SRobert Watson 			      howmany(sblock.fs_bsize, sizeof(ufs1_daddr_t))));
4463d500078SThomas-Henning von Kamptz 			for (ind2ctr = 0; ((ind2ctr < howmany(sblock.fs_bsize,
447942d2e02SRobert Watson 			     sizeof(ufs1_daddr_t))) && (rb > 0)); ind2ctr++) {
448942d2e02SRobert Watson 				ind2ptr=&((ufs1_daddr_t *)(void *)&i2blk)
449adcaff07SThomas-Henning von Kamptz 				    [ind2ctr];
450942d2e02SRobert Watson 				if (bread(&disk, fsbtodb(&sblock, *ind2ptr),
451942d2e02SRobert Watson 				    (void *)&i1blk, (size_t)sblock.fs_bsize)
452942d2e02SRobert Watson 				    == -1) {
453942d2e02SRobert Watson 					err(1, "bread: %s", disk.d_error);
454942d2e02SRobert Watson 				}
455adcaff07SThomas-Henning von Kamptz 				snprintf(comment, sizeof(comment),
4569b337054SGleb Kurtsou 				    "Inode 0x%08jx: indirect 2->%d->%d",
4579b337054SGleb Kurtsou 				    (uintmax_t)inode, ind3ctr, ind3ctr);
4584020c5bcSThomas-Henning von Kamptz 				DBG_DUMP_IBLK(&sblock,
4594020c5bcSThomas-Henning von Kamptz 				    comment,
4604020c5bcSThomas-Henning von Kamptz 				    i1blk,
4614020c5bcSThomas-Henning von Kamptz 				    (size_t)rb);
4623d500078SThomas-Henning von Kamptz 				rb -= howmany(sblock.fs_bsize,
463942d2e02SRobert Watson 				    sizeof(ufs1_daddr_t));
4643d500078SThomas-Henning von Kamptz 			}
4653d500078SThomas-Henning von Kamptz 		}
4663d500078SThomas-Henning von Kamptz 	}
4673d500078SThomas-Henning von Kamptz 
4683d500078SThomas-Henning von Kamptz 	DBG_LEAVE;
4693d500078SThomas-Henning von Kamptz 	return;
4703d500078SThomas-Henning von Kamptz }
4713d500078SThomas-Henning von Kamptz 
472942d2e02SRobert Watson /* ********************************************** dump_whole_ufs2_inode ***** */
4733d500078SThomas-Henning von Kamptz /*
474942d2e02SRobert Watson  * Here we dump a list of all blocks allocated by this inode. We follow
475942d2e02SRobert Watson  * all indirect blocks.
4763d500078SThomas-Henning von Kamptz  */
477942d2e02SRobert Watson void
dump_whole_ufs2_inode(ino_t inode,int level)478942d2e02SRobert Watson dump_whole_ufs2_inode(ino_t inode, int level)
4793d500078SThomas-Henning von Kamptz {
480942d2e02SRobert Watson 	DBG_FUNC("dump_whole_ufs2_inode")
4819fc5d538SKirk McKusick 	union dinodep dp;
4829fc5d538SKirk McKusick 	int	rb;
483942d2e02SRobert Watson 	unsigned int	ind2ctr, ind3ctr;
484942d2e02SRobert Watson 	ufs2_daddr_t	*ind2ptr, *ind3ptr;
485942d2e02SRobert Watson 	char	comment[80];
4863d500078SThomas-Henning von Kamptz 
4873d500078SThomas-Henning von Kamptz 	DBG_ENTER;
4883d500078SThomas-Henning von Kamptz 
489942d2e02SRobert Watson 	/*
490942d2e02SRobert Watson 	 * Read the inode from disk/cache.
491942d2e02SRobert Watson 	 */
4929fc5d538SKirk McKusick 	if (getinode(&disk, &dp, inode) == -1)
4939fc5d538SKirk McKusick 		err(1, "getinode: %s", disk.d_error);
494942d2e02SRobert Watson 
4959fc5d538SKirk McKusick 	if (dp.dp2->di_nlink == 0) {
496942d2e02SRobert Watson 		DBG_LEAVE;
497942d2e02SRobert Watson 		return;	/* inode not in use */
4983d500078SThomas-Henning von Kamptz 	}
499942d2e02SRobert Watson 
500942d2e02SRobert Watson 	/*
501942d2e02SRobert Watson 	 * Dump the main inode structure.
502942d2e02SRobert Watson 	 */
5039b337054SGleb Kurtsou 	snprintf(comment, sizeof(comment), "Inode 0x%08jx", (uintmax_t)inode);
504942d2e02SRobert Watson 	if (level & 0x100) {
5059fc5d538SKirk McKusick 		DBG_DUMP_INO(&sblock, comment, dp.dp2);
506942d2e02SRobert Watson 	}
507942d2e02SRobert Watson 
508942d2e02SRobert Watson 	if (!(level & 0x200)) {
509942d2e02SRobert Watson 		DBG_LEAVE;
510942d2e02SRobert Watson 		return;
511942d2e02SRobert Watson 	}
512942d2e02SRobert Watson 
513942d2e02SRobert Watson 	/*
514942d2e02SRobert Watson 	 * Ok, now prepare for dumping all direct and indirect pointers.
515942d2e02SRobert Watson 	 */
5169fc5d538SKirk McKusick 	rb = howmany(dp.dp2->di_size, sblock.fs_bsize) - UFS_NDADDR;
517942d2e02SRobert Watson 	if (rb > 0) {
518942d2e02SRobert Watson 		/*
519942d2e02SRobert Watson 		 * Dump single indirect block.
520942d2e02SRobert Watson 		 */
5219fc5d538SKirk McKusick 		if (bread(&disk, fsbtodb(&sblock, dp.dp2->di_ib[0]),
5229fc5d538SKirk McKusick 		    (void *)&i1blk, (size_t)sblock.fs_bsize) == -1) {
523942d2e02SRobert Watson 			err(1, "bread: %s", disk.d_error);
524942d2e02SRobert Watson 		}
5259b337054SGleb Kurtsou 		snprintf(comment, sizeof(comment), "Inode 0x%08jx: indirect 0",
5269b337054SGleb Kurtsou 		    (uintmax_t)inode);
527942d2e02SRobert Watson 		DBG_DUMP_IBLK(&sblock, comment, i1blk, (size_t)rb);
528942d2e02SRobert Watson 		rb -= howmany(sblock.fs_bsize, sizeof(ufs2_daddr_t));
529942d2e02SRobert Watson 	}
530942d2e02SRobert Watson 	if (rb > 0) {
531942d2e02SRobert Watson 		/*
532942d2e02SRobert Watson 		 * Dump double indirect blocks.
533942d2e02SRobert Watson 		 */
5349fc5d538SKirk McKusick 		if (bread(&disk, fsbtodb(&sblock, dp.dp2->di_ib[1]),
5359fc5d538SKirk McKusick 		    (void *)&i2blk, (size_t)sblock.fs_bsize) == -1) {
536942d2e02SRobert Watson 			err(1, "bread: %s", disk.d_error);
537942d2e02SRobert Watson 		}
5389b337054SGleb Kurtsou 		snprintf(comment, sizeof(comment), "Inode 0x%08jx: indirect 1",
5399b337054SGleb Kurtsou 		    (uintmax_t)inode);
540942d2e02SRobert Watson 		DBG_DUMP_IBLK(&sblock,
541942d2e02SRobert Watson 			comment,
542942d2e02SRobert Watson 			i2blk,
543942d2e02SRobert Watson 			howmany(rb, howmany(sblock.fs_bsize, sizeof(ufs2_daddr_t))));
544942d2e02SRobert Watson 		for (ind2ctr = 0; ((ind2ctr < howmany(sblock.fs_bsize,
545942d2e02SRobert Watson 			sizeof(ufs2_daddr_t))) && (rb>0)); ind2ctr++) {
546942d2e02SRobert Watson 			ind2ptr = &((ufs2_daddr_t *)(void *)&i2blk)[ind2ctr];
547942d2e02SRobert Watson 
5489fc5d538SKirk McKusick 			if (bread(&disk, fsbtodb(&sblock, *ind2ptr),
5499fc5d538SKirk McKusick 			    (void *)&i1blk, (size_t)sblock.fs_bsize) == -1) {
550942d2e02SRobert Watson 				err(1, "bread: %s", disk.d_error);
551942d2e02SRobert Watson 			}
552942d2e02SRobert Watson 			snprintf(comment, sizeof(comment),
5539b337054SGleb Kurtsou 				"Inode 0x%08jx: indirect 1->%d",
5549b337054SGleb Kurtsou 				(uintmax_t)inode, ind2ctr);
555942d2e02SRobert Watson 			DBG_DUMP_IBLK(&sblock, comment, i1blk, (size_t)rb);
556942d2e02SRobert Watson 			rb -= howmany(sblock.fs_bsize, sizeof(ufs2_daddr_t));
557942d2e02SRobert Watson 		}
558942d2e02SRobert Watson 	}
559942d2e02SRobert Watson 	if (rb > 0) {
560942d2e02SRobert Watson 		/*
561942d2e02SRobert Watson 		 * Dump triple indirect blocks.
562942d2e02SRobert Watson 		 */
5639fc5d538SKirk McKusick 		if (bread(&disk, fsbtodb(&sblock, dp.dp2->di_ib[2]),
5649fc5d538SKirk McKusick 		    (void *)&i3blk, (size_t)sblock.fs_bsize) == -1) {
565942d2e02SRobert Watson 			err(1, "bread: %s", disk.d_error);
566942d2e02SRobert Watson 		}
5679b337054SGleb Kurtsou 		snprintf(comment, sizeof(comment), "Inode 0x%08jx: indirect 2",
5689b337054SGleb Kurtsou 		    (uintmax_t)inode);
569942d2e02SRobert Watson #define SQUARE(a) ((a)*(a))
570942d2e02SRobert Watson 		DBG_DUMP_IBLK(&sblock,
571942d2e02SRobert Watson 			comment,
572942d2e02SRobert Watson 			i3blk,
573942d2e02SRobert Watson 			howmany(rb,
574942d2e02SRobert Watson 				SQUARE(howmany(sblock.fs_bsize, sizeof(ufs2_daddr_t)))));
575942d2e02SRobert Watson #undef SQUARE
576942d2e02SRobert Watson 		for (ind3ctr = 0; ((ind3ctr < howmany(sblock.fs_bsize,
577942d2e02SRobert Watson 			sizeof(ufs2_daddr_t))) && (rb > 0)); ind3ctr++) {
578942d2e02SRobert Watson 			ind3ptr = &((ufs2_daddr_t *)(void *)&i3blk)[ind3ctr];
579942d2e02SRobert Watson 
5809fc5d538SKirk McKusick 			if (bread(&disk, fsbtodb(&sblock, *ind3ptr),
5819fc5d538SKirk McKusick 			    (void *)&i2blk, (size_t)sblock.fs_bsize) == -1) {
582942d2e02SRobert Watson 				err(1, "bread: %s", disk.d_error);
583942d2e02SRobert Watson 			}
584942d2e02SRobert Watson 			snprintf(comment, sizeof(comment),
5859b337054SGleb Kurtsou 				"Inode 0x%08jx: indirect 2->%d",
5869b337054SGleb Kurtsou 				(uintmax_t)inode, ind3ctr);
587942d2e02SRobert Watson 			DBG_DUMP_IBLK(&sblock,
588942d2e02SRobert Watson 				comment,
589942d2e02SRobert Watson 				i2blk,
590942d2e02SRobert Watson 				howmany(rb,
591942d2e02SRobert Watson 					howmany(sblock.fs_bsize, sizeof(ufs2_daddr_t))));
592942d2e02SRobert Watson 			for (ind2ctr = 0; ((ind2ctr < howmany(sblock.fs_bsize,
593942d2e02SRobert Watson 				sizeof(ufs2_daddr_t))) && (rb > 0)); ind2ctr++) {
594942d2e02SRobert Watson 				ind2ptr = &((ufs2_daddr_t *)(void *)&i2blk) [ind2ctr];
5959fc5d538SKirk McKusick 				if (bread(&disk, fsbtodb(&sblock, *ind2ptr),
5969fc5d538SKirk McKusick 				    (void *)&i1blk, (size_t)sblock.fs_bsize)
5979fc5d538SKirk McKusick 				    == -1) {
598942d2e02SRobert Watson 					err(1, "bread: %s", disk.d_error);
599942d2e02SRobert Watson 				}
600942d2e02SRobert Watson 				snprintf(comment, sizeof(comment),
6019b337054SGleb Kurtsou 					"Inode 0x%08jx: indirect 2->%d->%d",
6029b337054SGleb Kurtsou 					(uintmax_t)inode, ind3ctr, ind3ctr);
603942d2e02SRobert Watson 				DBG_DUMP_IBLK(&sblock, comment, i1blk, (size_t)rb);
604942d2e02SRobert Watson 				rb -= howmany(sblock.fs_bsize, sizeof(ufs2_daddr_t));
605942d2e02SRobert Watson 			}
606942d2e02SRobert Watson 		}
6073d500078SThomas-Henning von Kamptz 	}
6083d500078SThomas-Henning von Kamptz 
6093d500078SThomas-Henning von Kamptz 	DBG_LEAVE;
610942d2e02SRobert Watson 	return;
6113d500078SThomas-Henning von Kamptz }
6123d500078SThomas-Henning von Kamptz 
6133d500078SThomas-Henning von Kamptz /* ************************************************************* usage ***** */
6143d500078SThomas-Henning von Kamptz /*
6153d500078SThomas-Henning von Kamptz  * Dump a line of usage.
6163d500078SThomas-Henning von Kamptz  */
6173d500078SThomas-Henning von Kamptz void
usage(void)6184020c5bcSThomas-Henning von Kamptz usage(void)
6193d500078SThomas-Henning von Kamptz {
6203d500078SThomas-Henning von Kamptz 	DBG_FUNC("usage")
6213d500078SThomas-Henning von Kamptz 
6223d500078SThomas-Henning von Kamptz 	DBG_ENTER;
6233d500078SThomas-Henning von Kamptz 
6243d500078SThomas-Henning von Kamptz 	fprintf(stderr,
6258d646af5SRuslan Ermilov 	    "usage: ffsinfo [-g cylinder_group] [-i inode] [-l level] "
6264020c5bcSThomas-Henning von Kamptz 	    "[-o outfile]\n"
6274020c5bcSThomas-Henning von Kamptz 	    "               special | file\n");
6283d500078SThomas-Henning von Kamptz 
6293d500078SThomas-Henning von Kamptz 	DBG_LEAVE;
6304020c5bcSThomas-Henning von Kamptz 	exit(1);
6313d500078SThomas-Henning von Kamptz }
632