/* ARGSUSED */ int hotsparepool_walk_init(mdb_walk_state_t *wsp) { uintptr_t addr; snarf_sets(); addr = (uintptr_t)mdset[0].s_hsp; wsp->walk_data = mdb_alloc(sizeof (int), UM_SLEEP); /* walk_data hold the number of the set we're walking */ *((int *)wsp->walk_data) = 0; mdb_printf("Hotspare Pools for set number 0\n"); wsp->walk_addr = addr; return (WALK_NEXT); }
/* ARGSUSED */ int metaset(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv) { snarf_sets(); if (!(flags & DCMD_ADDRSPEC)) { if (mdb_walk_dcmd("md_sets", "metaset", argc, argv) == -1) { mdb_warn("failed to walk sets"); return (DCMD_ERR); } return (DCMD_OK); } print_set(addr); return (DCMD_OK); }
/* ARGSUSED */ int set_io(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv) { GElf_Sym setiosym; uint64_t i; size_t offset = 0; uint64_t opt_a = 0; /* up to active_sets */ char *opt_s = (char *)NULL; /* a named set */ uint64_t opt_m = 0; /* array element */ int setno = 0; int argnum = 0; argnum = mdb_getopts(argc, argv, 'a', MDB_OPT_UINT64, &opt_a, 's', MDB_OPT_STR, &opt_s, 'm', MDB_OPT_UINT64, &opt_m, NULL); if (argnum != argc) { mdb_printf("invalid arguments\n"); return (DCMD_USAGE); } if ((opt_s != 0) && (opt_m != 0)) { mdb_printf("-s and -m cannot both be specified\n"); return (DCMD_USAGE); } snarf_sets(); if (opt_a == 0) opt_a = active_sets; /* find the array */ if (mdb_lookup_by_name("md_set_io", &setiosym) == -1) { mdb_warn("SVM - no set io counts set\n"); return (DCMD_ERR); } if (md_verbose) { mdb_printf("Base address for the md_set_io array: %p\n", setiosym.st_value); } if (opt_s != NULL) { setno = findset(opt_s); if (setno == -1) { mdb_warn("no such set: %s\n", opt_s); return (DCMD_ERR); } opt_m = setno; } if (opt_m > 0) { mdb_printf("%lld]\t%ld\t%ld", opt_m, md_setio[opt_m].io_cnt, md_setio[opt_m].io_state); mdb_printf("\t%hb\n", io_state_bits); return (DCMD_OK); } if (opt_a == 0) { mdb_warn("No active set!\n"); return (DCMD_ERR); } for (i = 0; i < opt_a; i++) { if (mdb_vread(&md_setio[i], sizeof (md_set_io_t), setiosym.st_value + offset) == -1) { mdb_warn("failed to read md_set_io_t at 0x%x\n", setiosym.st_value + offset); } mdb_printf("%lld]\t%ld\t%ld", i, md_setio[i].io_cnt, md_setio[i].io_state); mdb_printf("\t%hb", io_state_bits); if (md_verbose) { mdb_printf(" - io_cnt: %p", setiosym.st_value + offset + sizeof (kmutex_t) + sizeof (kcondvar_t)); mdb_printf(" %d", sizeof (md_set_io_t)); } mdb_printf("\n"); offset += sizeof (md_set_io_t); } return (DCMD_OK); }