Home | History | Annotate | Line # | Download | only in dumplfs
dumplfs.c revision 1.21
      1  1.21       mrg /*	$NetBSD: dumplfs.c,v 1.21 2003/01/28 07:44:54 mrg Exp $	*/
      2   1.5       cgd 
      3   1.1   mycroft /*-
      4   1.1   mycroft  * Copyright (c) 1991, 1993
      5   1.1   mycroft  *	The Regents of the University of California.  All rights reserved.
      6   1.1   mycroft  *
      7   1.1   mycroft  * Redistribution and use in source and binary forms, with or without
      8   1.1   mycroft  * modification, are permitted provided that the following conditions
      9   1.1   mycroft  * are met:
     10   1.1   mycroft  * 1. Redistributions of source code must retain the above copyright
     11   1.1   mycroft  *    notice, this list of conditions and the following disclaimer.
     12   1.1   mycroft  * 2. Redistributions in binary form must reproduce the above copyright
     13   1.1   mycroft  *    notice, this list of conditions and the following disclaimer in the
     14   1.1   mycroft  *    documentation and/or other materials provided with the distribution.
     15   1.1   mycroft  * 3. All advertising materials mentioning features or use of this software
     16   1.1   mycroft  *    must display the following acknowledgement:
     17   1.1   mycroft  *	This product includes software developed by the University of
     18   1.1   mycroft  *	California, Berkeley and its contributors.
     19   1.1   mycroft  * 4. Neither the name of the University nor the names of its contributors
     20   1.1   mycroft  *    may be used to endorse or promote products derived from this software
     21   1.1   mycroft  *    without specific prior written permission.
     22   1.1   mycroft  *
     23   1.1   mycroft  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
     24   1.1   mycroft  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     25   1.1   mycroft  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     26   1.1   mycroft  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
     27   1.1   mycroft  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     28   1.1   mycroft  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     29   1.1   mycroft  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     30   1.1   mycroft  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     31   1.1   mycroft  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     32   1.1   mycroft  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     33   1.1   mycroft  * SUCH DAMAGE.
     34   1.1   mycroft  */
     35   1.1   mycroft 
     36   1.8      fvdl #include <sys/cdefs.h>
     37   1.8      fvdl 
     38   1.1   mycroft #ifndef lint
     39   1.8      fvdl __COPYRIGHT(
     40   1.1   mycroft "@(#) Copyright (c) 1991, 1993\n\
     41   1.8      fvdl 	The Regents of the University of California.  All rights reserved.\n");
     42   1.1   mycroft #endif /* not lint */
     43   1.1   mycroft 
     44   1.1   mycroft #ifndef lint
     45   1.5       cgd #if 0
     46   1.8      fvdl static char sccsid[] = "@(#)dumplfs.c	8.5 (Berkeley) 5/24/95";
     47   1.5       cgd #else
     48  1.21       mrg __RCSID("$NetBSD: dumplfs.c,v 1.21 2003/01/28 07:44:54 mrg Exp $");
     49   1.5       cgd #endif
     50   1.1   mycroft #endif /* not lint */
     51   1.1   mycroft 
     52   1.1   mycroft #include <sys/param.h>
     53   1.1   mycroft #include <sys/ucred.h>
     54   1.1   mycroft #include <sys/mount.h>
     55   1.1   mycroft #include <sys/time.h>
     56   1.1   mycroft 
     57   1.1   mycroft #include <ufs/ufs/dinode.h>
     58   1.1   mycroft #include <ufs/lfs/lfs.h>
     59   1.1   mycroft 
     60   1.2   mycroft #include <err.h>
     61   1.2   mycroft #include <errno.h>
     62   1.1   mycroft #include <fcntl.h>
     63   1.1   mycroft #include <fstab.h>
     64   1.1   mycroft #include <stdlib.h>
     65   1.1   mycroft #include <stdio.h>
     66   1.1   mycroft #include <string.h>
     67   1.2   mycroft #include <unistd.h>
     68   1.1   mycroft #include "extern.h"
     69   1.1   mycroft 
     70  1.19  perseant static void	addseg(char *);
     71  1.19  perseant static void	dump_cleaner_info(struct lfs *, void *);
     72  1.19  perseant static void	dump_dinode(struct dinode *);
     73  1.20      fvdl static void	dump_ifile(int, struct lfs *, int, int, daddr_t);
     74  1.19  perseant static int	dump_ipage_ifile(struct lfs *, int, char *, int);
     75  1.19  perseant static int	dump_ipage_segusage(struct lfs *, int, char *, int);
     76  1.19  perseant static void	dump_segment(int, int, daddr_t, struct lfs *, int);
     77  1.19  perseant static int	dump_sum(int, struct lfs *, SEGSUM *, int, daddr_t);
     78  1.19  perseant static void	dump_super(struct lfs *);
     79  1.19  perseant static void	usage(void);
     80   1.1   mycroft 
     81  1.19  perseant extern u_long	cksum(void *, size_t);
     82   1.8      fvdl 
     83   1.1   mycroft typedef struct seglist SEGLIST;
     84   1.1   mycroft struct seglist {
     85   1.1   mycroft         SEGLIST *next;
     86   1.1   mycroft 	int num;
     87   1.1   mycroft };
     88   1.1   mycroft SEGLIST	*seglist;
     89   1.1   mycroft 
     90   1.1   mycroft char *special;
     91   1.1   mycroft 
     92   1.1   mycroft /* Segment Usage formats */
     93   1.1   mycroft #define print_suheader \
     94   1.1   mycroft 	(void)printf("segnum\tflags\tnbytes\tninos\tnsums\tlastmod\n")
     95   1.1   mycroft 
     96  1.19  perseant #define print_suentry(i, sp, fs) 					\
     97  1.19  perseant 	(void)printf("%d\t%c%c%c\t%d\t%d\t%d\t%s", i, 			\
     98  1.19  perseant 	    (((sp)->su_flags & SEGUSE_ACTIVE) ? 'A' : ' '), 		\
     99  1.19  perseant 	    (((sp)->su_flags & SEGUSE_DIRTY) ? 'D' : 'C'), 		\
    100  1.19  perseant 	    (((sp)->su_flags & SEGUSE_SUPERBLOCK) ? 'S' : ' '), 	\
    101  1.19  perseant 	    (sp)->su_nbytes, (sp)->su_ninos, (sp)->su_nsums, 		\
    102  1.19  perseant 	    ((fs)->lfs_version == 1 ? ctime((time_t *)&(sp)->su_olastmod) : \
    103  1.19  perseant 	     ctime((time_t *)&(sp)->su_lastmod)))
    104   1.1   mycroft 
    105   1.1   mycroft /* Ifile formats */
    106   1.1   mycroft #define print_iheader \
    107   1.1   mycroft 	(void)printf("inum\tstatus\tversion\tdaddr\t\tfreeptr\n")
    108   1.1   mycroft #define print_ientry(i, ip) \
    109  1.19  perseant 	if ((ip)->if_daddr == LFS_UNUSED_DADDR) \
    110   1.1   mycroft 		(void)printf("%d\tFREE\t%d\t \t\t%d\n", \
    111  1.19  perseant 		    i, (ip)->if_version, (ip)->if_nextfree); \
    112   1.1   mycroft 	else \
    113   1.1   mycroft 		(void)printf("%d\tINUSE\t%d\t%8X    \n", \
    114  1.19  perseant 		    i, (ip)->if_version, (ip)->if_daddr)
    115  1.19  perseant #define fsbtobyte(fs, b)	fsbtob((fs), (off_t)((b)))
    116  1.16    toshii 
    117   1.1   mycroft int
    118  1.19  perseant main(int argc, char **argv)
    119   1.1   mycroft {
    120   1.1   mycroft 	struct lfs lfs_sb1, lfs_sb2, *lfs_master;
    121  1.14  perseant 	daddr_t seg_addr, idaddr, sbdaddr;
    122  1.19  perseant 	int ch, do_allsb, do_ientries, do_segentries, fd, segnum;
    123   1.1   mycroft 
    124   1.1   mycroft 	do_allsb = 0;
    125   1.1   mycroft 	do_ientries = 0;
    126  1.19  perseant 	do_segentries = 0;
    127  1.14  perseant 	idaddr = 0x0;
    128  1.14  perseant 	sbdaddr = 0x0;
    129  1.19  perseant 	while ((ch = getopt(argc, argv, "ab:iI:Ss:")) != -1)
    130   1.1   mycroft 		switch(ch) {
    131   1.1   mycroft 		case 'a':		/* Dump all superblocks */
    132   1.1   mycroft 			do_allsb = 1;
    133   1.1   mycroft 			break;
    134  1.14  perseant 		case 'b':		/* Use this superblock */
    135  1.14  perseant 			sbdaddr = strtol(optarg, NULL, 0);
    136  1.14  perseant 			break;
    137   1.1   mycroft 		case 'i':		/* Dump ifile entries */
    138  1.19  perseant 			do_ientries = !do_ientries;
    139   1.1   mycroft 			break;
    140  1.14  perseant 		case 'I':		/* Use this ifile inode */
    141  1.14  perseant 			idaddr = strtol(optarg, NULL, 0);
    142  1.14  perseant 			break;
    143  1.19  perseant 		case 'S':
    144  1.19  perseant 			do_segentries = !do_segentries;
    145  1.19  perseant 			break;
    146   1.1   mycroft 		case 's':		/* Dump out these segments */
    147   1.1   mycroft 			addseg(optarg);
    148   1.1   mycroft 			break;
    149   1.1   mycroft 		default:
    150   1.1   mycroft 			usage();
    151   1.1   mycroft 		}
    152   1.1   mycroft 	argc -= optind;
    153   1.1   mycroft 	argv += optind;
    154   1.1   mycroft 
    155   1.1   mycroft 	if (argc != 1)
    156   1.1   mycroft 		usage();
    157   1.1   mycroft 
    158   1.1   mycroft 	special = argv[0];
    159   1.1   mycroft 	if ((fd = open(special, O_RDONLY, 0)) < 0)
    160   1.2   mycroft 		err(1, "%s", special);
    161   1.1   mycroft 
    162  1.14  perseant 	if (sbdaddr == 0x0) {
    163  1.19  perseant 		/* Read the proto-superblock */
    164  1.14  perseant 		get(fd, LFS_LABELPAD, &(lfs_sb1.lfs_dlfs), sizeof(struct dlfs));
    165  1.19  perseant 
    166  1.19  perseant 		/* If that wasn't the real first sb, get the real first sb */
    167  1.19  perseant 		if (lfs_sb1.lfs_version > 1 &&
    168  1.19  perseant 		    lfs_sb1.lfs_sboffs[0] > btofsb(&lfs_sb1, LFS_LABELPAD))
    169  1.19  perseant 			get(fd, fsbtob(&lfs_sb1, lfs_sb1.lfs_sboffs[0]),
    170  1.19  perseant 			    &(lfs_sb1.lfs_dlfs), sizeof(struct dlfs));
    171  1.14  perseant 
    172  1.14  perseant 		/*
    173  1.14  perseant 	 	* Read the second superblock and figure out which check point is
    174  1.14  perseant 	 	* most up to date.
    175  1.14  perseant 	 	*/
    176  1.14  perseant 		get(fd,
    177  1.19  perseant 		    fsbtobyte(&lfs_sb1, lfs_sb1.lfs_sboffs[1]),
    178  1.16    toshii 		    &(lfs_sb2.lfs_dlfs), sizeof(struct dlfs));
    179  1.14  perseant 
    180  1.14  perseant 		lfs_master = &lfs_sb1;
    181  1.19  perseant 		if (lfs_sb1.lfs_version > 1) {
    182  1.19  perseant 			if (lfs_sb1.lfs_serial > lfs_sb2.lfs_serial) {
    183  1.19  perseant 				lfs_master = &lfs_sb2;
    184  1.19  perseant 				sbdaddr = lfs_sb1.lfs_sboffs[1];
    185  1.19  perseant 			} else
    186  1.19  perseant 				sbdaddr = lfs_sb1.lfs_sboffs[0];
    187  1.19  perseant 		} else {
    188  1.19  perseant 			if (lfs_sb1.lfs_otstamp > lfs_sb2.lfs_otstamp) {
    189  1.19  perseant 				lfs_master = &lfs_sb2;
    190  1.19  perseant 				sbdaddr = lfs_sb1.lfs_sboffs[1];
    191  1.19  perseant 			} else
    192  1.19  perseant 				sbdaddr = lfs_sb1.lfs_sboffs[0];
    193  1.19  perseant 		}
    194  1.14  perseant 	} else {
    195  1.14  perseant 		/* Read the first superblock */
    196  1.16    toshii 		get(fd, dbtob((off_t)sbdaddr), &(lfs_sb1.lfs_dlfs),
    197  1.16    toshii 		    sizeof(struct dlfs));
    198  1.14  perseant 		lfs_master = &lfs_sb1;
    199  1.13  perseant 	}
    200   1.1   mycroft 
    201  1.19  perseant 	/* Compatibility */
    202  1.19  perseant 	if (lfs_master->lfs_version == 1) {
    203  1.19  perseant 		lfs_master->lfs_sumsize = LFS_V1_SUMMARY_SIZE;
    204  1.19  perseant 		lfs_master->lfs_ibsize = lfs_master->lfs_bsize;
    205  1.19  perseant 		lfs_master->lfs_start = lfs_master->lfs_sboffs[0];
    206  1.19  perseant 		lfs_master->lfs_tstamp = lfs_master->lfs_otstamp;
    207  1.19  perseant 		lfs_master->lfs_fsbtodb = 0;
    208  1.19  perseant 	}
    209  1.19  perseant 
    210  1.20      fvdl 	(void)printf("Master Superblock at 0x%llx:\n", (long long)sbdaddr);
    211   1.1   mycroft 	dump_super(lfs_master);
    212   1.1   mycroft 
    213  1.19  perseant 	dump_ifile(fd, lfs_master, do_ientries, do_segentries, idaddr);
    214   1.1   mycroft 
    215   1.1   mycroft 	if (seglist != NULL)
    216   1.1   mycroft 		for (; seglist != NULL; seglist = seglist->next) {
    217  1.19  perseant 			seg_addr = sntod(lfs_master, seglist->num);
    218  1.19  perseant 			dump_segment(fd, seglist->num, seg_addr, lfs_master,
    219  1.19  perseant 				     do_allsb);
    220   1.1   mycroft 		}
    221   1.1   mycroft 	else
    222  1.19  perseant 		for (segnum = 0, seg_addr = sntod(lfs_master, 0);
    223  1.19  perseant 		     segnum < lfs_master->lfs_nseg;
    224  1.19  perseant 		     segnum++, seg_addr = sntod(lfs_master, segnum))
    225  1.19  perseant 			dump_segment(fd, segnum, seg_addr, lfs_master,
    226  1.19  perseant 				     do_allsb);
    227   1.1   mycroft 
    228   1.1   mycroft 	(void)close(fd);
    229   1.1   mycroft 	exit(0);
    230   1.1   mycroft }
    231   1.1   mycroft 
    232   1.1   mycroft /*
    233   1.1   mycroft  * We are reading all the blocks of an inode and dumping out the ifile table.
    234   1.1   mycroft  * This code could be tighter, but this is a first pass at getting the stuff
    235   1.1   mycroft  * printed out rather than making this code incredibly efficient.
    236   1.1   mycroft  */
    237   1.1   mycroft static void
    238  1.19  perseant dump_ifile(int fd, struct lfs *lfsp, int do_ientries, int do_segentries, daddr_t addr)
    239   1.1   mycroft {
    240  1.19  perseant 	char *ipage;
    241   1.1   mycroft 	struct dinode *dip, *dpage;
    242  1.20      fvdl 	/* XXX ondisk32 */
    243  1.20      fvdl 	int32_t *addrp, *dindir, *iaddrp, *indir;
    244   1.4       cgd 	int block_limit, i, inum, j, nblocks, psize;
    245   1.1   mycroft 
    246   1.1   mycroft 	psize = lfsp->lfs_bsize;
    247  1.14  perseant 	if (!addr)
    248  1.14  perseant 		addr = lfsp->lfs_idaddr;
    249   1.1   mycroft 
    250   1.1   mycroft 	if (!(dpage = malloc(psize)))
    251   1.2   mycroft 		err(1, "malloc");
    252  1.19  perseant 	get(fd, fsbtobyte(lfsp, addr), dpage, psize);
    253   1.1   mycroft 
    254   1.1   mycroft 	for (dip = dpage + INOPB(lfsp) - 1; dip >= dpage; --dip)
    255   1.1   mycroft 		if (dip->di_inumber == LFS_IFILE_INUM)
    256   1.1   mycroft 			break;
    257   1.1   mycroft 
    258   1.1   mycroft 	if (dip < dpage)
    259  1.20      fvdl 		errx(1, "unable to locate ifile inode at disk address 0x%llx",
    260  1.20      fvdl 		     (long long)addr);
    261   1.1   mycroft 
    262   1.1   mycroft 	(void)printf("\nIFILE inode\n");
    263   1.1   mycroft 	dump_dinode(dip);
    264   1.1   mycroft 
    265   1.1   mycroft 	(void)printf("\nIFILE contents\n");
    266   1.1   mycroft 	nblocks = dip->di_size >> lfsp->lfs_bshift;
    267   1.1   mycroft 	block_limit = MIN(nblocks, NDADDR);
    268   1.1   mycroft 
    269   1.1   mycroft 	/* Get the direct block */
    270   1.1   mycroft 	if ((ipage = malloc(psize)) == NULL)
    271   1.2   mycroft 		err(1, "malloc");
    272   1.1   mycroft 	for (inum = 0, addrp = dip->di_db, i = 0; i < block_limit;
    273   1.1   mycroft 	    i++, addrp++) {
    274  1.19  perseant 		get(fd, fsbtobyte(lfsp, *addrp), ipage, psize);
    275   1.1   mycroft 		if (i < lfsp->lfs_cleansz) {
    276   1.1   mycroft 			dump_cleaner_info(lfsp, ipage);
    277  1.19  perseant 			if (do_segentries)
    278  1.19  perseant 				print_suheader;
    279   1.1   mycroft 			continue;
    280   1.1   mycroft 		}
    281   1.1   mycroft 
    282   1.1   mycroft 		if (i < (lfsp->lfs_segtabsz + lfsp->lfs_cleansz)) {
    283  1.19  perseant 			if (do_segentries)
    284  1.19  perseant 				inum = dump_ipage_segusage(lfsp, inum, ipage,
    285  1.19  perseant 							   lfsp->lfs_sepb);
    286  1.19  perseant 			else
    287  1.19  perseant 				inum = (i < lfsp->lfs_segtabsz + lfsp->lfs_cleansz - 1);
    288  1.10      ross 			if (!inum) {
    289   1.1   mycroft 				if(!do_ientries)
    290   1.1   mycroft 					goto e0;
    291   1.1   mycroft 				else
    292   1.1   mycroft 					print_iheader;
    293  1.10      ross 			}
    294   1.1   mycroft 		} else
    295  1.19  perseant 			inum = dump_ipage_ifile(lfsp, inum, ipage, lfsp->lfs_ifpb);
    296   1.1   mycroft 	}
    297   1.1   mycroft 
    298   1.1   mycroft 	if (nblocks <= NDADDR)
    299   1.1   mycroft 		goto e0;
    300   1.1   mycroft 
    301   1.1   mycroft 	/* Dump out blocks off of single indirect block */
    302   1.1   mycroft 	if (!(indir = malloc(psize)))
    303   1.2   mycroft 		err(1, "malloc");
    304  1.19  perseant 	get(fd, fsbtobyte(lfsp, dip->di_ib[0]), indir, psize);
    305   1.1   mycroft 	block_limit = MIN(i + lfsp->lfs_nindir, nblocks);
    306   1.1   mycroft 	for (addrp = indir; i < block_limit; i++, addrp++) {
    307   1.1   mycroft 		if (*addrp == LFS_UNUSED_DADDR)
    308   1.1   mycroft 			break;
    309  1.19  perseant 		get(fd, fsbtobyte(lfsp, *addrp), ipage, psize);
    310   1.1   mycroft 		if (i < lfsp->lfs_cleansz) {
    311   1.1   mycroft 			dump_cleaner_info(lfsp, ipage);
    312   1.1   mycroft 			continue;
    313  1.19  perseant 		}
    314   1.1   mycroft 
    315  1.19  perseant 		if (i < lfsp->lfs_segtabsz + lfsp->lfs_cleansz) {
    316  1.19  perseant 			if (do_segentries)
    317  1.19  perseant 				inum = dump_ipage_segusage(lfsp, inum, ipage,
    318  1.19  perseant 							   lfsp->lfs_sepb);
    319  1.19  perseant 			else
    320  1.19  perseant 				inum = (i < lfsp->lfs_segtabsz + lfsp->lfs_cleansz - 1);
    321  1.11   nathanw 			if (!inum) {
    322   1.1   mycroft 				if(!do_ientries)
    323   1.1   mycroft 					goto e1;
    324   1.1   mycroft 				else
    325   1.1   mycroft 					print_iheader;
    326  1.11   nathanw 			}
    327   1.1   mycroft 		} else
    328  1.19  perseant 			inum = dump_ipage_ifile(lfsp, inum, ipage, lfsp->lfs_ifpb);
    329   1.1   mycroft 	}
    330   1.1   mycroft 
    331   1.1   mycroft 	if (nblocks <= lfsp->lfs_nindir * lfsp->lfs_ifpb)
    332   1.1   mycroft 		goto e1;
    333   1.1   mycroft 
    334   1.1   mycroft 	/* Get the double indirect block */
    335   1.1   mycroft 	if (!(dindir = malloc(psize)))
    336   1.2   mycroft 		err(1, "malloc");
    337  1.19  perseant 	get(fd, fsbtobyte(lfsp, dip->di_ib[1]), dindir, psize);
    338   1.1   mycroft 	for (iaddrp = dindir, j = 0; j < lfsp->lfs_nindir; j++, iaddrp++) {
    339   1.1   mycroft 		if (*iaddrp == LFS_UNUSED_DADDR)
    340   1.1   mycroft 			break;
    341  1.19  perseant 		get(fd, fsbtobyte(lfsp, *iaddrp), indir, psize);
    342   1.1   mycroft 		block_limit = MIN(i + lfsp->lfs_nindir, nblocks);
    343   1.1   mycroft 		for (addrp = indir; i < block_limit; i++, addrp++) {
    344   1.1   mycroft 			if (*addrp == LFS_UNUSED_DADDR)
    345   1.1   mycroft 				break;
    346  1.19  perseant 			get(fd, fsbtobyte(lfsp, *addrp), ipage, psize);
    347   1.1   mycroft 			if (i < lfsp->lfs_cleansz) {
    348   1.1   mycroft 				dump_cleaner_info(lfsp, ipage);
    349   1.1   mycroft 				continue;
    350  1.19  perseant 			}
    351   1.1   mycroft 
    352  1.19  perseant 			if (i < lfsp->lfs_segtabsz + lfsp->lfs_cleansz) {
    353  1.19  perseant 				if (do_segentries)
    354  1.19  perseant 					inum = dump_ipage_segusage(lfsp,
    355  1.19  perseant 						 inum, ipage, lfsp->lfs_sepb);
    356  1.19  perseant 				else
    357  1.19  perseant 					inum = (i < lfsp->lfs_segtabsz +
    358  1.19  perseant 						lfsp->lfs_cleansz - 1);
    359  1.10      ross 				if (!inum) {
    360   1.1   mycroft 					if(!do_ientries)
    361   1.1   mycroft 						goto e2;
    362   1.1   mycroft 					else
    363   1.1   mycroft 						print_iheader;
    364  1.10      ross 				}
    365   1.1   mycroft 			} else
    366  1.19  perseant 				inum = dump_ipage_ifile(lfsp, inum,
    367   1.1   mycroft 				    ipage, lfsp->lfs_ifpb);
    368   1.1   mycroft 		}
    369   1.1   mycroft 	}
    370   1.1   mycroft e2:	free(dindir);
    371   1.1   mycroft e1:	free(indir);
    372   1.1   mycroft e0:	free(dpage);
    373   1.1   mycroft 	free(ipage);
    374   1.1   mycroft }
    375   1.1   mycroft 
    376   1.1   mycroft static int
    377  1.19  perseant dump_ipage_ifile(struct lfs *lfsp, int i, char *pp, int tot)
    378   1.1   mycroft {
    379  1.19  perseant 	char *ip;
    380  1.19  perseant 	int cnt, max, entsize;
    381   1.1   mycroft 
    382  1.19  perseant 	if (lfsp->lfs_version == 1)
    383  1.19  perseant 		entsize = sizeof(IFILE_V1);
    384  1.19  perseant 	else
    385  1.19  perseant 		entsize = sizeof(IFILE);
    386   1.1   mycroft 	max = i + tot;
    387   1.1   mycroft 
    388  1.19  perseant 	for (ip = pp, cnt = i; cnt < max; cnt++, ip += entsize)
    389  1.19  perseant 		print_ientry(cnt, (IFILE *)ip);
    390   1.1   mycroft 	return (max);
    391   1.1   mycroft }
    392   1.1   mycroft 
    393   1.1   mycroft static int
    394  1.19  perseant dump_ipage_segusage(struct lfs *lfsp, int i, char *pp, int tot)
    395   1.1   mycroft {
    396   1.1   mycroft 	SEGUSE *sp;
    397   1.1   mycroft 	int cnt, max;
    398  1.15  perseant 	struct seglist *slp;
    399   1.1   mycroft 
    400   1.1   mycroft 	max = i + tot;
    401   1.1   mycroft 	for (sp = (SEGUSE *)pp, cnt = i;
    402  1.19  perseant 	     cnt < lfsp->lfs_nseg && cnt < max; cnt++) {
    403  1.15  perseant 		if (seglist == NULL)
    404  1.19  perseant 			print_suentry(cnt, sp, lfsp);
    405  1.15  perseant 		else {
    406  1.15  perseant 			for (slp = seglist; slp != NULL; slp = slp->next)
    407  1.15  perseant 				if (cnt == slp->num) {
    408  1.19  perseant 					print_suentry(cnt, sp, lfsp);
    409  1.15  perseant 					break;
    410  1.15  perseant 				}
    411  1.15  perseant 		}
    412  1.19  perseant 		if (lfsp->lfs_version > 1)
    413  1.19  perseant 			++sp;
    414  1.19  perseant 		else
    415  1.19  perseant 			sp = (SEGUSE *)((SEGUSE_V1 *)sp + 1);
    416  1.15  perseant 	}
    417   1.1   mycroft 	if (max >= lfsp->lfs_nseg)
    418   1.1   mycroft 		return (0);
    419   1.1   mycroft 	else
    420   1.1   mycroft 		return (max);
    421   1.1   mycroft }
    422   1.1   mycroft 
    423   1.1   mycroft static void
    424  1.19  perseant dump_dinode(struct dinode *dip)
    425   1.1   mycroft {
    426   1.1   mycroft 	int i;
    427   1.7   thorpej 	time_t at, mt, ct;
    428   1.7   thorpej 
    429   1.7   thorpej 	at = dip->di_atime;
    430   1.7   thorpej 	mt = dip->di_mtime;
    431   1.7   thorpej 	ct = dip->di_ctime;
    432   1.1   mycroft 
    433  1.19  perseant 	(void)printf("    %so%o\t%s%d\t%s%d\t%s%d\t%s%llu\n",
    434   1.1   mycroft 		"mode  ", dip->di_mode,
    435   1.1   mycroft 		"nlink ", dip->di_nlink,
    436   1.1   mycroft 		"uid   ", dip->di_uid,
    437   1.1   mycroft 		"gid   ", dip->di_gid,
    438   1.9   thorpej 		"size  ", (long long)dip->di_size);
    439  1.19  perseant 	(void)printf("    %s%s    %s%s    %s%s",
    440   1.7   thorpej 		"atime ", ctime(&at),
    441   1.7   thorpej 		"mtime ", ctime(&mt),
    442   1.7   thorpej 		"ctime ", ctime(&ct));
    443  1.19  perseant 	(void)printf("    inum  %d\n", dip->di_inumber);
    444  1.19  perseant 	(void)printf("    Direct Addresses\n");
    445   1.1   mycroft 	for (i = 0; i < NDADDR; i++) {
    446  1.14  perseant 		(void)printf("\t0x%x", dip->di_db[i]);
    447   1.1   mycroft 		if ((i % 6) == 5)
    448   1.1   mycroft 			(void)printf("\n");
    449   1.1   mycroft 	}
    450   1.1   mycroft 	for (i = 0; i < NIADDR; i++)
    451  1.14  perseant 		(void)printf("\t0x%x", dip->di_ib[i]);
    452   1.1   mycroft 	(void)printf("\n");
    453   1.1   mycroft }
    454   1.1   mycroft 
    455   1.1   mycroft static int
    456  1.19  perseant dump_sum(int fd, struct lfs *lfsp, SEGSUM *sp, int segnum, daddr_t addr)
    457   1.1   mycroft {
    458   1.1   mycroft 	FINFO *fp;
    459  1.20      fvdl 	int32_t *dp;
    460   1.1   mycroft 	int i, j;
    461   1.1   mycroft 	int ck;
    462   1.8      fvdl 	int numbytes;
    463   1.1   mycroft 	struct dinode *inop;
    464   1.1   mycroft 
    465   1.8      fvdl 	if (sp->ss_magic != SS_MAGIC ||
    466   1.8      fvdl 	    sp->ss_sumsum != (ck = cksum(&sp->ss_datasum,
    467  1.19  perseant 	    lfsp->lfs_sumsize - sizeof(sp->ss_sumsum)))) {
    468  1.14  perseant 		/* Don't print "corrupt" if we're just too close to the edge */
    469  1.19  perseant 		if (dtosn(lfsp, addr + fsbtodb(lfsp, 1)) ==
    470  1.19  perseant 		    dtosn(lfsp, addr))
    471  1.20      fvdl 			(void)printf("dumplfs: %s %d address 0x%llx\n",
    472  1.14  perseant 		                     "corrupt summary block; segment", segnum,
    473  1.20      fvdl 				     (long long)addr);
    474  1.19  perseant 		return (0);
    475  1.19  perseant 	}
    476  1.19  perseant 	if (lfsp->lfs_version > 1 && sp->ss_ident != lfsp->lfs_ident) {
    477  1.20      fvdl 		(void)printf("dumplfs: %s %d address 0x%llx\n",
    478  1.19  perseant 	                     "summary from a former life; segment", segnum,
    479  1.21       mrg 			     (long long)addr);
    480  1.19  perseant 		return (0);
    481   1.1   mycroft 	}
    482   1.1   mycroft 
    483  1.20      fvdl 	(void)printf("Segment Summary Info at 0x%llx\n", (long long)addr);
    484  1.14  perseant 	(void)printf("    %s0x%x\t%s%d\t%s%d\t%s%c%c\n    %s0x%x\t%s0x%x",
    485   1.1   mycroft 		"next     ", sp->ss_next,
    486   1.1   mycroft 		"nfinfo   ", sp->ss_nfinfo,
    487   1.1   mycroft 		"ninos    ", sp->ss_ninos,
    488  1.14  perseant 		"flags    ", (sp->ss_flags & SS_DIROP) ? 'D' : '-',
    489  1.14  perseant 			     (sp->ss_flags & SS_CONT)  ? 'C' : '-',
    490   1.1   mycroft 		"sumsum   ", sp->ss_sumsum,
    491   1.1   mycroft 		"datasum  ", sp->ss_datasum );
    492  1.19  perseant 	if (lfsp->lfs_version == 1)
    493  1.19  perseant 		(void)printf("\tcreate   %s\n", ctime((time_t *)&sp->ss_ident));
    494  1.19  perseant 	else {
    495  1.19  perseant 		(void)printf("\tcreate   %s", ctime((time_t *)&sp->ss_create));
    496  1.19  perseant 		(void)printf("    roll_id  %-8x", sp->ss_ident);
    497  1.19  perseant 		(void)printf("   serial   %lld\n", (long long)sp->ss_serial);
    498  1.19  perseant 	}
    499   1.1   mycroft 
    500   1.1   mycroft 	/* Dump out inode disk addresses */
    501  1.20      fvdl 	dp = (int32_t *)sp;
    502  1.20      fvdl 	dp += lfsp->lfs_sumsize / sizeof(int32_t);
    503  1.19  perseant 	inop = malloc(lfsp->lfs_bsize);
    504   1.1   mycroft 	printf("    Inode addresses:");
    505   1.8      fvdl 	numbytes = 0;
    506   1.1   mycroft 	for (dp--, i = 0; i < sp->ss_ninos; dp--) {
    507  1.19  perseant 		numbytes += lfsp->lfs_ibsize;	/* add bytes for inode block */
    508  1.14  perseant 		printf("\t0x%x {", *dp);
    509  1.19  perseant 		get(fd, fsbtobyte(lfsp, *dp), inop, lfsp->lfs_ibsize);
    510   1.1   mycroft 		for (j = 0; i < sp->ss_ninos && j < INOPB(lfsp); j++, i++) {
    511   1.1   mycroft 			if (j > 0)
    512   1.1   mycroft 				(void)printf(", ");
    513  1.19  perseant 			(void)printf("%dv%d", inop[j].di_inumber, inop[j].di_gen);
    514   1.1   mycroft 		}
    515   1.1   mycroft 		(void)printf("}");
    516   1.1   mycroft 		if (((i/INOPB(lfsp)) % 4) == 3)
    517   1.1   mycroft 			(void)printf("\n");
    518   1.1   mycroft 	}
    519   1.1   mycroft 	free(inop);
    520   1.1   mycroft 
    521   1.1   mycroft 	printf("\n");
    522  1.19  perseant 	if (lfsp->lfs_version == 1)
    523  1.19  perseant 		fp = (FINFO *)((SEGSUM_V1 *)sp + 1);
    524  1.19  perseant 	else
    525  1.19  perseant 		fp = (FINFO *)(sp + 1);
    526  1.19  perseant 	for (i = 0; i < sp->ss_nfinfo; i++) {
    527   1.8      fvdl 		(void)printf("    FINFO for inode: %d version %d nblocks %d lastlength %d\n",
    528   1.8      fvdl 		    fp->fi_ino, fp->fi_version, fp->fi_nblocks,
    529   1.8      fvdl 		    fp->fi_lastlength);
    530   1.1   mycroft 		dp = &(fp->fi_blocks[0]);
    531   1.1   mycroft 		for (j = 0; j < fp->fi_nblocks; j++, dp++) {
    532   1.1   mycroft 			(void)printf("\t%d", *dp);
    533   1.1   mycroft 			if ((j % 8) == 7)
    534   1.1   mycroft 				(void)printf("\n");
    535   1.8      fvdl 			if (j == fp->fi_nblocks - 1)
    536   1.8      fvdl 				numbytes += fp->fi_lastlength;
    537   1.8      fvdl 			else
    538   1.8      fvdl 				numbytes += lfsp->lfs_bsize;
    539   1.1   mycroft 		}
    540   1.1   mycroft 		if ((j % 8) != 0)
    541   1.1   mycroft 			(void)printf("\n");
    542   1.1   mycroft 		fp = (FINFO *)dp;
    543   1.1   mycroft 	}
    544   1.8      fvdl 	return (numbytes);
    545   1.1   mycroft }
    546   1.1   mycroft 
    547   1.1   mycroft static void
    548  1.19  perseant dump_segment(int fd, int segnum, daddr_t addr, struct lfs *lfsp, int dump_sb)
    549   1.1   mycroft {
    550   1.1   mycroft 	struct lfs lfs_sb, *sbp;
    551   1.1   mycroft 	SEGSUM *sump;
    552  1.19  perseant 	char *sumblock;
    553   1.8      fvdl 	int did_one, nbytes, sb;
    554  1.14  perseant 	off_t sum_offset;
    555  1.14  perseant 	daddr_t new_addr;
    556   1.1   mycroft 
    557  1.20      fvdl 	(void)printf("\nSEGMENT %lld (Disk Address 0x%llx)\n",
    558  1.20      fvdl 		     (long long)dtosn(lfsp, addr), (long long)addr);
    559  1.19  perseant 	sum_offset = fsbtobyte(lfsp, addr);
    560  1.19  perseant 	sumblock = malloc(lfsp->lfs_sumsize);
    561  1.19  perseant 
    562  1.19  perseant 	if (lfsp->lfs_version > 1 && segnum == 0) {
    563  1.19  perseant 		/* First segment eats the label as well as the superblock */
    564  1.19  perseant 		sum_offset += fragroundup(lfsp, LFS_LABELPAD);
    565  1.19  perseant 		addr += btofsb(lfsp, fragroundup(lfsp, LFS_LABELPAD));
    566  1.19  perseant 		printf("Disklabel at 0x0\n");
    567  1.19  perseant 	}
    568   1.1   mycroft 
    569   1.1   mycroft 	sb = 0;
    570   1.1   mycroft 	did_one = 0;
    571   1.1   mycroft 	do {
    572  1.19  perseant 		get(fd, sum_offset, sumblock, lfsp->lfs_sumsize);
    573   1.1   mycroft 		sump = (SEGSUM *)sumblock;
    574  1.19  perseant 		if ((lfsp->lfs_version > 1 &&
    575  1.19  perseant 		     sump->ss_ident != lfsp->lfs_ident) ||
    576  1.19  perseant 		    sump->ss_sumsum != cksum (&sump->ss_datasum,
    577  1.19  perseant 			      lfsp->lfs_sumsize - sizeof(sump->ss_sumsum))) {
    578   1.1   mycroft 			sbp = (struct lfs *)sump;
    579   1.8      fvdl 			if ((sb = (sbp->lfs_magic == LFS_MAGIC))) {
    580  1.19  perseant 				printf("Superblock at 0x%x\n",
    581  1.19  perseant 				       (unsigned)btofsb(lfsp, sum_offset));
    582  1.14  perseant 				if (dump_sb)  {
    583  1.14  perseant 					get(fd, sum_offset, &(lfs_sb.lfs_dlfs),
    584  1.14  perseant 					    sizeof(struct dlfs));
    585  1.14  perseant 					dump_super(&lfs_sb);
    586  1.14  perseant 				}
    587  1.19  perseant 				if (lfsp->lfs_version > 1)
    588  1.19  perseant 					sum_offset += fragroundup(lfsp, LFS_SBPAD);
    589  1.19  perseant 				else
    590  1.19  perseant 					sum_offset += LFS_SBPAD;
    591   1.1   mycroft 			} else if (did_one)
    592   1.1   mycroft 				break;
    593   1.1   mycroft 			else {
    594  1.20      fvdl 				printf("Segment at 0x%llx empty or corrupt\n",
    595  1.20      fvdl                                        (long long)addr);
    596   1.1   mycroft 				break;
    597   1.1   mycroft 			}
    598   1.1   mycroft 		} else {
    599  1.19  perseant 			nbytes = dump_sum(fd, lfsp, sump, segnum,
    600  1.19  perseant 				btofsb(lfsp, sum_offset));
    601   1.8      fvdl 			if (nbytes)
    602  1.19  perseant 				sum_offset += lfsp->lfs_sumsize + nbytes;
    603   1.1   mycroft 			else
    604   1.1   mycroft 				sum_offset = 0;
    605   1.1   mycroft 			did_one = 1;
    606   1.1   mycroft 		}
    607  1.14  perseant 		/* If the segment ends right on a boundary, it still ends */
    608  1.19  perseant 		new_addr = btofsb(lfsp, sum_offset);
    609  1.19  perseant 		/* printf("end daddr = 0x%lx\n", (long)new_addr); */
    610  1.19  perseant 		if (dtosn(lfsp, new_addr) != dtosn(lfsp, addr))
    611  1.14  perseant 			break;
    612   1.1   mycroft 	} while (sum_offset);
    613   1.1   mycroft 
    614   1.1   mycroft 	return;
    615   1.1   mycroft }
    616   1.1   mycroft 
    617   1.1   mycroft static void
    618  1.19  perseant dump_super(struct lfs *lfsp)
    619   1.1   mycroft {
    620   1.1   mycroft 	int i;
    621   1.1   mycroft 
    622  1.19  perseant  	(void)printf("    %s0x%-8x  %s0x%-8x  %s%-10d\n",
    623  1.19  perseant  		     "magic    ", lfsp->lfs_magic,
    624  1.19  perseant  		     "version  ", lfsp->lfs_version,
    625  1.19  perseant  		     "size     ", lfsp->lfs_size);
    626  1.19  perseant  	(void)printf("    %s%-10d  %s%-10d  %s%-10d\n",
    627  1.19  perseant  		     "ssize    ", lfsp->lfs_ssize,
    628  1.19  perseant  		     "dsize    ", lfsp->lfs_dsize,
    629  1.19  perseant  		     "bsize    ", lfsp->lfs_bsize);
    630  1.19  perseant  	(void)printf("    %s%-10d  %s%-10d  %s%-10d\n",
    631  1.19  perseant  		     "fsize    ", lfsp->lfs_fsize,
    632  1.19  perseant  		     "frag     ", lfsp->lfs_frag,
    633  1.19  perseant  		     "minfree  ", lfsp->lfs_minfree);
    634  1.19  perseant  	(void)printf("    %s%-10d  %s%-10d  %s%-10d\n",
    635  1.19  perseant  		     "inopb    ", lfsp->lfs_inopb,
    636  1.19  perseant  		     "ifpb     ", lfsp->lfs_ifpb,
    637  1.19  perseant  		     "nindir   ", lfsp->lfs_nindir);
    638  1.19  perseant  	(void)printf("    %s%-10d  %s%-10d  %s%-10d\n",
    639  1.19  perseant  		     "nseg     ", lfsp->lfs_nseg,
    640  1.19  perseant  		     "sepb     ", lfsp->lfs_sepb,
    641  1.19  perseant  		     "cleansz  ", lfsp->lfs_cleansz);
    642  1.19  perseant  	(void)printf("    %s%-10d  %s0x%-8x  %s%-10d\n",
    643  1.19  perseant  		     "segtabsz ", lfsp->lfs_segtabsz,
    644  1.19  perseant  		     "segmask  ", lfsp->lfs_segmask,
    645  1.19  perseant  		     "segshift ", lfsp->lfs_segshift);
    646  1.19  perseant  	(void)printf("    %s0x%-8qx  %s%-10d  %s0x%-8qX\n",
    647  1.19  perseant  		     "bmask    ", (long long)lfsp->lfs_bmask,
    648  1.19  perseant  		     "bshift   ", lfsp->lfs_bshift,
    649  1.19  perseant  		     "ffmask   ", (long long)lfsp->lfs_ffmask);
    650  1.19  perseant  	(void)printf("    %s%-10d  %s0x%-8qx  %s%u\n",
    651  1.19  perseant  		     "ffshift  ", lfsp->lfs_ffshift,
    652  1.19  perseant  		     "fbmask   ", (long long)lfsp->lfs_fbmask,
    653  1.19  perseant  		     "fbshift  ", lfsp->lfs_fbshift);
    654  1.19  perseant 
    655  1.19  perseant  	(void)printf("    %s%-10d  %s%-10d  %s0x%-8x\n",
    656  1.19  perseant  		     "sushift  ", lfsp->lfs_sushift,
    657  1.19  perseant  		     "fsbtodb  ", lfsp->lfs_fsbtodb,
    658  1.19  perseant  		     "cksum    ", lfsp->lfs_cksum);
    659  1.19  perseant  	(void)printf("    %s%-10d  %s%-10d  %s%-10d\n",
    660  1.19  perseant  		     "nclean   ", lfsp->lfs_nclean,
    661  1.19  perseant  		     "dmeta    ", lfsp->lfs_dmeta,
    662  1.19  perseant  		     "minfreeseg ", lfsp->lfs_minfreeseg);
    663  1.19  perseant  	(void)printf("    %s0x%-8x  %s%-9d %s%-10d\n",
    664  1.19  perseant  		     "roll_id  ", lfsp->lfs_ident,
    665  1.19  perseant  		     "interleave ", lfsp->lfs_interleave,
    666  1.19  perseant  		     "sumsize  ", lfsp->lfs_sumsize);
    667  1.19  perseant  	(void)printf("    %s0x%-8qx\n",
    668  1.19  perseant  		     "maxfilesize  ", (long long)lfsp->lfs_maxfilesize);
    669  1.19  perseant 
    670  1.19  perseant 
    671  1.19  perseant  	(void)printf("  Superblock disk addresses:\n    ");
    672  1.19  perseant   	for (i = 0; i < LFS_MAXNUMSB; i++) {
    673  1.19  perseant  		(void)printf(" 0x%-8x", lfsp->lfs_sboffs[i]);
    674  1.19  perseant  		if (i == (LFS_MAXNUMSB >> 1))
    675  1.19  perseant  			(void)printf("\n    ");
    676  1.19  perseant   	}
    677  1.19  perseant   	(void)printf("\n");
    678  1.19  perseant 
    679  1.19  perseant  	(void)printf("  Checkpoint Info\n");
    680  1.19  perseant  	(void)printf("    %s%-10d  %s0x%-8x  %s%-10d\n",
    681  1.19  perseant  		     "free     ", lfsp->lfs_free,
    682  1.19  perseant  		     "idaddr   ", lfsp->lfs_idaddr,
    683  1.19  perseant  		     "ifile    ", lfsp->lfs_ifile);
    684  1.19  perseant  	(void)printf("    %s%-10d  %s%-10d  %s%-10d\n",
    685  1.19  perseant  		     "uinodes  ", lfsp->lfs_uinodes,
    686  1.19  perseant  		     "bfree    ", lfsp->lfs_bfree,
    687  1.19  perseant  		     "avail    ", lfsp->lfs_avail);
    688  1.19  perseant  	(void)printf("    %s%-10d  %s0x%-8x  %s0x%-8x\n",
    689  1.19  perseant  		     "nfiles   ", lfsp->lfs_nfiles,
    690  1.19  perseant  		     "lastseg  ", lfsp->lfs_lastseg,
    691  1.19  perseant  		     "nextseg  ", lfsp->lfs_nextseg);
    692  1.19  perseant  	(void)printf("    %s0x%-8x  %s0x%-8x  %s%-10lld\n",
    693  1.19  perseant  		     "curseg   ", lfsp->lfs_curseg,
    694  1.19  perseant  		     "offset   ", lfsp->lfs_offset,
    695  1.19  perseant 		     "serial   ", (long long)lfsp->lfs_serial);
    696  1.19  perseant  	(void)printf("    tstamp   %s", ctime((time_t *)&lfsp->lfs_tstamp));
    697   1.1   mycroft }
    698   1.1   mycroft 
    699   1.1   mycroft static void
    700  1.19  perseant addseg(char *arg)
    701   1.1   mycroft {
    702   1.1   mycroft 	SEGLIST *p;
    703   1.1   mycroft 
    704   1.1   mycroft 	if ((p = malloc(sizeof(SEGLIST))) == NULL)
    705   1.2   mycroft 		err(1, "malloc");
    706   1.1   mycroft 	p->next = seglist;
    707   1.1   mycroft 	p->num = atoi(arg);
    708   1.1   mycroft 	seglist = p;
    709   1.1   mycroft }
    710   1.1   mycroft 
    711   1.1   mycroft static void
    712  1.19  perseant dump_cleaner_info(struct lfs *lfsp, void *ipage)
    713   1.1   mycroft {
    714   1.1   mycroft 	CLEANERINFO *cip;
    715   1.1   mycroft 
    716   1.1   mycroft 	cip = (CLEANERINFO *)ipage;
    717  1.19  perseant 	if (lfsp->lfs_version > 1) {
    718  1.19  perseant 		(void)printf("free_head %d\n", cip->free_head);
    719  1.19  perseant 		(void)printf("free_tail %d\n", cip->free_tail);
    720  1.19  perseant 	}
    721  1.17  perseant 	(void)printf("clean\t%d\tdirty\t%d\n",
    722  1.17  perseant 		     cip->clean, cip->dirty);
    723  1.17  perseant 	(void)printf("bfree\t%d\tavail\t%d\n\n",
    724  1.17  perseant 		     cip->bfree, cip->avail);
    725   1.1   mycroft }
    726   1.1   mycroft 
    727   1.1   mycroft static void
    728  1.19  perseant usage(void)
    729   1.1   mycroft {
    730  1.19  perseant 	(void)fprintf(stderr, "usage: dumplfs [-aiS] [-b daddr] [-I daddr] [-s segnum] file\n");
    731   1.1   mycroft 	exit(1);
    732   1.1   mycroft }
    733