4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
23 * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
27 #include <sys/mdb_modapi.h>
31 #include "ipath_impl.h"
33 #include "config_impl.h"
34 #include "stats_impl.h"
36 #define LUT_SIZE_INIT 300
37 #define LUT_SIZE_INCR 100
44 #define LCPSZ sizeof (struct lut_cp)
46 struct lut_dump_desc
{
47 struct lut_cp
*ld_array
;
53 lut_dump_array_alloc(struct lut_dump_desc
*lddp
)
57 if (lddp
->ld_array
== NULL
) {
58 lddp
->ld_arraysz
= LUT_SIZE_INIT
;
59 lddp
->ld_array
= mdb_zalloc(LUT_SIZE_INIT
* LCPSZ
, UM_SLEEP
);
63 new = mdb_zalloc((lddp
->ld_arraysz
+ LUT_SIZE_INCR
) * LCPSZ
, UM_SLEEP
);
64 bcopy(lddp
->ld_array
, new, lddp
->ld_arraysz
* LCPSZ
);
65 mdb_free(lddp
->ld_array
, lddp
->ld_arraysz
* LCPSZ
);
67 lddp
->ld_arraysz
+= LUT_SIZE_INCR
;
71 lut_dump_array_free(struct lut_dump_desc
*lddp
)
73 if (lddp
->ld_array
!= NULL
) {
74 mdb_free(lddp
->ld_array
, lddp
->ld_arraysz
* LCPSZ
);
75 lddp
->ld_array
= NULL
;
80 lut_collect_addent(uintptr_t addr
, struct lut
*ent
, struct lut_dump_desc
*lddp
)
84 if (lddp
->ld_nents
== lddp
->ld_arraysz
)
85 lut_dump_array_alloc(lddp
);
87 lcp
= &lddp
->ld_array
[lddp
->ld_nents
++];
89 lcp
->lutcp_addr
= addr
;
90 bcopy(ent
, &lcp
->lutcp_lut
, sizeof (struct lut
));
94 eft_lut_walk(uintptr_t root
, struct lut_dump_desc
*lddp
)
99 if (mdb_vread(&lutent
, sizeof (struct lut
), root
) !=
100 sizeof (struct lut
)) {
101 mdb_warn("failed to read struct lut at %p", root
);
105 if (eft_lut_walk((uintptr_t)lutent
.lut_left
, lddp
) != WALK_NEXT
)
108 lut_collect_addent(root
, &lutent
, lddp
);
110 if (eft_lut_walk((uintptr_t)lutent
.lut_right
, lddp
) !=
118 lut_collect(uintptr_t addr
, struct lut_dump_desc
*lddp
)
120 lut_dump_array_alloc(lddp
);
122 if (eft_lut_walk(addr
, lddp
) != WALK_NEXT
) {
123 lut_dump_array_free(lddp
);
126 return (WALK_NEXT
); /* caller must free dump array */
131 lut_walk_init(mdb_walk_state_t
*wsp
)
133 if (wsp
->walk_addr
== NULL
) {
134 mdb_warn("lut walker requires a lut table address\n");
138 wsp
->walk_data
= mdb_zalloc(sizeof (struct lut_dump_desc
), UM_SLEEP
);
141 if (lut_collect(wsp
->walk_addr
, wsp
->walk_data
) == WALK_NEXT
) {
144 mdb_warn("failed to suck in full lut\n");
145 mdb_free(wsp
->walk_data
, sizeof (struct lut_dump_desc
));
151 lut_walk_step(mdb_walk_state_t
*wsp
)
153 struct lut_dump_desc
*lddp
= wsp
->walk_data
;
154 int *ip
= (int *)&wsp
->walk_arg
;
155 struct lut_cp
*lcp
= &lddp
->ld_array
[*ip
];
157 if (*ip
== lddp
->ld_nents
)
162 return (wsp
->walk_callback(lcp
->lutcp_addr
, &lcp
->lutcp_lut
,
167 ipath_walk_init(mdb_walk_state_t
*wsp
)
171 ipath
= mdb_alloc(sizeof (struct ipath
), UM_SLEEP
);
173 if (mdb_vread((void *)ipath
, sizeof (struct ipath
),
174 wsp
->walk_addr
) != sizeof (struct ipath
)) {
175 mdb_warn("failed to read struct ipath at %p", wsp
->walk_addr
);
178 wsp
->walk_data
= (void *)ipath
;
180 if (ipath
->s
== NULL
)
187 ipath_walk_fini(mdb_walk_state_t
*wsp
)
189 mdb_free(wsp
->walk_data
, sizeof (struct ipath
));
193 ipath_walk_step(mdb_walk_state_t
*wsp
)
196 struct ipath
*ipath
= (struct ipath
*)wsp
->walk_data
;
197 struct ipath
*ip
= (struct ipath
*)wsp
->walk_addr
;
199 if (ip
== NULL
|| ipath
->s
== NULL
)
202 status
= wsp
->walk_callback(wsp
->walk_addr
, wsp
->walk_data
,
205 wsp
->walk_addr
= (uintptr_t)(ip
+ 1);
207 if (mdb_vread(wsp
->walk_data
, sizeof (struct ipath
),
208 wsp
->walk_addr
) != sizeof (struct ipath
)) {
209 mdb_warn("failed to read struct ipath at %p", wsp
->walk_addr
);
217 lut_walk_fini(mdb_walk_state_t
*wsp
)
219 struct lut_dump_desc
*lddp
= wsp
->walk_data
;
221 lut_dump_array_free(lddp
);
222 mdb_free(lddp
, sizeof (struct lut_dump_desc
));
227 ipath_node(uintptr_t addr
, const void *data
, void *arg
)
229 struct ipath
*ipath
= (struct ipath
*)data
;
232 if (mdb_readstr(buf
, (size_t)sizeof (buf
), (uintptr_t)ipath
->s
) < 0)
233 (void) mdb_snprintf(buf
, (size_t)sizeof (buf
), "<%p>",
236 mdb_printf("/%s=%d", buf
, ipath
->i
);
242 ipath(uintptr_t addr
, uint_t flags
, int argc
, const mdb_arg_t
*argv
)
246 if (!(flags
& DCMD_ADDRSPEC
))
247 addr
= mdb_get_dot();
248 if (mdb_pwalk("eft_ipath", ipath_node
, NULL
, addr
) != 0)
255 eft_count(uintptr_t addr
, uint_t flags
, int argc
, const mdb_arg_t
*argv
)
258 struct istat_entry istat_entry
;
265 if (!(flags
& DCMD_ADDRSPEC
)) {
266 if (mdb_lookup_by_obj(MDB_OBJ_EVERY
, "Istats", &sym
) == -1 ||
267 sym
.st_size
!= sizeof (addr
))
269 if (mdb_vread(&addr
, sizeof (addr
),
270 (uintptr_t)sym
.st_value
) != sizeof (addr
))
274 if (mdb_pwalk_dcmd("lut", "eft_count", argc
, argv
, addr
) != 0)
279 if (mdb_vread(&lut
, sizeof (struct lut
), addr
) != sizeof (struct lut
)) {
280 mdb_warn("failed to read struct lut at %p", addr
);
283 if (mdb_vread(&istat_entry
, sizeof (struct istat_entry
),
284 (uintptr_t)lut
.lut_lhs
) != sizeof (struct istat_entry
)) {
285 mdb_warn("failed to read struct istat_entry at %p", addr
);
288 if (mdb_vread(&count
, sizeof (struct stats
),
289 (uintptr_t)lut
.lut_rhs
) != sizeof (struct stats
)) {
290 mdb_warn("failed to read struct stats at %p", addr
);
294 if (mdb_readstr(buf
, (size_t)sizeof (buf
),
295 (uintptr_t)istat_entry
.ename
) < 0)
296 (void) mdb_snprintf(buf
, (size_t)sizeof (buf
), "<%p>",
299 mdb_printf("%s@", buf
);
300 (void) ipath((uintptr_t)istat_entry
.ipath
, DCMD_ADDRSPEC
, 0, NULL
);
301 mdb_printf(" %d\n", count
.fmd_stats
.fmds_value
.i32
);
307 eft_time(uintptr_t addr
, uint_t flags
, int argc
, const mdb_arg_t
*argv
)
309 unsigned long long val
;
310 unsigned long long ull
;
313 if (!(flags
& DCMD_ADDRSPEC
))
314 addr
= mdb_get_dot();
317 if (mdb_getopts(argc
, argv
,
318 'l', MDB_OPT_UINT64
, &ull
,
319 'p', MDB_OPT_SETBITS
, TRUE
, &opt_p
,
320 MDB_OPT_UINT64
) != argc
) {
325 if (mdb_vread(&ull
, sizeof (ull
), addr
) != sizeof (ull
)) {
326 mdb_warn("failed to read timeval at %p", addr
);
330 #define NOREMAINDER(den, num, val) (((val) = ((den) / (num))) * (num) == (den))
333 else if (ull
>= TIMEVAL_EVENTUALLY
)
334 mdb_printf("infinity");
335 else if (NOREMAINDER(ull
, 1000000000ULL*60*60*24*365, val
))
336 mdb_printf("%lluyear%s", val
, (val
== 1) ? "" : "s");
337 else if (NOREMAINDER(ull
, 1000000000ULL*60*60*24*30, val
))
338 mdb_printf("%llumonth%s", val
, (val
== 1) ? "" : "s");
339 else if (NOREMAINDER(ull
, 1000000000ULL*60*60*24*7, val
))
340 mdb_printf("%lluweek%s", val
, (val
== 1) ? "" : "s");
341 else if (NOREMAINDER(ull
, 1000000000ULL*60*60*24, val
))
342 mdb_printf("%lluday%s", val
, (val
== 1) ? "" : "s");
343 else if (NOREMAINDER(ull
, 1000000000ULL*60*60, val
))
344 mdb_printf("%lluhour%s", val
, (val
== 1) ? "" : "s");
345 else if (NOREMAINDER(ull
, 1000000000ULL*60, val
))
346 mdb_printf("%lluminute%s", val
, (val
== 1) ? "" : "s");
347 else if (NOREMAINDER(ull
, 1000000000ULL, val
))
348 mdb_printf("%llusecond%s", val
, (val
== 1) ? "" : "s");
349 else if (NOREMAINDER(ull
, 1000000ULL, val
))
350 mdb_printf("%llums", val
);
351 else if (NOREMAINDER(ull
, 1000ULL, val
))
352 mdb_printf("%lluus", val
);
354 mdb_printf("%lluns", ull
);
361 eft_node(uintptr_t addr
, uint_t flags
, int argc
, const mdb_arg_t
*argv
)
367 if (!(flags
& DCMD_ADDRSPEC
))
368 addr
= mdb_get_dot();
370 if (mdb_getopts(argc
, argv
,
371 'v', MDB_OPT_SETBITS
, TRUE
, &opt_v
,
378 if (mdb_vread(&node
, sizeof (node
), addr
) != sizeof (node
)) {
379 mdb_warn("failed to read struct node at %p", addr
);
383 if (mdb_readstr(buf
, (size_t)sizeof (buf
),
384 (uintptr_t)node
.file
) < 0)
385 (void) mdb_snprintf(buf
, (size_t)sizeof (buf
), "<%p>",
388 mdb_printf("%s len %d\n", buf
, node
.line
);
391 case T_NOTHING
: /* used to keep going on error cases */
392 mdb_printf("nothing");
394 case T_NAME
: /* identifiers, sometimes chained */
395 if (mdb_readstr(buf
, (size_t)sizeof (buf
),
396 (uintptr_t)node
.u
.name
.s
) < 0)
397 (void) mdb_snprintf(buf
, (size_t)sizeof (buf
), "<%p>",
400 mdb_printf("%s", buf
);
401 if (node
.u
.name
.cp
) {
403 if (mdb_vread(&cp
, sizeof (cp
),
404 (uintptr_t)node
.u
.name
.cp
) != sizeof (cp
)) {
405 mdb_warn("failed to read struct config at %p",
409 mdb_printf("%d", cp
.num
);
410 } else if (node
.u
.name
.it
== IT_HORIZONTAL
) {
411 if (node
.u
.name
.child
&& !node
.u
.name
.childgen
) {
413 (void) eft_node((uintptr_t)node
.u
.name
.child
,
414 DCMD_ADDRSPEC
, 0, NULL
);
419 } else if (node
.u
.name
.child
) {
421 (void) eft_node((uintptr_t)node
.u
.name
.child
,
422 DCMD_ADDRSPEC
, 0, NULL
);
425 if (node
.u
.name
.next
) {
426 if (node
.u
.name
.it
== IT_ENAME
)
430 (void) eft_node((uintptr_t)node
.u
.name
.next
,
431 DCMD_ADDRSPEC
, 0, NULL
);
434 case T_GLOBID
: /* globals (e.g. $a) */
435 if (mdb_readstr(buf
, (size_t)sizeof (buf
),
436 (uintptr_t)node
.u
.globid
.s
) < 0)
437 (void) mdb_snprintf(buf
, (size_t)sizeof (buf
), "<%p>",
440 mdb_printf("$%s", buf
);
442 case T_EVENT
: /* class@path{expr} */
443 (void) eft_node((uintptr_t)node
.u
.event
.ename
, DCMD_ADDRSPEC
, 0,
446 (void) eft_node((uintptr_t)node
.u
.event
.epname
, DCMD_ADDRSPEC
,
448 if (node
.u
.event
.eexprlist
) {
450 (void) eft_node((uintptr_t)node
.u
.event
.eexprlist
,
451 DCMD_ADDRSPEC
, 0, NULL
);
455 case T_ENGINE
: /* upset threshold engine (e.g. SERD) */
456 mdb_printf("engine ");
457 (void) eft_node((uintptr_t)node
.u
.event
.ename
, DCMD_ADDRSPEC
, 0,
460 case T_ASRU
: /* ASRU declaration */
462 (void) eft_node((uintptr_t)node
.u
.stmt
.np
, DCMD_ADDRSPEC
, 0,
464 if (node
.u
.stmt
.nvpairs
) {
466 (void) eft_node((uintptr_t)node
.u
.stmt
.nvpairs
,
467 DCMD_ADDRSPEC
, 0, NULL
);
471 case T_FRU
: /* FRU declaration */
473 (void) eft_node((uintptr_t)node
.u
.stmt
.np
, DCMD_ADDRSPEC
, 0,
475 if (node
.u
.stmt
.nvpairs
) {
477 (void) eft_node((uintptr_t)node
.u
.stmt
.nvpairs
,
478 DCMD_ADDRSPEC
, 0, NULL
);
482 case T_TIMEVAL
: /* num w/time suffix (ns internally) */
484 mdb_arg_t mdb_arg
[2];
485 mdb_arg
[0].a_type
= MDB_TYPE_STRING
;
486 mdb_arg
[0].a_un
.a_str
= "-l";
487 mdb_arg
[1].a_type
= MDB_TYPE_IMMEDIATE
;
488 mdb_arg
[1].a_un
.a_val
= node
.u
.ull
;
489 (void) eft_time((uintptr_t)0, 0, 2, mdb_arg
);
492 case T_NUM
: /* num (ull internally) */
493 mdb_printf("%llu", node
.u
.ull
);
495 case T_QUOTE
: /* quoted string */
496 if (mdb_readstr(buf
, (size_t)sizeof (buf
),
497 (uintptr_t)node
.u
.quote
.s
) < 0)
498 (void) mdb_snprintf(buf
, (size_t)sizeof (buf
), "<%p>",
501 mdb_printf("\"%s\"", buf
);
503 case T_FUNC
: /* func(arglist) */
504 if (mdb_readstr(buf
, (size_t)sizeof (buf
),
505 (uintptr_t)node
.u
.func
.s
) < 0)
506 (void) mdb_snprintf(buf
, (size_t)sizeof (buf
), "<%p>",
509 mdb_printf("%s(", buf
);
510 (void) eft_node((uintptr_t)node
.u
.func
.arglist
, DCMD_ADDRSPEC
,
514 case T_NVPAIR
: /* name=value pair in decl */
515 (void) eft_node((uintptr_t)node
.u
.expr
.left
, DCMD_ADDRSPEC
, 0,
518 (void) eft_node((uintptr_t)node
.u
.expr
.right
, DCMD_ADDRSPEC
, 0,
521 case T_ASSIGN
: /* assignment statement */
523 (void) eft_node((uintptr_t)node
.u
.expr
.left
, DCMD_ADDRSPEC
, 0,
526 (void) eft_node((uintptr_t)node
.u
.expr
.right
, DCMD_ADDRSPEC
, 0,
530 case T_CONDIF
: /* a and T_CONDELSE in (a ? b : c ) */
532 (void) eft_node((uintptr_t)node
.u
.expr
.left
, DCMD_ADDRSPEC
, 0,
535 (void) eft_node((uintptr_t)node
.u
.expr
.right
, DCMD_ADDRSPEC
, 0,
539 case T_CONDELSE
: /* lists b and c in (a ? b : c ) */
540 (void) eft_node((uintptr_t)node
.u
.expr
.left
, DCMD_ADDRSPEC
, 0,
543 (void) eft_node((uintptr_t)node
.u
.expr
.right
, DCMD_ADDRSPEC
, 0,
546 case T_NOT
: /* boolean ! operator */
548 (void) eft_node((uintptr_t)node
.u
.expr
.left
, DCMD_ADDRSPEC
, 0,
551 case T_AND
: /* boolean && operator */
552 (void) eft_node((uintptr_t)node
.u
.expr
.left
, DCMD_ADDRSPEC
, 0,
555 (void) eft_node((uintptr_t)node
.u
.expr
.right
, DCMD_ADDRSPEC
, 0,
558 case T_OR
: /* boolean || operator */
559 (void) eft_node((uintptr_t)node
.u
.expr
.left
, DCMD_ADDRSPEC
, 0,
562 (void) eft_node((uintptr_t)node
.u
.expr
.right
, DCMD_ADDRSPEC
, 0,
565 case T_EQ
: /* boolean == operator */
566 (void) eft_node((uintptr_t)node
.u
.expr
.left
, DCMD_ADDRSPEC
, 0,
569 (void) eft_node((uintptr_t)node
.u
.expr
.right
, DCMD_ADDRSPEC
, 0,
572 case T_NE
: /* boolean != operator */
573 (void) eft_node((uintptr_t)node
.u
.expr
.left
, DCMD_ADDRSPEC
, 0,
576 (void) eft_node((uintptr_t)node
.u
.expr
.right
, DCMD_ADDRSPEC
, 0,
579 case T_SUB
: /* integer - operator */
580 (void) eft_node((uintptr_t)node
.u
.expr
.left
, DCMD_ADDRSPEC
, 0,
583 (void) eft_node((uintptr_t)node
.u
.expr
.right
, DCMD_ADDRSPEC
, 0,
586 case T_ADD
: /* integer + operator */
587 (void) eft_node((uintptr_t)node
.u
.expr
.left
, DCMD_ADDRSPEC
, 0,
590 (void) eft_node((uintptr_t)node
.u
.expr
.right
, DCMD_ADDRSPEC
, 0,
593 case T_MUL
: /* integer * operator */
594 (void) eft_node((uintptr_t)node
.u
.expr
.left
, DCMD_ADDRSPEC
, 0,
597 (void) eft_node((uintptr_t)node
.u
.expr
.right
, DCMD_ADDRSPEC
, 0,
600 case T_DIV
: /* integer / operator */
601 (void) eft_node((uintptr_t)node
.u
.expr
.left
, DCMD_ADDRSPEC
, 0,
604 (void) eft_node((uintptr_t)node
.u
.expr
.right
, DCMD_ADDRSPEC
, 0,
607 case T_MOD
: /* integer % operator */
608 (void) eft_node((uintptr_t)node
.u
.expr
.left
, DCMD_ADDRSPEC
, 0,
611 (void) eft_node((uintptr_t)node
.u
.expr
.right
, DCMD_ADDRSPEC
, 0,
614 case T_LT
: /* boolean < operator */
615 (void) eft_node((uintptr_t)node
.u
.expr
.left
, DCMD_ADDRSPEC
, 0,
618 (void) eft_node((uintptr_t)node
.u
.expr
.right
, DCMD_ADDRSPEC
, 0,
621 case T_LE
: /* boolean <= operator */
622 (void) eft_node((uintptr_t)node
.u
.expr
.left
, DCMD_ADDRSPEC
, 0,
625 (void) eft_node((uintptr_t)node
.u
.expr
.right
, DCMD_ADDRSPEC
, 0,
628 case T_GT
: /* boolean > operator */
629 (void) eft_node((uintptr_t)node
.u
.expr
.left
, DCMD_ADDRSPEC
, 0,
632 (void) eft_node((uintptr_t)node
.u
.expr
.right
, DCMD_ADDRSPEC
, 0,
635 case T_GE
: /* boolean >= operator */
636 (void) eft_node((uintptr_t)node
.u
.expr
.left
, DCMD_ADDRSPEC
, 0,
639 (void) eft_node((uintptr_t)node
.u
.expr
.right
, DCMD_ADDRSPEC
, 0,
642 case T_BITAND
: /* bitwise & operator */
643 (void) eft_node((uintptr_t)node
.u
.expr
.left
, DCMD_ADDRSPEC
, 0,
646 (void) eft_node((uintptr_t)node
.u
.expr
.right
, DCMD_ADDRSPEC
, 0,
649 case T_BITOR
: /* bitwise | operator */
650 (void) eft_node((uintptr_t)node
.u
.expr
.left
, DCMD_ADDRSPEC
, 0,
653 (void) eft_node((uintptr_t)node
.u
.expr
.right
, DCMD_ADDRSPEC
, 0,
656 case T_BITXOR
: /* bitwise ^ operator */
657 (void) eft_node((uintptr_t)node
.u
.expr
.left
, DCMD_ADDRSPEC
, 0,
660 (void) eft_node((uintptr_t)node
.u
.expr
.right
, DCMD_ADDRSPEC
, 0,
663 case T_BITNOT
: /* bitwise ~ operator */
665 (void) eft_node((uintptr_t)node
.u
.expr
.left
, DCMD_ADDRSPEC
, 0,
668 case T_LSHIFT
: /* bitwise << operator */
669 (void) eft_node((uintptr_t)node
.u
.expr
.left
, DCMD_ADDRSPEC
, 0,
672 (void) eft_node((uintptr_t)node
.u
.expr
.right
, DCMD_ADDRSPEC
, 0,
675 case T_RSHIFT
: /* bitwise >> operator */
676 (void) eft_node((uintptr_t)node
.u
.expr
.left
, DCMD_ADDRSPEC
, 0,
679 (void) eft_node((uintptr_t)node
.u
.expr
.right
, DCMD_ADDRSPEC
, 0,
682 case T_ARROW
: /* lhs (N)->(K) rhs */
683 (void) eft_node((uintptr_t)node
.u
.arrow
.lhs
, DCMD_ADDRSPEC
, 0,
685 if (node
.u
.arrow
.nnp
) {
687 (void) eft_node((uintptr_t)node
.u
.arrow
.nnp
,
688 DCMD_ADDRSPEC
, 0, NULL
);
692 if (node
.u
.arrow
.knp
) {
694 (void) eft_node((uintptr_t)node
.u
.arrow
.knp
,
695 DCMD_ADDRSPEC
, 0, NULL
);
698 (void) eft_node((uintptr_t)node
.u
.arrow
.rhs
, DCMD_ADDRSPEC
, 0,
701 case T_LIST
: /* comma-separated list */
702 (void) eft_node((uintptr_t)node
.u
.expr
.left
, DCMD_ADDRSPEC
, 0,
705 (void) eft_node((uintptr_t)node
.u
.expr
.right
, DCMD_ADDRSPEC
, 0,
708 case T_FAULT
: /* fault declaration */
709 mdb_printf("fault.");
710 (void) eft_node((uintptr_t)node
.u
.stmt
.np
, DCMD_ADDRSPEC
, 0,
712 if (node
.u
.stmt
.nvpairs
) {
714 (void) eft_node((uintptr_t)node
.u
.stmt
.nvpairs
,
715 DCMD_ADDRSPEC
, 0, NULL
);
719 case T_UPSET
: /* upset declaration */
720 mdb_printf("upset.");
721 (void) eft_node((uintptr_t)node
.u
.stmt
.np
, DCMD_ADDRSPEC
, 0,
723 if (node
.u
.stmt
.nvpairs
) {
725 (void) eft_node((uintptr_t)node
.u
.stmt
.nvpairs
,
726 DCMD_ADDRSPEC
, 0, NULL
);
730 case T_DEFECT
: /* defect declaration */
731 mdb_printf("defect.");
732 (void) eft_node((uintptr_t)node
.u
.stmt
.np
, DCMD_ADDRSPEC
, 0,
734 if (node
.u
.stmt
.nvpairs
) {
736 (void) eft_node((uintptr_t)node
.u
.stmt
.nvpairs
,
737 DCMD_ADDRSPEC
, 0, NULL
);
741 case T_ERROR
: /* error declaration */
742 mdb_printf("error.");
743 (void) eft_node((uintptr_t)node
.u
.stmt
.np
, DCMD_ADDRSPEC
, 0,
745 if (node
.u
.stmt
.nvpairs
) {
747 (void) eft_node((uintptr_t)node
.u
.stmt
.nvpairs
,
748 DCMD_ADDRSPEC
, 0, NULL
);
752 case T_EREPORT
: /* ereport declaration */
753 mdb_printf("ereport.");
754 (void) eft_node((uintptr_t)node
.u
.stmt
.np
, DCMD_ADDRSPEC
, 0,
756 if (node
.u
.stmt
.nvpairs
) {
758 (void) eft_node((uintptr_t)node
.u
.stmt
.nvpairs
,
759 DCMD_ADDRSPEC
, 0, NULL
);
763 case T_SERD
: /* SERD engine declaration */
765 (void) eft_node((uintptr_t)node
.u
.stmt
.np
, DCMD_ADDRSPEC
, 0,
767 if (node
.u
.stmt
.nvpairs
) {
769 (void) eft_node((uintptr_t)node
.u
.stmt
.nvpairs
,
770 DCMD_ADDRSPEC
, 0, NULL
);
772 } else if (node
.u
.stmt
.lutp
) {
773 if (mdb_pwalk_dcmd("lut", "eft_node", 0, NULL
,
774 (uintptr_t)node
.u
.stmt
.lutp
) != 0)
778 case T_STAT
: /* STAT engine declaration */
780 (void) eft_node((uintptr_t)node
.u
.stmt
.np
, DCMD_ADDRSPEC
, 0,
782 if (node
.u
.stmt
.nvpairs
) {
784 (void) eft_node((uintptr_t)node
.u
.stmt
.nvpairs
,
785 DCMD_ADDRSPEC
, 0, NULL
);
787 } else if (node
.u
.stmt
.lutp
) {
788 if (mdb_pwalk_dcmd("lut", "eft_node", 0, NULL
,
789 (uintptr_t)node
.u
.stmt
.lutp
) != 0)
793 case T_PROP
: /* prop statement */
795 (void) eft_node((uintptr_t)node
.u
.stmt
.np
, DCMD_ADDRSPEC
, 0,
798 case T_MASK
: /* mask statement */
800 (void) eft_node((uintptr_t)node
.u
.stmt
.np
, DCMD_ADDRSPEC
, 0,
803 case T_CONFIG
: /* config statement */
804 mdb_printf("config ");
805 (void) eft_node((uintptr_t)node
.u
.stmt
.np
, DCMD_ADDRSPEC
, 0,
807 if (node
.u
.stmt
.nvpairs
) {
809 (void) eft_node((uintptr_t)node
.u
.stmt
.nvpairs
,
810 DCMD_ADDRSPEC
, 0, NULL
);
815 mdb_printf("not a eversholt node\n");
821 static const mdb_walker_t walkers
[] = {
822 { "lut", "walk a lookup table", lut_walk_init
, lut_walk_step
,
823 lut_walk_fini
, NULL
},
824 { "eft_ipath", "walk ipath", ipath_walk_init
, ipath_walk_step
,
825 ipath_walk_fini
, NULL
},
826 { NULL
, NULL
, NULL
, NULL
, NULL
, NULL
}
829 static const mdb_dcmd_t dcmds
[] = {
830 { "eft_ipath", "?", "print an ipath", ipath
},
831 { "eft_count", "?", "print eversholt stats", eft_count
},
832 { "eft_node", "?[-v]", "print eversholt node", eft_node
},
833 { "eft_time", "?[-p][-l time]", "print eversholt timeval", eft_time
},
837 static const mdb_modinfo_t modinfo
= { MDB_API_VERSION
, dcmds
, walkers
};
839 const mdb_modinfo_t
*