1123 * If '-r' is specified, recursively visit all children.
1124 *
1125 * With '-e', the statistics associated with the vdev are printed as well.
1126 */
1127 static int
1128 do_print_vdev(uintptr_t addr, int flags, int depth, int stats,
1129 int recursive)
1130 {
1131 vdev_t vdev;
1132 char desc[MAXNAMELEN];
1133 int c, children;
1134 uintptr_t *child;
1135 const char *state, *aux;
1136
1137 if (mdb_vread(&vdev, sizeof (vdev), (uintptr_t)addr) == -1) {
1138 mdb_warn("failed to read vdev_t at %p\n", (uintptr_t)addr);
1139 return (DCMD_ERR);
1140 }
1141
1142 if (flags & DCMD_PIPE_OUT) {
1143 mdb_printf("%#lr", addr);
1144 } else {
1145 if (vdev.vdev_path != NULL) {
1146 if (mdb_readstr(desc, sizeof (desc),
1147 (uintptr_t)vdev.vdev_path) == -1) {
1148 mdb_warn("failed to read vdev_path at %p\n",
1149 vdev.vdev_path);
1150 return (DCMD_ERR);
1151 }
1152 } else if (vdev.vdev_ops != NULL) {
1153 vdev_ops_t ops;
1154 if (mdb_vread(&ops, sizeof (ops),
1155 (uintptr_t)vdev.vdev_ops) == -1) {
1156 mdb_warn("failed to read vdev_ops at %p\n",
1157 vdev.vdev_ops);
1158 return (DCMD_ERR);
1159 }
1160 (void) strcpy(desc, ops.vdev_op_type);
1161 } else {
1162 (void) strcpy(desc, "<unknown>");
1163 }
|
1123 * If '-r' is specified, recursively visit all children.
1124 *
1125 * With '-e', the statistics associated with the vdev are printed as well.
1126 */
1127 static int
1128 do_print_vdev(uintptr_t addr, int flags, int depth, int stats,
1129 int recursive)
1130 {
1131 vdev_t vdev;
1132 char desc[MAXNAMELEN];
1133 int c, children;
1134 uintptr_t *child;
1135 const char *state, *aux;
1136
1137 if (mdb_vread(&vdev, sizeof (vdev), (uintptr_t)addr) == -1) {
1138 mdb_warn("failed to read vdev_t at %p\n", (uintptr_t)addr);
1139 return (DCMD_ERR);
1140 }
1141
1142 if (flags & DCMD_PIPE_OUT) {
1143 mdb_printf("%#lr\n", addr);
1144 } else {
1145 if (vdev.vdev_path != NULL) {
1146 if (mdb_readstr(desc, sizeof (desc),
1147 (uintptr_t)vdev.vdev_path) == -1) {
1148 mdb_warn("failed to read vdev_path at %p\n",
1149 vdev.vdev_path);
1150 return (DCMD_ERR);
1151 }
1152 } else if (vdev.vdev_ops != NULL) {
1153 vdev_ops_t ops;
1154 if (mdb_vread(&ops, sizeof (ops),
1155 (uintptr_t)vdev.vdev_ops) == -1) {
1156 mdb_warn("failed to read vdev_ops at %p\n",
1157 vdev.vdev_ops);
1158 return (DCMD_ERR);
1159 }
1160 (void) strcpy(desc, ops.vdev_op_type);
1161 } else {
1162 (void) strcpy(desc, "<unknown>");
1163 }
|