xref: /illumos-gate/usr/src/cmd/mdb/common/mdb/mdb_wcb.h (revision 7c478bd95313f5f23a4c958a745db2134aa03244)
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 2004 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef	_MDB_WCB_H
28 #define	_MDB_WCB_H
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 #include <mdb/mdb_module.h>
33 
34 #ifdef	__cplusplus
35 extern "C" {
36 #endif
37 
38 /*
39  * Values for w_buftag, used as a guard to ensure that the walk state hasn't
40  * overflowed into the wcb.  w_buftag is INITIAL when the wcb is first
41  * allocated, ACTIVE when added to a frame, and PASSIVE when removed.
42  */
43 #define	WCB_TAG_INITIAL	0xcbbabecb	/* Magic tag for initialized wcb */
44 #define	WCB_TAG_ACTIVE	0xcba1cba1	/* Magic tag for active wcb */
45 #define	WCB_TAG_PASSIVE	0xcbdeadcb	/* Magic tag for inactive wcb */
46 
47 struct mdb_frame;			/* Forward declaration */
48 
49 typedef struct mdb_wcb {
50 	mdb_walk_state_t w_state;	/* Walk soft state */
51 	uint32_t w_buftag;		/* WCB_TAG_* */
52 	int w_inited;			/* Set if we've called walk_init */
53 	struct mdb_wcb *w_lyr_head;	/* Link to head wcb in layer chain */
54 	struct mdb_wcb *w_lyr_link;	/* Link to next wcb in layer chain */
55 	struct mdb_wcb *w_link;		/* Link to next wcb in global chain */
56 	const mdb_iwalker_t *w_walker;	/* Walker corresponding to this wcb */
57 } mdb_wcb_t;
58 
59 extern mdb_wcb_t *mdb_wcb_create(mdb_iwalker_t *, mdb_walk_cb_t,
60     void *, uintptr_t);
61 
62 extern void mdb_wcb_destroy(mdb_wcb_t *);
63 extern mdb_wcb_t *mdb_wcb_from_state(mdb_walk_state_t *);
64 
65 extern void mdb_wcb_insert(mdb_wcb_t *, struct mdb_frame *);
66 extern void mdb_wcb_delete(mdb_wcb_t *, struct mdb_frame *);
67 extern void mdb_wcb_purge(mdb_wcb_t **);
68 
69 #ifdef	__cplusplus
70 }
71 #endif
72 
73 #endif	/* _MDB_WCB_H */
74