/*
* 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 2011 Nexenta Systems, Inc. All rights reserved.
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#include <sys/mdb_modapi.h>
#include <sys/refstr_impl.h>
#include <smbfs/smbfs_node.h>
/*
* This macro lets us easily use both sizeof (typename)
* and the string-ified typename for the error message.
*/
!= sizeof (obj_type)) { \
return (err); \
}
/*
* We need to read in a private copy
* of every string we want to print out.
*/
void
{
} else {
}
}
/*
* Dcmd (and callback function) to print a summary of
* all "smbfs" entries in the VFS list.
*/
typedef struct smbfs_vfs_cbdata {
int flags;
int printed_header;
int
{
/* Filter by matching smbfs ops vector. */
return (WALK_NEXT);
}
if (cbd->printed_header == 0) {
mdb_printf("// vfs_t smbmntinfo_t mnt_path\n");
}
/*
* Note: vfs_mntpt is a refstr_t.
* Advance to string member.
*/
mdb_printf("\n");
mdb_inc_indent(2);
/* Don't fail the walk if this fails. */
mdb_warn("error reading smbmntinfo_t at %p",
} else {
/* Interesting parts of smbmntinfo_t */
mdb_printf("smi_share: %p, smi_root: %p\n",
}
mdb_dec_indent(2);
}
return (WALK_NEXT);
}
int
{
/*
* Get the ops address here, so things work
* even if the smbfs module is loaded later
* than this mdb module.
*/
mdb_warn("failed to find 'smbfs_vfsops'\n");
return (DCMD_ERR);
}
return (DCMD_USAGE);
}
if (!(flags & DCMD_ADDRSPEC)) {
== -1) {
mdb_warn("can't walk smbfs vfs");
return (DCMD_ERR);
}
return (DCMD_OK);
}
return (DCMD_OK);
}
void
smbfs_vfs_help(void)
{
"Display addresses of the mounted smbfs structures\n"
"and the pathname of the mountpoint\n"
"\nOptions:\n"
" -v display details of the smbmntinfo\n");
}
/*
* Dcmd (and callback function) to print a summary of
* all smbnodes in the node "hash" (cache) AVL tree.
*/
typedef struct smbfs_node_cbdata {
int flags;
int printed_header;
int
{
if (cbd->printed_header == 0) {
mdb_printf("// vnode smbnode rpath\n");
}
mdb_printf("\n");
mdb_inc_indent(2);
/* Don't fail the walk if this fails. */
mdb_warn("error reading vnode_t at %p",
} else {
/* Interesting parts of vnode_t */
mdb_printf("v_type=%d v_count=%d",
mdb_printf("\n");
}
mdb_dec_indent(2);
}
return (WALK_NEXT);
}
int
{
return (DCMD_USAGE);
}
if (!(flags & DCMD_ADDRSPEC)) {
mdb_warn("expect an smbmntinfo_t addr");
return (DCMD_USAGE);
}
mdb_warn("cannot walk smbfs nodes");
return (DCMD_ERR);
}
return (DCMD_OK);
}
void
smbfs_node_help(void)
{
mdb_printf("Options:\n"
" -v be verbose when displaying smbnodes\n");
}
{
"smbfs_vfs", "?[-v]",
"show smbfs-mounted vfs structs",
},
{
"smbfs_node", "?[-v]",
"given an smbmntinfo_t, list smbnodes",
},
{NULL}
};
{NULL}
};
};
const mdb_modinfo_t *
_mdb_init(void)
{
return (&modinfo);
}