1 |
/* $MidnightBSD$ */ |
2 |
/* |
3 |
* Copyright (c) 2002 Poul-Henning Kamp |
4 |
* Copyright (c) 2002 Networks Associates Technology, Inc. |
5 |
* All rights reserved. |
6 |
* |
7 |
* This software was developed for the FreeBSD Project by Poul-Henning Kamp |
8 |
* and NAI Labs, the Security Research Division of Network Associates, Inc. |
9 |
* under DARPA/SPAWAR contract N66001-01-C-8035 ("CBOSS"), as part of the |
10 |
* DARPA CHATS research program. |
11 |
* |
12 |
* Redistribution and use in source and binary forms, with or without |
13 |
* modification, are permitted provided that the following conditions |
14 |
* are met: |
15 |
* 1. Redistributions of source code must retain the above copyright |
16 |
* notice, this list of conditions and the following disclaimer. |
17 |
* 2. Redistributions in binary form must reproduce the above copyright |
18 |
* notice, this list of conditions and the following disclaimer in the |
19 |
* documentation and/or other materials provided with the distribution. |
20 |
* 3. The names of the authors may not be used to endorse or promote |
21 |
* products derived from this software without specific prior written |
22 |
* permission. |
23 |
* |
24 |
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND |
25 |
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
26 |
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
27 |
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE |
28 |
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
29 |
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
30 |
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
31 |
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
32 |
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
33 |
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
34 |
* SUCH DAMAGE. |
35 |
*/ |
36 |
|
37 |
#include <sys/cdefs.h> |
38 |
__FBSDID("$FreeBSD: stable/10/sbin/fsck_ffs/ea.c 259223 2013-12-11 19:25:17Z pfg $"); |
39 |
|
40 |
#include <sys/param.h> |
41 |
#include <sys/time.h> |
42 |
#include <sys/stdint.h> |
43 |
|
44 |
#include <ufs/ufs/dinode.h> |
45 |
#include <ufs/ufs/dir.h> |
46 |
#include <ufs/ffs/fs.h> |
47 |
|
48 |
#include <err.h> |
49 |
#include <string.h> |
50 |
|
51 |
#include "fsck.h" |
52 |
|
53 |
/* |
54 |
* Scan each entry in an ea block. |
55 |
*/ |
56 |
int |
57 |
eascan(struct inodesc *idesc, struct ufs2_dinode *dp) |
58 |
{ |
59 |
#if 1 |
60 |
return (0); |
61 |
#else |
62 |
struct bufarea *bp; |
63 |
u_int dsize, n; |
64 |
u_char *cp; |
65 |
long blksiz; |
66 |
char dbuf[DIRBLKSIZ]; |
67 |
|
68 |
printf("Inode %ju extsize %ju\n", |
69 |
(intmax_t)idesc->id_number, (uintmax_t)dp->di_extsize); |
70 |
if (dp->di_extsize == 0) |
71 |
return 0; |
72 |
if (dp->di_extsize <= sblock.fs_fsize) |
73 |
blksiz = sblock.fs_fsize; |
74 |
else |
75 |
blksiz = sblock.fs_bsize; |
76 |
printf("blksiz = %ju\n", (intmax_t)blksiz); |
77 |
bp = getdatablk(dp->di_extb[0], blksiz, BT_EXTATTR); |
78 |
cp = (u_char *)bp->b_un.b_buf; |
79 |
for (n = 0; n < blksiz; n++) { |
80 |
printf("%02x", cp[n]); |
81 |
if ((n & 31) == 31) |
82 |
printf("\n"); |
83 |
} |
84 |
return (STOP); |
85 |
#endif |
86 |
} |