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