1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
|
/*
* 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
* or http://www.opensolaris.org/os/licensing.
* 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 (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
*/
#include <stdio.h>
#include <sys/mdb_modapi.h>
#include <sys/modctl.h>
#include <sys/types.h>
#include <sys/crypto/api.h>
#include <sys/crypto/common.h>
#include <sys/crypto/api.h>
#include <sys/crypto/sched_impl.h>
#include "crypto_cmds.h"
static void
prt_an_state(int state)
{
switch (state) {
case REQ_ALLOCATED:
mdb_printf("REQ_ALLOCATED ");
break;
case REQ_WAITING:
mdb_printf("REQ_WAITING ");
break;
case REQ_INPROGRESS:
mdb_printf("REQ_INPROGRESS ");
break;
case REQ_DONE:
mdb_printf("REQ_DONE ");
break;
case REQ_CANCELED:
mdb_printf("REQ_CANCELED ");
break;
default:
mdb_printf("? %d ?? ", state);
break;
}
}
static const mdb_bitmask_t call_flags[] = {
{ "CRYPTO_ALWAYS_QUEUE", CRYPTO_ALWAYS_QUEUE, CRYPTO_ALWAYS_QUEUE },
{ "CRYPTO_NOTIFY_OPDONE", CRYPTO_NOTIFY_OPDONE, CRYPTO_NOTIFY_OPDONE },
{ "CRYPTO_SKIP_REQID", CRYPTO_SKIP_REQID, CRYPTO_SKIP_REQID },
{ NULL, 0, 0 }
};
/*ARGSUSED*/
static int
kcf_areq_node_simple(kcf_areq_node_t *areqn)
{
mdb_printf("\nan_type: ");
if (areqn->an_type != CRYPTO_ASYNCH)
mdb_printf("%-8d ", areqn->an_type);
else
mdb_printf("CRYPTO_ASYNCH");
mdb_printf("\nan_state: ");
prt_an_state(areqn->an_state);
mdb_printf("\nan_context: %-16p\t", areqn->an_context);
mdb_printf("an_is_my_turn: %s\t ", areqn->an_is_my_turn == B_FALSE ?
"B_FALSE" : "B_TRUE");
mdb_printf("\ncr_reqid: %lx\n", areqn->an_reqarg.cr_reqid);
return (DCMD_OK);
}
/*
* Verbose print of kcf_areq_node_t
*/
static int
v_kcf_areq_node(kcf_areq_node_t *areqn)
{
/* contents only -- the address is printed elsewhere */
/* First column */
mdb_printf("\n%16s: ", "an_type");
if (areqn->an_type != CRYPTO_ASYNCH)
mdb_printf("%-8d ", areqn->an_type);
else
mdb_printf("CRYPTO_ASYNCH");
/* Second column */
mdb_printf("\t\t%16s: %p\n", "an_lock", areqn->an_lock);
/* First column */
mdb_printf("%16s: ", "an_state");
prt_an_state(areqn->an_state);
/* Second column */
mdb_printf("%14s: next 4 items\n", "an_reqarg");
/* First column again */
mdb_printf("%16s: '%16b'", "cr_flag", areqn->an_reqarg.cr_flag,
call_flags);
/* Second column */
mdb_printf("\t%16s: %p\n", "cr_callback_func",
areqn->an_reqarg.cr_callback_func);
/* First column again */
mdb_printf("%16s: %-16p", "cr_callback_arg",
areqn->an_reqarg.cr_callback_arg);
/* Second column */
mdb_printf("\t%16s: %lx\n", "cr_reqid",
(ulong_t)areqn->an_reqarg.cr_reqid);
/* First column again */
mdb_printf("%16s: %d", "an_params.rp_opgrp",
areqn->an_params.rp_opgrp);
/* Second column */
mdb_printf("\t%16s: %d\n", "an_params.rp_optype",
areqn->an_params.rp_optype);
/* First column again */
mdb_printf("%16s: %-16p", "an_context",
areqn->an_context);
/* Second column */
mdb_printf("\t%16s: %p\n", "an_ctxchain_next",
areqn->an_ctxchain_next);
/* First column again */
mdb_printf("%16s: %s", "an_is_my_turn",
areqn->an_is_my_turn == B_FALSE ? "B_FALSE" : "B_TRUE");
/* Second column */
mdb_printf("\t\t%16s: %s\n", "an_isdual",
areqn->an_isdual == B_FALSE ? "B_FALSE" : "B_TRUE");
/* First column again */
mdb_printf("%16s: %p", "an_next",
areqn->an_next);
/* Second column */
mdb_printf("\t\t%16s: %p\n", "an_prev", areqn->an_prev);
/* First column again */
mdb_printf("%16s: %p", "an_provider",
areqn->an_provider);
/* Second column */
mdb_printf("\t\t%16s: %p\n", "an_idnext", areqn->an_idnext);
/* First column again */
mdb_printf("%16s: %p", "an_idprev",
areqn->an_idprev);
/* Second column */
mdb_printf("\t\t%16s: %hx\n", "an_done", areqn->an_done);
/* First column again */
mdb_printf("%16s: %d\n", "an_refcnt",
areqn->an_refcnt);
return (DCMD_OK);
}
/*ARGSUSED*/
int
kcf_areq_node(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
{
kcf_areq_node_t areqn;
uint_t opt_v = FALSE;
if (mdb_getopts(argc, argv, 'v', MDB_OPT_SETBITS, TRUE, &opt_v,
NULL) != argc)
return (DCMD_USAGE);
/*
* read even if we're looping, because the cbdata design does not
* apply to mdb_pwalk_dcmd
*/
if (mdb_vread(&areqn, sizeof (kcf_areq_node_t), addr) == -1) {
mdb_warn("cannot read %p", addr);
return (DCMD_ERR);
}
if (opt_v) /* verbose */
return (v_kcf_areq_node(&areqn));
else
return (kcf_areq_node_simple(&areqn));
}
/*ARGSUSED*/
int
kcf_global_swq(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
{
kcf_global_swq_t swq;
kcf_global_swq_t *ptr;
if (!(flags & DCMD_ADDRSPEC)) {
if (mdb_readsym(&ptr, sizeof (uintptr_t), "gswq")
== -1) {
mdb_warn("cannot read gswq");
return (DCMD_ERR);
}
}
else
ptr = (kcf_global_swq_t *)addr;
if (mdb_vread(&swq, sizeof (kcf_global_swq_t), (uintptr_t)ptr) == -1) {
mdb_warn("cannot read %p", ptr);
return (DCMD_ERR);
}
mdb_printf("gs_lock (mutex):\t%p\n", swq.gs_lock);
mdb_printf("gs_cv:\t%hx\n", swq.gs_cv._opaque);
mdb_printf("gs_njobs:\t%u\n", swq.gs_njobs);
mdb_printf("gs_maxjobs:\t%u\n", swq.gs_maxjobs);
mdb_printf("gs_first:\t%p\n", swq.gs_first);
mdb_printf("gs_last:\t%p\n", swq.gs_last);
return (mdb_pwalk_dcmd("an_next", "kcf_areq_node", argc,
argv, (uintptr_t)swq.gs_first));
}
static int
areq_walk_init_common(mdb_walk_state_t *wsp, boolean_t use_first)
{
kcf_global_swq_t gswq_copy;
uintptr_t gswq_ptr;
if (mdb_readsym(&gswq_ptr, sizeof (gswq_ptr), "gswq") == -1) {
mdb_warn("failed to read 'gswq'");
return (WALK_ERR);
}
if (mdb_vread(&gswq_copy, sizeof (gswq_copy), gswq_ptr) == -1) {
mdb_warn("cannot read %p", gswq_ptr);
return (WALK_ERR);
}
if ((wsp->walk_addr = (use_first ? (uintptr_t)gswq_copy.gs_first :
(uintptr_t)gswq_copy.gs_last)) == 0) {
mdb_printf("Global swq is empty\n");
return (WALK_DONE);
}
wsp->walk_data = mdb_alloc(sizeof (kcf_areq_node_t), UM_SLEEP);
return (WALK_NEXT);
}
int
areq_first_walk_init(mdb_walk_state_t *wsp)
{
return (areq_walk_init_common(wsp, B_TRUE));
}
int
areq_last_walk_init(mdb_walk_state_t *wsp)
{
return (areq_walk_init_common(wsp, B_FALSE));
}
typedef enum idwalk_type {
IDNEXT, /* an_idnext */
IDPREV, /* an_idprev */
CTXCHAIN /* an_ctxchain_next */
} idwalk_type_t;
static int
an_id_walk_init(mdb_walk_state_t *wsp, idwalk_type_t type)
{
kcf_areq_node_t *adn;
if (wsp->walk_addr == 0) {
mdb_warn("must give kcf_areq_node address\n");
return (WALK_ERR);
}
adn = wsp->walk_data = mdb_alloc(sizeof (kcf_areq_node_t), UM_SLEEP);
if (mdb_vread(adn, sizeof (kcf_areq_node_t), wsp->walk_addr) == -1) {
mdb_warn("cannot read %p", wsp->walk_addr);
return (WALK_ERR);
}
switch (type) {
case IDNEXT:
wsp->walk_addr = (uintptr_t)adn->an_idnext;
break;
case IDPREV:
wsp->walk_addr = (uintptr_t)adn->an_idprev;
break;
case CTXCHAIN:
wsp->walk_addr = (uintptr_t)adn->an_ctxchain_next;
break;
default:
mdb_warn("Bad structure member in walk_init\n");
return (WALK_ERR);
}
return (WALK_NEXT);
}
int
an_idnext_walk_init(mdb_walk_state_t *wsp)
{
return (an_id_walk_init(wsp, IDNEXT));
}
int
an_idprev_walk_init(mdb_walk_state_t *wsp)
{
return (an_id_walk_init(wsp, IDPREV));
}
int
an_ctxchain_walk_init(mdb_walk_state_t *wsp)
{
return (an_id_walk_init(wsp, CTXCHAIN));
}
/*
* At each step, read a kcf_areq_node_t into our private storage, then invoke
* the callback function. We terminate when we reach a NULL type pointer.
*/
static int
an_id_walk_step(mdb_walk_state_t *wsp, idwalk_type_t type)
{
int status;
kcf_areq_node_t *ptr;
if (wsp->walk_addr == 0) /* then we're done */
return (WALK_DONE);
ptr = wsp->walk_data;
if (mdb_vread(wsp->walk_data, sizeof (kcf_areq_node_t),
wsp->walk_addr) == -1) {
mdb_warn("cannot read %p", wsp->walk_addr);
return (WALK_ERR);
}
status = wsp->walk_callback(wsp->walk_addr, wsp->walk_data,
wsp->walk_cbdata);
switch (type) {
case IDNEXT:
if ((wsp->walk_addr =
(uintptr_t)ptr->an_idnext) == 0)
return (WALK_DONE);
break;
case IDPREV:
if ((wsp->walk_addr =
(uintptr_t)ptr->an_idprev) == 0)
return (WALK_DONE);
break;
case CTXCHAIN:
if ((wsp->walk_addr =
(uintptr_t)ptr->an_ctxchain_next) == 0)
return (WALK_DONE);
break;
default:
mdb_warn("Bad structure member in walk_step\n");
return (WALK_ERR);
}
return (status);
}
int
an_idnext_walk_step(mdb_walk_state_t *wsp)
{
return (an_id_walk_step(wsp, IDNEXT));
}
int
an_idprev_walk_step(mdb_walk_state_t *wsp)
{
return (an_id_walk_step(wsp, IDPREV));
}
int
an_ctxchain_walk_step(mdb_walk_state_t *wsp)
{
return (an_id_walk_step(wsp, CTXCHAIN));
}
/*
* The walker's fini function is invoked at the end of each walk. Since we
* dynamically allocated a kcf_areq_node_t in areq_walk_init,
* we must free it now.
*/
void
areq_walk_fini(mdb_walk_state_t *wsp)
{
#ifdef DEBUG
mdb_printf("...end of kcf_areq_node walk\n");
#endif
mdb_free(wsp->walk_data, sizeof (kcf_areq_node_t));
}
/*
* At each step, read a kcf_areq_node_t into our private storage, then invoke
* the callback function. We terminate when we reach a NULL an_next pointer
* or a NULL an_prev pointer. use_next flag indicates which one to check.
*/
static int
an_walk_step_common(mdb_walk_state_t *wsp, boolean_t use_next)
{
int status;
kcf_areq_node_t *ptr;
ptr = (kcf_areq_node_t *)wsp->walk_data;
if (mdb_vread(wsp->walk_data, sizeof (kcf_areq_node_t),
wsp->walk_addr) == -1) {
mdb_warn("failed to read kcf_areq_node at %p", wsp->walk_addr);
return (WALK_DONE);
}
status = wsp->walk_callback(wsp->walk_addr, wsp->walk_data,
wsp->walk_cbdata);
if ((wsp->walk_addr = (use_next ? (uintptr_t)ptr->an_next :
(uintptr_t)ptr->an_prev)) == 0)
return (WALK_DONE);
return (status);
}
int
an_next_walk_step(mdb_walk_state_t *wsp)
{
return (an_walk_step_common(wsp, B_TRUE));
}
int
an_prev_walk_step(mdb_walk_state_t *wsp)
{
return (an_walk_step_common(wsp, B_FALSE));
}
/*
* Walker data for reqid_table walking
*/
typedef struct reqid_data {
kcf_reqid_table_t rd_table;
kcf_reqid_table_t *rd_tbl_ptrs[REQID_TABLES];
int rd_cur_index;
} reqid_data_t;
typedef struct reqid_cb_data {
crypto_req_id_t cb_reqid;
int verbose;
int found;
} reqid_cb_data_t;
extern int crypto_pr_reqid(uintptr_t, reqid_data_t *, reqid_cb_data_t *);
int
reqid_table_walk_init(mdb_walk_state_t *wsp)
{
reqid_data_t *wdata;
reqid_cb_data_t *cbdata;
wsp->walk_callback = (mdb_walk_cb_t)crypto_pr_reqid;
wsp->walk_data = mdb_alloc(sizeof (reqid_data_t), UM_SLEEP);
/* see if the walker was called from the command line or mdb_pwalk */
if (wsp->walk_cbdata == NULL) { /* command line */
if ((wsp->walk_cbdata = mdb_zalloc(sizeof (reqid_cb_data_t),
UM_SLEEP)) == NULL) {
mdb_warn("couldn't get cb memory for "
"reqid_table_walker");
return (WALK_ERR);
}
/* initialize for a simple walk, as opposed to a reqid search */
cbdata = wsp->walk_cbdata;
cbdata->verbose = TRUE;
cbdata->cb_reqid = 0;
}
wdata = (reqid_data_t *)wsp->walk_data;
if (mdb_readsym(wdata->rd_tbl_ptrs, sizeof (wdata->rd_tbl_ptrs),
"kcf_reqid_table") == -1) {
mdb_warn("failed to read 'kcf_reqid_table'");
return (WALK_ERR);
}
wdata->rd_cur_index = 0;
wsp->walk_addr = (uintptr_t)wdata->rd_tbl_ptrs[wdata->rd_cur_index];
return (WALK_NEXT);
}
/*
* At each step, read a kcf_reqid_table_t into our private storage, then invoke
* the callback function. We terminate when we reach a
*/
int
reqid_table_walk_step(mdb_walk_state_t *wsp)
{
int status;
reqid_data_t *wdata;
wdata = wsp->walk_data;
wsp->walk_addr = (uintptr_t)wdata->rd_tbl_ptrs[wdata->rd_cur_index];
#ifdef DEBUG
mdb_printf(
"DEBUG: kcf_reqid_table at %p, sizeof kcf_reqid_table_t = %d\n",
wsp->walk_addr, sizeof (kcf_reqid_table_t));
#endif
status = wsp->walk_callback(wsp->walk_addr, wsp->walk_data,
wsp->walk_cbdata);
/* get ready for next call */
wdata->rd_cur_index++;
if (wdata->rd_cur_index >= REQID_TABLES)
return (WALK_DONE);
return (status);
}
/*
* The walker's fini function is invoked at the end of each walk. Since we
* dynamically allocated a reqid_data_t in areq_walk_init,
* we must free it now.
*/
void
reqid_table_walk_fini(mdb_walk_state_t *wsp)
{
#ifdef DEBUG
mdb_printf("...end of kcf_reqid walk\n");
#endif
mdb_free(wsp->walk_data, sizeof (reqid_data_t));
}
/*
* If there's an argument beyond -v, then we're looking for a specific
* reqid, otherwise, print any non-null kcf_areq things we run across.
*/
int
crypto_pr_reqid(uintptr_t addr, reqid_data_t *data, reqid_cb_data_t *cbdata)
{
kcf_areq_node_t node;
int i;
int needhdr = TRUE;
if (addr == 0) {
mdb_printf("kcf_reqid_table[%d] = NULL\n", data->rd_cur_index);
return (WALK_NEXT);
}
if (mdb_vread(&(data->rd_table), sizeof (kcf_reqid_table_t),
addr) == -1) {
mdb_warn("failed to read kcf_reqid_table at %p",
addr);
return (WALK_ERR);
}
/* Loop over all rt_idhash's */
for (i = 0; i < REQID_BUCKETS; i++) {
uint_t number_in_chain = 0;
uintptr_t node_addr;
/* follow the an_idnext chains for each bucket */
do {
/* read kcf_areq_node */
if (number_in_chain == 0)
node_addr = (uintptr_t)data->rd_table.rt_idhash[i];
else
/*LINTED*/
node_addr = (uintptr_t)node.an_idnext;
#ifdef DEBUG
mdb_printf("DEBUG: node_addr = %p\n", node_addr);
#endif
if (node_addr == 0)
break; /* skip */
if (mdb_vread(&node, sizeof (kcf_areq_node_t), node_addr)
== -1) {
if (cbdata->verbose == TRUE)
mdb_printf(
"cannot read rt_idhash %d an_idnext %d\n",
i, number_in_chain);
break;
}
/* see if we want to print it */
if ((cbdata->cb_reqid == 0) ||
(node.an_reqarg.cr_reqid == cbdata->cb_reqid)) {
cbdata->found = TRUE; /* printed if false || reqid */
/* is this the first rd_idhash found for this table? */
if (needhdr == TRUE) {
/* print both indices in bold */
mdb_printf("%<b>kcf_reqid_table[%lu] at %p:%</b>\n",
data->rd_cur_index, addr);
mdb_printf("\trt_lock: %p\trt_curid: %llx\n",
data->rd_table.rt_lock,
data->rd_table.rt_curid);
needhdr = FALSE;
}
/* print kcf_areq_node */
if (number_in_chain < 1)
mdb_printf(
" %<b>rt_idhash[%lu%]%</b> = %<b>%p:%</b>\n",
i, node_addr);
else
mdb_printf(
" rt_idhash[%lu%]"
" an_idnext %d = %<b>%p:%</b>\n",
i, number_in_chain, node_addr);
mdb_inc_indent(8);
/* if we're looking for one and only one reqid */
/* do it REALLY verbose */
if ((node.an_reqarg.cr_reqid == cbdata->cb_reqid) &&
(cbdata->cb_reqid != 0))
v_kcf_areq_node(&node);
else if (cbdata->verbose == TRUE)
/*
* verbose for this walker means non-verbose for
* the kcf_areq_node details
*/
kcf_areq_node_simple(&node);
mdb_dec_indent(8);
}
/* if we only wanted one reqid, quit now */
if (node.an_reqarg.cr_reqid == cbdata->cb_reqid) {
return (WALK_DONE);
}
number_in_chain++;
} while (node.an_idnext != NULL); /* follow chain in same bucket */
} /* for each REQID_BUCKETS */
if ((needhdr == TRUE) && (cbdata->cb_reqid == 0)) {
mdb_printf("%kcf_reqid_table[%lu]: %p\n",
data->rd_cur_index, addr);
}
return (WALK_NEXT);
}
/*ARGSUSED*/
int
crypto_find_reqid(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
{
const mdb_arg_t *argp = NULL;
reqid_cb_data_t cbdata;
int i, status;
cbdata.cb_reqid = 0L;
cbdata.verbose = FALSE;
cbdata.found = FALSE;
if (flags & DCMD_ADDRSPEC) {
mdb_printf("use addr ::kcf_reqid_table\n");
return (DCMD_USAGE);
}
if ((i = mdb_getopts(argc, argv, 'v', MDB_OPT_SETBITS, TRUE,
&cbdata.verbose, NULL)) != argc) {
if (argc - i > 1)
return (DCMD_USAGE);
}
if (argc > i)
argp = &argv[i];
if ((argp != NULL)) {
if (argp->a_type == MDB_TYPE_IMMEDIATE)
cbdata.cb_reqid = argp->a_un.a_val;
else
cbdata.cb_reqid = (crypto_req_id_t)
mdb_strtoull(argp->a_un.a_str);
}
status = mdb_pwalk("kcf_reqid_table", (mdb_walk_cb_t)crypto_pr_reqid,
&cbdata, addr);
if ((cbdata.cb_reqid != 0L) && (cbdata.found == FALSE))
mdb_printf("ID 0x%lx not found\n", cbdata.cb_reqid);
#ifdef DEBUG
else
mdb_printf("DEBUG: cbdata.db_reqid = %lx, cbdata.found = %d\n",
cbdata.cb_reqid, cbdata.found);
#endif
return (status);
}
int
kcf_reqid_table_dcmd(uintptr_t addr, uint_t flags, int argc,
const mdb_arg_t *argv)
{
reqid_data_t wdata;
reqid_cb_data_t cbdata;
if (!(flags & DCMD_ADDRSPEC))
return (DCMD_USAGE);
memset(&wdata, 0, sizeof (wdata));
memset(&cbdata, 0, sizeof (cbdata));
if ((mdb_getopts(argc, argv, 'v', MDB_OPT_SETBITS, TRUE,
&cbdata.verbose, NULL)) != argc) {
return (DCMD_USAGE);
}
crypto_pr_reqid(addr, &wdata, &cbdata);
return (DCMD_OK);
}
|