/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <mdb/mdb_modapi.h>
#include <sys/sysmacros.h>
#include "ufs_cmds.h"
typedef struct inode_walk_data {
int iw_inohsz;
int iw_inohcnt;
static int
{
int inohsz;
mdb_warn("inode_cache only supports global walks\n");
return (WALK_ERR);
}
mdb_warn("failed to read 'inohsz'");
return (WALK_ERR);
}
if (inohsz == 0)
return (WALK_DONE);
mdb_warn("failed to read 'ihead'");
return (WALK_ERR);
}
return (WALK_DONE);
}
iw->iw_inohcnt = 0;
return (WALK_NEXT);
}
static int
{
return (WALK_DONE);
return (WALK_DONE);
}
}
return (WALK_DONE);
}
wsp->walk_cbdata));
}
static void
{
}
typedef struct inode_cbdata {
static int
{
int inohsz;
return (WALK_ERR);
}
return (WALK_NEXT);
return (WALK_NEXT);
return (WALK_NEXT);
return (WALK_NEXT);
}
mdb_printf("%0?p %10lld %15lx",
/*
* INOHASH needs inohsz.
*/
mdb_warn("failed to read 'inohsz'");
return (WALK_ERR);
}
/*
* Is the inode in the hash chain it should be?
*/
} else {
mdb_printf(" %<b>%5d/%5d ??</b>\n",
}
return (WALK_NEXT);
}
/*ARGSUSED*/
static int
{
id.id_inumber = 0;
return (DCMD_USAGE);
mdb_printf("%<u>%-?s %10s %15s %5s%</u>\n",
"ADDR", "INUMBER", "DEVICE", "CHAIN");
}
mdb_warn("can't walk inode cache");
return (DCMD_ERR);
}
return (DCMD_OK);
}
/*ARGSUSED*/
static int
{
{ NULL, 0, 0 }
};
{ NULL, 0, 0 }
};
if (!(flags & DCMD_ADDRSPEC))
return (DCMD_USAGE);
return (DCMD_USAGE);
mdb_printf("%<u>%-?s %10s %1s %5s %8s",
"ADDR", "INUMBER", "T", "MODE", "SIZE");
if (verbose)
else
}
return (DCMD_ERR);
}
mdb_printf("%0?p %10lld %b %5#o %8llx",
if (verbose) {
mdb_printf(" %11lx <%b>\n",
mdb_inc_indent(2);
else
mdb_printf("??\n");
mdb_dec_indent(2);
return (DCMD_OK);
}
/*
* Not verbose, everything must fit into one line.
*/
else
else
} else {
mdb_printf(" ??\n");
}
return (DCMD_OK);
}
static struct {
int am_offset;
char *am_tag;
} acl_map[] = {
{ -1, NULL }
};
static int
{
mdb_warn("acl walk needs an inode address\n");
return (WALK_ERR);
}
return (WALK_ERR);
}
return (WALK_DONE);
return (WALK_ERR);
}
/* LINTED - alignment */
return (WALK_NEXT);
}
static int
{
return (WALK_DONE);
/* LINTED - alignment */
}
return (WALK_DONE);
}
}
static void
{
}
static int
{
mdb_printf("%?p %-16s %7#o %10d\n",
return (WALK_NEXT);
}
/*ARGSUSED*/
static int
{
if (!(flags & DCMD_ADDRSPEC))
return (DCMD_USAGE);
if (argc != 0)
return (DCMD_USAGE);
if (DCMD_HDRSPEC(flags)) {
mdb_printf("%<u>%?s %-16s %7s %10s%</u>\n",
"ADDR", "TAG", "PERM", "WHO");
}
return (DCMD_ERR);
}
return (DCMD_OK);
}
static int
{
mdb_warn("couldn't walk bio buf hash");
return (WALK_ERR);
}
return (WALK_NEXT);
}
static int
{
return (WALK_ERR);
}
return (WALK_NEXT);
}
static void
{
int i, j, len;
for (i = 0; i < max; i++) {
j = i;
i++;
if (i != j)
if (linecnt == -1) {
/* first entry */
/* subsequent entry on same line */
} else {
/* subsequent enty on new line */
}
}
}
mdb_printf("\n");
}
/*ARGSUSED*/
static int
{
short *blks;
if (!(flags & DCMD_ADDRSPEC)) {
mdb_warn("can't walk cylinder group structs");
return (DCMD_ERR);
}
return (DCMD_OK);
}
return (DCMD_USAGE);
return (DCMD_ERR);
}
if (!verbose) {
if (DCMD_HDRSPEC(flags))
mdb_printf("%<u>%4s %?s %10s %10s %10s %10s%</u>\n",
"CGX", "CG", "NDIR", "NBFREE", "NIFREE", "NFFREE");
return (DCMD_OK);
}
/*
* Verbose: produce output similiar to "fstyp -v".
*/
return (DCMD_ERR);
}
return (DCMD_ERR);
}
mdb_inc_indent(4);
mdb_printf("frsum:");
for (i = 1; i < MAXFRAG; i++)
mdb_printf("\n");
mdb_inc_indent(4);
mdb_dec_indent(4);
mdb_inc_indent(4);
mdb_dec_indent(4);
/* LINTED - alignment */
/* LINTED - alignment */
mdb_printf("free block positions:\n");
mdb_inc_indent(4);
for (j = 0; j < cnt; j++)
mdb_printf("\n");
}
mdb_dec_indent(4);
mdb_printf("\n");
mdb_dec_indent(4);
return (DCMD_OK);
}
void
inode_cache_help(void)
{
"device is specified, searches inode cache for inodes which match\n"
"the specified criteria. Prints nothing but the address, if\n"
"output is a pipe.\n"
"\n"
"Options:\n"
" -d device Filter out inodes, which reside on the specified"
" device.\n"
" -i inumber Filter out inodes with the specified inode"
" number.\n");
}
/*
* MDB module linkage
*/
{ "inode_cache", "?[-d device] [-i inumber]",
{ NULL }
};
{ "inode_cache", "walk inode cache",
{ "acl", "given an inode, walk chains of in core acl's",
{ "cg", "walk cg's in bio buffer cache",
{ "ufslogmap", "walk map entries in a ufs_log mt_map",
{ NULL }
};
const mdb_modinfo_t *
_mdb_init(void)
{
return (&modinfo);
}