c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota/*
16e76cdd6e3cfaac7d91c3b0644ee1bc6cf52347agiri * CDDL HEADER START
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota *
16e76cdd6e3cfaac7d91c3b0644ee1bc6cf52347agiri * The contents of this file are subject to the terms of the
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota * Common Development and Distribution License, Version 1.0 only
16e76cdd6e3cfaac7d91c3b0644ee1bc6cf52347agiri * (the "License"). You may not use this file except in compliance
16e76cdd6e3cfaac7d91c3b0644ee1bc6cf52347agiri * with the License.
16e76cdd6e3cfaac7d91c3b0644ee1bc6cf52347agiri *
16e76cdd6e3cfaac7d91c3b0644ee1bc6cf52347agiri * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota * or http://www.opensolaris.org/os/licensing.
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota * See the License for the specific language governing permissions
16e76cdd6e3cfaac7d91c3b0644ee1bc6cf52347agiri * and limitations under the License.
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota *
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota * When distributing Covered Code, include this CDDL HEADER in each
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota * If applicable, add the following below this CDDL HEADER, with the
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota * fields enclosed by brackets "[]" replaced with your own identifying
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota * information: Portions Copyright [yyyy] [name of copyright owner]
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota *
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota * CDDL HEADER END
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota */
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota/*
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota * Copyright (c) 1999 by Sun Microsystems, Inc.
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota * All rights reserved.
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota */
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota#ifndef _MDB_LIST_H
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota#define _MDB_LIST_H
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota#pragma ident "%Z%%M% %I% %E% SMI"
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota#ifdef __cplusplus
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Otaextern "C" {
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota#endif
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota#ifdef _MDB
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota/*
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota * Simple doubly-linked list implementation. This implementation assumes that
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota * each element contains an embedded mdb_list_t structure. An additional
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota * mdb_list_t is used to store the head and tail pointers. The caller can
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota * use mdb_list_prev() on the master list_t to obtain the tail element, or
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota * mdb_list_next() to obtain the head element. The head and tail list elements
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota * have their previous and next pointers set to NULL, respectively.
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota */
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Otatypedef struct mdb_list {
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota struct mdb_list *ml_prev; /* Link to previous list element */
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota struct mdb_list *ml_next; /* Link to next list element */
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota} mdb_list_t;
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota#define mdb_list_prev(elem) ((void *)(((mdb_list_t *)(elem))->ml_prev))
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota#define mdb_list_next(elem) ((void *)(((mdb_list_t *)(elem))->ml_next))
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Otaextern void mdb_list_append(mdb_list_t *, void *);
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Otaextern void mdb_list_prepend(mdb_list_t *, void *);
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Otaextern void mdb_list_insert(mdb_list_t *, void *, void *);
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Otaextern void mdb_list_delete(mdb_list_t *, void *);
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Otaextern void mdb_list_move(mdb_list_t *, mdb_list_t *);
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota#endif /* _MDB */
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota#ifdef __cplusplus
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota}
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota#endif
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota#endif /* _MDB_LIST_H */
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota