Print this page
NEX-16818 Add fksmbcl development tool
NEX-17264 SMB client test tp_smbutil_013 fails after NEX-14666
Reviewed by: Evan Layton <evan.layton@nexenta.com>
Reviewed by: Matt Barden <matt.barden@nexenta.com>
and: (fix ref leaks)
*** 18,34 ****
*
* 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/types.h>
#include <sys/refstr_impl.h>
#include <sys/vnode.h>
#include <sys/vfs.h>
#include <smbfs/smbfs.h>
--- 18,40 ----
*
* CDDL HEADER END
*/
/*
! * Copyright 2017 Nexenta Systems, Inc. All rights reserved.
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#include <sys/types.h>
+ #include <sys/mdb_modapi.h>
+
+ #ifdef _USER
+ #include "../genunix/avl.h"
+ #define _FAKE_KERNEL
+ #endif
+
#include <sys/refstr_impl.h>
#include <sys/vnode.h>
#include <sys/vfs.h>
#include <smbfs/smbfs.h>
*** 147,157 ****
NULL) != argc) {
return (DCMD_USAGE);
}
if (!(flags & DCMD_ADDRSPEC)) {
! if (mdb_walk("genunix`vfs", smbfs_vfs_cb, cbd)
== -1) {
mdb_warn("can't walk smbfs vfs");
return (DCMD_ERR);
}
return (DCMD_OK);
--- 153,163 ----
NULL) != argc) {
return (DCMD_USAGE);
}
if (!(flags & DCMD_ADDRSPEC)) {
! if (mdb_walk("vfs", smbfs_vfs_cb, cbd)
== -1) {
mdb_warn("can't walk smbfs vfs");
return (DCMD_ERR);
}
return (DCMD_OK);
*** 236,246 ****
mdb_warn("expect an smbmntinfo_t addr");
return (DCMD_USAGE);
}
addr += OFFSETOF(smbmntinfo_t, smi_hash_avl);
! if (mdb_pwalk("genunix`avl", smbfs_node_cb, cbd, addr) == -1) {
mdb_warn("cannot walk smbfs nodes");
return (DCMD_ERR);
}
return (DCMD_OK);
--- 242,252 ----
mdb_warn("expect an smbmntinfo_t addr");
return (DCMD_USAGE);
}
addr += OFFSETOF(smbmntinfo_t, smi_hash_avl);
! if (mdb_pwalk("avl", smbfs_node_cb, cbd, addr) == -1) {
mdb_warn("cannot walk smbfs nodes");
return (DCMD_ERR);
}
return (DCMD_OK);
*** 265,278 ****
--- 271,333 ----
smbfs_node_dcmd, smbfs_node_help
},
{NULL}
};
+ #ifdef _USER
+ /*
+ * Sadly, can't just compile ../genunix/vfs.c with this since
+ * it has become a catch-all for FS-specific headers etc.
+ */
+ int
+ vfs_walk_init(mdb_walk_state_t *wsp)
+ {
+ if (wsp->walk_addr == NULL &&
+ mdb_readvar(&wsp->walk_addr, "rootvfs") == -1) {
+ mdb_warn("failed to read 'rootvfs'");
+ return (WALK_ERR);
+ }
+
+ wsp->walk_data = (void *)wsp->walk_addr;
+ return (WALK_NEXT);
+ }
+
+ int
+ vfs_walk_step(mdb_walk_state_t *wsp)
+ {
+ vfs_t vfs;
+ int status;
+
+ if (mdb_vread(&vfs, sizeof (vfs), wsp->walk_addr) == -1) {
+ mdb_warn("failed to read vfs_t at %p", wsp->walk_addr);
+ return (WALK_DONE);
+ }
+
+ status = wsp->walk_callback(wsp->walk_addr, &vfs, wsp->walk_cbdata);
+
+ if (vfs.vfs_next == wsp->walk_data)
+ return (WALK_DONE);
+
+ wsp->walk_addr = (uintptr_t)vfs.vfs_next;
+
+ return (status);
+ }
+ #endif // _USER
+
static const mdb_walker_t walkers[] = {
+ #ifdef _USER
+ /* from avl.c */
+ { AVL_WALK_NAME, AVL_WALK_DESC,
+ avl_walk_init, avl_walk_step, avl_walk_fini },
+ /* from vfs.c */
+ { "vfs", "walk file system list",
+ vfs_walk_init, vfs_walk_step },
+ #endif // _USER
{NULL}
};
+
static const mdb_modinfo_t modinfo = {
MDB_API_VERSION,
dcmds,
walkers
};