1103398Sphk/*
2103398Sphk * Copyright (c) 2002 Poul-Henning Kamp
3103398Sphk * Copyright (c) 2002 Networks Associates Technology, Inc.
4103398Sphk * All rights reserved.
5103398Sphk *
6103398Sphk * This software was developed for the FreeBSD Project by Poul-Henning Kamp
7103398Sphk * and NAI Labs, the Security Research Division of Network Associates, Inc.
8103398Sphk * under DARPA/SPAWAR contract N66001-01-C-8035 ("CBOSS"), as part of the
9103398Sphk * DARPA CHATS research program.
10103398Sphk *
11103398Sphk * Redistribution and use in source and binary forms, with or without
12103398Sphk * modification, are permitted provided that the following conditions
13103398Sphk * are met:
14103398Sphk * 1. Redistributions of source code must retain the above copyright
15103398Sphk *    notice, this list of conditions and the following disclaimer.
16103398Sphk * 2. Redistributions in binary form must reproduce the above copyright
17103398Sphk *    notice, this list of conditions and the following disclaimer in the
18103398Sphk *    documentation and/or other materials provided with the distribution.
19103398Sphk * 3. The names of the authors may not be used to endorse or promote
20103398Sphk *    products derived from this software without specific prior written
21103398Sphk *    permission.
22103398Sphk *
23103398Sphk * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
24103398Sphk * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25103398Sphk * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26103398Sphk * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
27103398Sphk * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28103398Sphk * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29103398Sphk * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30103398Sphk * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31103398Sphk * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32103398Sphk * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33103398Sphk * SUCH DAMAGE.
34103398Sphk */
35103398Sphk
36114589Sobrien#include <sys/cdefs.h>
37114589Sobrien__FBSDID("$FreeBSD$");
38103398Sphk
39103398Sphk#include <sys/param.h>
40103398Sphk#include <sys/time.h>
41103398Sphk#include <sys/stdint.h>
42103398Sphk
43103398Sphk#include <ufs/ufs/dinode.h>
44103398Sphk#include <ufs/ufs/dir.h>
45103398Sphk#include <ufs/ffs/fs.h>
46103398Sphk
47103398Sphk#include <err.h>
48103398Sphk#include <string.h>
49103398Sphk
50103398Sphk#include "fsck.h"
51103398Sphk
52103398Sphk/*
53103398Sphk * Scan each entry in an ea block.
54103398Sphk */
55103398Sphkint
56103398Sphkeascan(struct inodesc *idesc, struct ufs2_dinode *dp)
57103398Sphk{
58103398Sphk#if 1
59103398Sphk	return (0);
60103398Sphk#else
61103398Sphk	struct bufarea *bp;
62103398Sphk	u_int dsize, n;
63103398Sphk	u_char *cp;
64103398Sphk	long blksiz;
65103398Sphk	char dbuf[DIRBLKSIZ];
66103398Sphk
67103398Sphk	printf("Inode %ju extsize %ju\n",
68259224Spfg	   (intmax_t)idesc->id_number, (uintmax_t)dp->di_extsize);
69103398Sphk	if (dp->di_extsize == 0)
70103398Sphk		return 0;
71103398Sphk	if (dp->di_extsize <= sblock.fs_fsize)
72103398Sphk		blksiz = sblock.fs_fsize;
73103398Sphk	else
74103398Sphk		blksiz = sblock.fs_bsize;
75103398Sphk	printf("blksiz = %ju\n", (intmax_t)blksiz);
76249788Smckusick	bp = getdatablk(dp->di_extb[0], blksiz, BT_EXTATTR);
77103398Sphk	cp = (u_char *)bp->b_un.b_buf;
78103398Sphk	for (n = 0; n < blksiz; n++) {
79103398Sphk		printf("%02x", cp[n]);
80103398Sphk		if ((n & 31) == 31)
81103398Sphk			printf("\n");
82103398Sphk	}
83103398Sphk	return (STOP);
84103398Sphk#endif
85103398Sphk}
86