1
1
This commit was SVN r187.
Этот коммит содержится в:
Jeff Squyres 2004-01-09 22:48:57 +00:00
родитель 8379837f48
Коммит 9b2bf109c1
11 изменённых файлов: 133 добавлений и 133 удалений

Просмотреть файл

@ -9,175 +9,175 @@
*/
lam_class_info_t lam_dbl_item_cls = {"lam_dbl_link_item_t", &lam_object_cls,
(class_init_t) lam_dbl_item_init, (class_destroy_t)lam_obj_destroy};
lam_class_info_t lam_dbl_list_cls = {"lam_dbl_list_t", &lam_object_cls,
(class_init_t)lam_dbl_init, (class_destroy_t)lam_dbl_destroy};
lam_class_info_t lam_list_item_cls = {"lam_list_link_item_t", &lam_object_cls,
(class_init_t) lam_list_item_init, (class_destroy_t)lam_obj_destroy};
lam_class_info_t lam_list_cls = {"lam_list_t", &lam_object_cls,
(class_init_t)lam_list_init, (class_destroy_t)lam_list_destroy};
/*
*
* lam_dbl_link_item_t interface
* lam_list_link_item_t interface
*
*/
void lam_dbl_item_init(lam_dbl_item_t *item)
void lam_list_item_init(lam_list_item_t *item)
{
SUPER_INIT(item, lam_dbl_item_cls.cls_parent);
item->lam_dbl_next = item->lam_dbl_prev = 0;
item->lam_dbl_type = 0;
SUPER_INIT(item, lam_list_item_cls.cls_parent);
item->lam_list_next = item->lam_list_prev = 0;
item->lam_list_type = 0;
}
/*
*
* lam_dbl_list_t interface
* lam_list_list_t interface
*
*/
void lam_dbl_init(lam_dbl_list_t *list)
void lam_list_init(lam_list_t *list)
{
SUPER_INIT(list, lam_dbl_list_cls.cls_parent);
list->lam_dbl_head = list->lam_dbl_tail = 0;
list->lam_dbl_type = 0;
list->lam_dbl_length = 0;
SUPER_INIT(list, lam_list_cls.cls_parent);
list->lam_list_head = list->lam_list_tail = 0;
list->lam_list_type = 0;
list->lam_list_length = 0;
}
void lam_dbl_destroy(lam_dbl_list_t *list)
void lam_list_destroy(lam_list_t *list)
{
/* release all items in list */
lam_dbl_empty_list(list);
SUPER_DESTROY(list, lam_dbl_list_cls.cls_parent);
lam_list_empty_list(list);
SUPER_DESTROY(list, lam_list_cls.cls_parent);
}
void lam_dbl_append(lam_dbl_list_t *list, lam_dbl_item_t *item)
void lam_list_append(lam_list_t *list, lam_list_item_t *item)
{
/* Adds item to the end of the list. */
item->lam_dbl_next = 0;
item->lam_dbl_prev = list->lam_dbl_tail;
if ( !(list->lam_dbl_head) )
list->lam_dbl_head = item;
if ( list->lam_dbl_tail )
list->lam_dbl_tail->lam_dbl_next = item;
item->lam_list_next = 0;
item->lam_list_prev = list->lam_list_tail;
if ( !(list->lam_list_head) )
list->lam_list_head = item;
if ( list->lam_list_tail )
list->lam_list_tail->lam_list_next = item;
list->lam_dbl_tail = item;
list->lam_dbl_length++;
list->lam_list_tail = item;
list->lam_list_length++;
}
void lam_dbl_empty_list(lam_dbl_list_t *list)
void lam_list_empty_list(lam_list_t *list)
{
/* Since we don't retain the items, simply set
each item's next and prev pointers to 0. */
lam_dbl_item_t *ptr, *next;
lam_list_item_t *ptr, *next;
ptr = list->lam_dbl_head;
ptr = list->lam_list_head;
while ( ptr )
{
next = ptr->lam_dbl_next;
ptr->lam_dbl_next = ptr->lam_dbl_prev = 0;
next = ptr->lam_list_next;
ptr->lam_list_next = ptr->lam_list_prev = 0;
ptr = next;
}
list->lam_dbl_head = list->lam_dbl_tail = 0;
list->lam_dbl_length = 0;
list->lam_list_head = list->lam_list_tail = 0;
list->lam_list_length = 0;
}
int lam_dbl_insert(lam_dbl_list_t *list, lam_dbl_item_t *item, long long idx)
int lam_list_insert(lam_list_t *list, lam_list_item_t *item, long long idx)
{
/* Adds item to list at index and retains item. */
int i;
lam_dbl_item_t *ptr, *next;
lam_list_item_t *ptr, *next;
if ( idx >= list->lam_dbl_length )
if ( idx >= list->lam_list_length )
return 0;
if ( 0 == idx )
{
lam_dbl_prepend(list, item);
lam_list_prepend(list, item);
}
else
{
ptr = list->lam_dbl_head;
ptr = list->lam_list_head;
for ( i = 0; i < idx; i++ )
ptr = ptr->lam_dbl_next;
ptr = ptr->lam_list_next;
next = ptr->lam_dbl_next;
item->lam_dbl_next = next;
item->lam_dbl_prev = ptr;
next->lam_dbl_prev = item;
ptr->lam_dbl_next = item;
next = ptr->lam_list_next;
item->lam_list_next = next;
item->lam_list_prev = ptr;
next->lam_list_prev = item;
ptr->lam_list_next = item;
}
list->lam_dbl_length++;
list->lam_list_length++;
return 1;
}
lam_dbl_item_t *lam_dbl_get_first_item(lam_dbl_list_t *list)
lam_list_item_t *lam_list_get_first_item(lam_list_t *list)
{
/* Returns first item on list, but does not remove it from the list. */
return list->lam_dbl_head;
return list->lam_list_head;
}
lam_dbl_item_t *lam_dbl_get_last_item(lam_dbl_list_t *list)
lam_list_item_t *lam_list_get_last_item(lam_list_t *list)
{
/* Returns last item on list, but does not remove it from the list. */
return list->lam_dbl_tail;
return list->lam_list_tail;
}
void lam_dbl_prepend(lam_dbl_list_t *list, lam_dbl_item_t *item)
void lam_list_prepend(lam_list_t *list, lam_list_item_t *item)
{
/* Adds item to the front of the list and retains item. */
item->lam_dbl_next = list->lam_dbl_head;
item->lam_dbl_prev = 0;
if ( list->lam_dbl_head )
list->lam_dbl_head->lam_dbl_prev = item;
list->lam_dbl_head = item;
item->lam_list_next = list->lam_list_head;
item->lam_list_prev = 0;
if ( list->lam_list_head )
list->lam_list_head->lam_list_prev = item;
list->lam_list_head = item;
}
lam_dbl_item_t *lam_dbl_remove_first(lam_dbl_list_t *list)
lam_list_item_t *lam_list_remove_first(lam_list_t *list)
{
/* Removes and returns first item on list.
Caller now owns the item and should release the item
when caller is done with it.
*/
lam_dbl_item_t *item;
if ( 0 == list->lam_dbl_length )
lam_list_item_t *item;
if ( 0 == list->lam_list_length )
return 0;
list->lam_dbl_length--;
item = list->lam_dbl_head;
list->lam_dbl_head = item->lam_dbl_next;
if ( list->lam_dbl_length )
list->lam_list_length--;
item = list->lam_list_head;
list->lam_list_head = item->lam_list_next;
if ( list->lam_list_length )
{
item->lam_dbl_next->lam_dbl_prev = 0;
item->lam_list_next->lam_list_prev = 0;
}
else
list->lam_dbl_tail = 0;
list->lam_list_tail = 0;
item->lam_dbl_next = item->lam_dbl_prev = 0;
item->lam_list_next = item->lam_list_prev = 0;
return item;
}
lam_dbl_item_t *lam_dbl_remove_last(lam_dbl_list_t *list)
lam_list_item_t *lam_list_remove_last(lam_list_t *list)
{
/* Removes, releases and returns last item on list.
Caller now owns the item and should release the item
when caller is done with it.
*/
lam_dbl_item_t *item;
lam_list_item_t *item;
if ( 0 == list->lam_dbl_length )
if ( 0 == list->lam_list_length )
return 0;
list->lam_dbl_length--;
item = list->lam_dbl_head;
list->lam_dbl_tail = item->lam_dbl_prev;
if ( list->lam_dbl_length )
item->lam_dbl_prev->lam_dbl_next = 0;
list->lam_list_length--;
item = list->lam_list_head;
list->lam_list_tail = item->lam_list_prev;
if ( list->lam_list_length )
item->lam_list_prev->lam_list_next = 0;
else
list->lam_dbl_head = 0;
item->lam_dbl_next = item->lam_dbl_prev = 0;
list->lam_list_head = 0;
item->lam_list_next = item->lam_list_prev = 0;
return item;
}

