xge-list.h revision a23fd118e437af0a7877dd313db8fdaa3537c675
/*
* 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 (c) 2002-2005 Neterion, Inc.
* All right Reserved.
*
* FileName : xge-list.h
*
* Description: Generic bi-directional linked list implementation
*
* Created: 14 May 2004
*/
#ifndef XGE_LIST_H
#define XGE_LIST_H
#include "xge-debug.h"
/**
* struct xge_list_t - List item.
* @prev: Previous list item.
* @next: Next list item.
*
* Item of a bi-directional linked list.
*/
typedef struct xge_list_t {
struct xge_list_t* prev;
struct xge_list_t* next;
} xge_list_t;
/**
* xge_list_init - Initialize linked list.
* header: first element of the list (head)
*
* Initialize linked list.
* See also: xge_list_t{}.
*/
{
}
/**
* xge_list_is_empty - Is the list empty?
* header: first element of the list (head)
*
* Determine whether the bi-directional list is empty. Return '1' in
* case of 'empty'.
* See also: xge_list_t{}.
*/
{
}
/**
* xge_list_remove - Remove the specified item from the linked list.
* item: element of the list
*
* Remove item from a list.
* See also: xge_list_insert(), xge_list_t{}.
*/
{
#ifdef XGE_DEBUG_ASSERT
#endif
}
/**
* xge_list_insert - Insert a new item after the specified item.
* new_item: new element of the list
* prev_item: element of the list after which the new element is
* inserted
*
* Insert new item (new_item) after given item (prev_item).
* See also: xge_list_remove(), xge_list_insert_before(), xge_list_t{}.
*/
{
}
/**
* xge_list_insert_before - Insert a new item before the specified item.
* new_item: new element of the list
* next_item: element of the list after which the new element is inserted
*
* Insert new item (new_item) before given item (next_item).
*/
{
}
#ifdef __GNUC__
/**
* xge_container_of - Given a member, return the containing structure.
* @ptr: the pointer to the member.
* @type: the type of the container struct this is embedded in.
* @member: the name of the member within the struct.
*
* Cast a member of a structure out to the containing structure.
*/
#else
/* type unsafe version */
#endif
/**
* xge_offsetof - Offset of the member in the containing structure.
* @t: struct name.
* @m: the name of the member within the struct.
*
* Return the offset of the member @m in the structure @t.
*/
#define xge_offsetof(t, m) ((size_t) (&((t *)0)->m))
#endif /* XGE_LIST_H */