1 /*
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
7 * with the License.
8 *
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
13 *
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
19 *
20 * CDDL HEADER END
21 */
22 /*
23 * Copyright 2003 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
25 */
26
27 #pragma ident "%Z%%M% %I% %E% SMI"
28
29 #include "mdinclude.h"
30
31 /*
32 * Generic walker svm mddb directory entry walker.
33 */
34 int
mddb_de_ic_walk_init(mdb_walk_state_t * wsp)35 mddb_de_ic_walk_init(mdb_walk_state_t *wsp)
36 {
37
38 /* Must have a start addr. */
39 if (wsp->walk_addr == NULL) {
40 mdb_warn("start address required\n");
41 return (WALK_ERR);
42 }
43 return (WALK_NEXT);
44 }
45
46
47 /*
48 * svm mddb directory entry walker step routine.
49 */
50 int
mddb_de_ic_walk_step(mdb_walk_state_t * wsp)51 mddb_de_ic_walk_step(mdb_walk_state_t *wsp)
52 {
53 mddb_de_ic_t de_entry;
54 int status;
55
56 /* Check if we're at the last element */
57 if (wsp->walk_addr == NULL)
58 return (WALK_DONE);
59
60 if (mdb_vread(&de_entry, sizeof (mddb_de_ic_t), wsp->walk_addr) == -1) {
61 mdb_warn("failed to read mddb_de_ic_t at %p", wsp->walk_addr);
62 return (WALK_ERR);
63 }
64
65 status = wsp->walk_callback(wsp->walk_addr, &de_entry,
66 wsp->walk_cbdata);
67
68 wsp->walk_addr = (uintptr_t)de_entry.de_next;
69
70 return (status);
71 }
72