Просмотреть файл

@ -13,9 +13,9 @@
*
*/
extern lam_class_info_t lam_dbl_item_cls;
extern lam_class_info_t lam_dbl_list_cls;
typedef int lam_dbl_type_t;
extern lam_class_info_t lam_list_item_cls;
extern lam_class_info_t lam_list_cls;
typedef int lam_list_type_t;
/*
@ -24,87 +24,87 @@ typedef int lam_dbl_type_t;
*
*/
typedef struct _lam_dbl_item
typedef struct lam_list_item
{
lam_object_t super;
lam_dbl_type_t lam_dbl_type;
struct _lam_dbl_item *lam_dbl_next;
struct _lam_dbl_item *lam_dbl_prev;
} lam_dbl_item_t;
lam_list_type_t lam_list_type;
struct lam_list_item *lam_list_next;
struct lam_list_item *lam_list_prev;
} lam_list_item_t;
void lam_dbl_item_init(lam_dbl_item_t *item);
void lam_dbl_item_destroy(lam_dbl_item_t *item);
void lam_list_item_init(lam_list_item_t *item);
void lam_list_item_destroy(lam_list_item_t *item);
#define lam_dbl_get_next(item) \
((item) ? (((lam_dbl_item_t*)(item))->lam_dbl_next) : 0)
#define lam_list_get_next(item) \
((item) ? (((lam_list_item_t*)(item))->lam_list_next) : 0)
#define lam_dbl_get_prev(item) \
((item) ? (((lam_dbl_item_t*)(item))->lam_dbl_prev) : 0)
#define lam_list_get_prev(item) \
((item) ? (((lam_list_item_t*)(item))->lam_list_prev) : 0)
/*
*
* lam_dbl_list_t interface
* lam_list_list_t interface
*
*/
typedef struct _lam_dbl_list
typedef struct lam_list
{
lam_object_t super;
lam_dbl_item_t *lam_dbl_head;
lam_dbl_item_t *lam_dbl_tail;
lam_dbl_type_t lam_dbl_type;
volatile size_t lam_dbl_length;
} lam_dbl_list_t;
lam_list_item_t *lam_list_head;
lam_list_item_t *lam_list_tail;
lam_list_type_t lam_list_type;
volatile size_t lam_list_length;
} lam_list_t;
void lam_dbl_init(lam_dbl_list_t *list);
void lam_dbl_destroy(lam_dbl_list_t *list);
void lam_list_init(lam_list_t *list);
void lam_list_destroy(lam_list_t *list);
/*
* Inlined accessor functions
*/
#define lam_dbl_get_type(list) \
((lam_dbl_list_t*)list)->lam_dbl_type
#define lam_list_get_type(list) \
((lam_list_list_t*)list)->lam_list_type
#define lam_dbl_set_type(list, type) \
(((lam_dbl_list_t*)list)->lam_dbl_type = type)
#define lam_list_set_type(list, type) \
(((lam_list_list_t*)list)->lam_list_type = type)
#define lam_dbl_get_size(list) \
((lam_dbl_list_t*)list)->lam_dbl_length
#define lam_list_get_size(list) \
((lam_list_list_t*)list)->lam_list_length
/*
* Returns first item on list, but does not remove it from the list.
*/
#define lam_dbl_get_first(list) \
((lam_dbl_list_t*)list)->lam_dbl_head
#define lam_list_get_first(list) \
((lam_list_list_t*)list)->lam_list_head
/*
* Returns last item on list, but does not remove it from the list.
*/
#define lam_dbl_get_last(list) \
((lam_dbl_list_t*)list)->lam_dbl_tail
#define lam_list_get_last(list) \
((lam_list_list_t*)list)->lam_list_tail
/*
* Adds item to the end of the list but does not retain item.
*/
void lam_dbl_append(lam_dbl_list_t *list, lam_dbl_item_t *item);
void lam_list_append(lam_list_t *list, lam_list_item_t *item);
/*
* Remove item from the list.
*/
lam_dbl_item_t* lam_dbl_remove(lam_dbl_list_t *list, lam_dbl_item_t *item);
lam_list_item_t* lam_list_remove(lam_list_t *list, lam_list_item_t *item);
/*
* Removes all items in list and sets each
* item's next and prev pointer to 0.
*/
void lam_dbl_empty_list(lam_dbl_list_t *list);
void lam_list_empty_list(lam_list_t *list);
/* Adds item to list at index and retains item.
@ -113,25 +113,25 @@ void lam_dbl_empty_list(lam_dbl_list_t *list);
Example: if idx = 2 and list = item1->item2->item3->item4, then
after insert, list = item1->item2->item->item3->item4
*/
int lam_dbl_insert(lam_dbl_list_t *list, lam_dbl_item_t *item, long long idx);
int lam_list_insert(lam_list_t *list, lam_list_item_t *item, long long idx);
/*
* Adds item to the front of the list and retains item.
*/
void lam_dbl_prepend(lam_dbl_list_t *list, lam_dbl_item_t *item);
void lam_list_prepend(lam_list_t *list, lam_list_item_t *item);
/*
* Removes and returns first item on list.
*/
lam_dbl_item_t *lam_dbl_remove_first(lam_dbl_list_t *list);
lam_list_item_t *lam_list_remove_first(lam_list_t *list);
/*
* Removes and returns last item on list.
*/
lam_dbl_item_t *lam_dbl_remove_last(lam_dbl_list_t *list);
lam_list_item_t *lam_list_remove_last(lam_list_t *list);
#endif /* LAM_LIST_H */

