combined.c revision 8074cb1b2b37aa84a83861a8556aa1a67d0a7d8c
/*
* 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
* 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 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#include <mdb/mdb_modapi.h>
typedef struct combined_walk {
int (*cw_init)(mdb_walk_state_t *);
int (*cw_step)(mdb_walk_state_t *);
void (*cw_fini)(mdb_walk_state_t *);
struct combined_walk *cw_next;
void *cw_data;
typedef struct combined_walk_data {
struct combined_walk_data *cwd_next;
struct combined_walk_data *cwd_prev;
void *cwd_tag; /* used to find this data */
/*
* Initialize a combined walk to
* A) present a single concatenated series of elements from different
* structures, or
* B) select from several possible walks at runtime.
* Multiple walks are done in the same order passed to combined_walk_add(). Each
* walk is initialized with the same wsp->walk_addr.
*/
void
{
}
/*
* If a sub-walker's walk_step() is interrupted (by Ctrl-C or entering 'q' when
* prompted for the next screenful of data), there won't be an opportunity to
* switch wsp->walk_data from the sub-walker's data back to the combined walk
* data, since control will not return from walk_step(). Since mdb is
* single-threaded, we can save the combined walk data for combined_walk_fini()
* to use in case it was reached from an interrupted walk_step(). To allow for
* the possibility of nested combined walks, we'll save them on a list tagged by
* the sub-walker's data.
*/
static combined_walk_data_t *cwd_saved;
static void
{
}
}
static void
{
} else {
}
}
}
static combined_walk_data_t *
combined_walk_data_find(void *tag)
{
return (NULL);
}
return (cwd);
}
}
return (NULL);
}
static void
{
} else {
}
}
static combined_walk_t *
{
return (NULL);
}
}
return (cw);
}
void
int (*walk_init)(mdb_walk_state_t *),
int (*walk_step)(mdb_walk_state_t *),
void (*walk_fini)(mdb_walk_state_t *))
{
}
int
{
int status;
return (WALK_DONE);
}
if (cw->cw_initialized) {
} else {
return (status);
}
}
/* save cwd for fini() in case step() is interrupted */
/* control may never reach here */
(void) combined_walk_remove_current(cwd);
return (combined_walk_step(wsp));
}
return (status);
}
void
{
/*
* If walk_step() was interrupted, wsp->walk_data will be the
* sub-walker's data, not the combined walker's data, so first check to
* see if there is saved combined walk data tagged by the presumed
* sub-walker's walk data.
*/
/*
* walk_step() was not interrupted, so wsp->walk_data is
* actually the combined walk data.
*/
} else {
}
if (cw->cw_initialized) {
}
}
}