Просмотреть файл

@ -19,7 +19,7 @@
typedef struct lam_flist_elt
{
lam_dbl_item_t super;
lam_list_item_t super;
int fle_pool_idx;
} lam_flist_elt_t;

Просмотреть файл

@ -10,7 +10,7 @@ lam_class_info_t seg_list_cls = {"lam_seg_list_t", &lam_object_cls,
void lam_sgl_init(lam_seg_list_t *slist)
{
SUPER_INIT(slist, seg_list_cls.cls_parent);
STATIC_INIT(slist->sgl_list, &lam_dbl_list_cls);
STATIC_INIT(slist->sgl_list, &lam_list_cls);
lam_mtx_init(&slist->sgl_lock);
slist->sgl_min_bytes_pushed = 0;
slist->sgl_max_bytes_pushed = 0;
@ -44,7 +44,7 @@ void lam_sgl_append_elt_chunk(
slist->sgl_bytes_pushed += chunk_size;
for ( i = 0; i < n_elts; i++ )
{
lam_dbl_append(&(slist->sgl_list), (lam_dbl_item_t *)ptr);
lam_dbl_append(&(slist->sgl_list), (lam_list_item_t *)ptr);
ptr += elt_size;
}
}

Просмотреть файл

@ -18,7 +18,7 @@ typedef struct lam_seg_list
int sgl_max_consec_fail;
int sgl_consec_fail;
lam_mutex_t sgl_lock;
lam_dbl_list_t sgl_list;
lam_list_t sgl_list;
} lam_seg_list_t;
extern lam_class_info_t seg_list_cls;

Просмотреть файл

@ -27,7 +27,7 @@ lam_class_info_t lam_reactor_cls = {
};
lam_class_info_t lam_reactor_descriptor_cls = {
"lam_reactor_t", &lam_dbl_item_cls, (class_init_t)lam_reactor_descriptor_init,
"lam_reactor_t", &lam_list_item_cls, (class_init_t)lam_reactor_descriptor_init,
(class_destroy_t)lam_reactor_descriptor_destroy
};

Просмотреть файл

@ -34,7 +34,7 @@ typedef struct _lam_reactor_listener {
typedef struct _lam_reactor_descriptor {
lam_dbl_item_t rd_base;
lam_list_item_t rd_base;
int rd;
volatile int rd_flags;
lam_reactor_listener_t *rd_recv;
@ -50,9 +50,9 @@ void lam_reactor_descriptor_destroy(lam_reactor_descriptor_t*);
typedef struct _lam_reactor {
lam_object_t r_base;
lam_mutex_t r_mutex;
lam_dbl_list_t r_active;
lam_dbl_list_t r_free;
lam_dbl_list_t r_pending;
lam_list_t r_active;
lam_list_t r_free;
lam_list_t r_pending;
lam_fast_hash_t r_hash;
int r_max;
bool r_run;

Просмотреть файл

@ -227,8 +227,8 @@ extern int mca_coll_did;
extern int mca_coll_base_crossover;
extern int mca_coll_base_associative;
extern int mca_coll_base_reduce_crossover;
extern lam_dbl_list_t *mca_coll_base_opened;
extern lam_dbl_list_t *mca_coll_base_available;
extern lam_list_t *mca_coll_base_opened;
extern lam_list_t *mca_coll_base_available;
/*

Просмотреть файл

@ -28,7 +28,7 @@ typedef struct mca_pml_1_0_0 * (*mca_pml_init_1_0_0_fn_t)(
typedef uint64_t mca_pml_sequence_t;
typedef uint64_t mca_pml_tstamp_t;
typedef lam_dbl_list_t mca_pml_queue_t;
typedef lam_list_t mca_pml_queue_t;
typedef enum {
MCA_PML_REQUEST_TYPE_RECV,
@ -120,8 +120,8 @@ extern "C" {
* Public variables
*/
extern lam_dbl_list_t *mca_pml_base_opened;
extern lam_dbl_list_t *mca_pml_base_available;
extern lam_list_t *mca_pml_base_opened;
extern lam_list_t *mca_pml_base_available;
/*
* Global instance of array of pointers to lam_ssi_rpi_t. Will

Просмотреть файл

@ -9,11 +9,11 @@
extern lam_class_info_t lam_proc_cls;
extern lam_dbl_list_t lam_procs;
extern lam_list_t lam_procs;
struct lam_proc_t {
lam_dbl_item_t super; /* allow proc to be placed on a list */
lam_list_item_t super; /* allow proc to be placed on a list */
pid_t proc_id;
int proc_gid; /* globally unique identifier? */
struct mca_pml_proc_t* proc_pml; /* PML specific proc data */

Просмотреть файл

@ -19,7 +19,7 @@ typedef enum {
} lam_request_type_t;
struct lam_request_t {
lam_dbl_item_t super;
lam_list_item_t super;
lam_request_type_t req_type;
};
typedef struct lam_request_t lam_request_t;