diff options
author | Chris Johns <chrisj@rtems.org> | 2008-07-03 01:37:38 +0000 |
---|---|---|
committer | Chris Johns <chrisj@rtems.org> | 2008-07-03 01:37:38 +0000 |
commit | 72d2ec4da4ea788335adf921faebf0ac96d67c93 (patch) | |
tree | f50017188d1482928932df90c96985a0748616cd | |
parent | 2008-07-03 Chris Johns <chrisj@rtems.org> (diff) | |
download | rtems-72d2ec4da4ea788335adf921faebf0ac96d67c93.tar.bz2 |
2008-07-03 Chris Johns <chrisj@rtems.org>
* cpukit/libcsupport/include/chain.h: Removed. Use the SAPI
interface that is supported.
* cpukit/libcsupport/Makefile.am,
cpukit/libcsupport/preinstall.am: Remove chain.h header
references.
* cpukit/sapi/include/rtems/chain.h,
cpukit/sapi/inline/rtems/chain.inl: New. A supported chains
interface.
* cpukit/sapi/Makefile.am, cpukit/sapi/preinstall.am: Updated to
include the new chains interface.
* cpukit/libfs/src/imfs/imfs.h,
cpukit/libfs/src/imfs/imfs_creat.c,
cpukit/libfs/src/imfs/imfs_debug.c,
cpukit/libfs/src/imfs/imfs_directory.c,
cpukit/libfs/src/imfs/imfs_fsunmount.c,
cpukit/libfs/src/imfs/imfs_getchild.c,
cpukit/libfs/src/imfs/imfs_load_tar.c,
cpukit/libfs/src/imfs/imfs_rmnod.c,
cpukit/libfs/src/imfs/memfile.c,
cpukit/libfs/src/nfsclient/src/nfs.c,
cpukit/libcsupport/include/rtems/libio.h,
cpukit/libcsupport/src/malloc_deferred.c,
cpukit/libcsupport/src/mount.c,
cpukit/libcsupport/src/privateenv.c,
cpukit/libcsupport/src/unmount.c: Change to the new chains
interface.
* cpukit/libcsupport/src/malloc_boundary.c: Remove warning.
24 files changed, 483 insertions, 73 deletions
diff --git a/cpukit/ChangeLog b/cpukit/ChangeLog index d28ae99fab..04afa3ad0e 100644 --- a/cpukit/ChangeLog +++ b/cpukit/ChangeLog @@ -1,3 +1,38 @@ +2008-07-03 Chris Johns <chrisj@rtems.org> + + * cpukit/libcsupport/include/chain.h: Removed. Use the SAPI + interface that is supported. + + * cpukit/libcsupport/Makefile.am, + cpukit/libcsupport/preinstall.am: Remove chain.h header + references. + + * cpukit/sapi/include/rtems/chain.h, + cpukit/sapi/inline/rtems/chain.inl: New. A supported chains + interface. + + * cpukit/sapi/Makefile.am, cpukit/sapi/preinstall.am: Updated to + include the new chains interface. + + * cpukit/libfs/src/imfs/imfs.h, + cpukit/libfs/src/imfs/imfs_creat.c, + cpukit/libfs/src/imfs/imfs_debug.c, + cpukit/libfs/src/imfs/imfs_directory.c, + cpukit/libfs/src/imfs/imfs_fsunmount.c, + cpukit/libfs/src/imfs/imfs_getchild.c, + cpukit/libfs/src/imfs/imfs_load_tar.c, + cpukit/libfs/src/imfs/imfs_rmnod.c, + cpukit/libfs/src/imfs/memfile.c, + cpukit/libfs/src/nfsclient/src/nfs.c, + cpukit/libcsupport/include/rtems/libio.h, + cpukit/libcsupport/src/malloc_deferred.c, + cpukit/libcsupport/src/mount.c, + cpukit/libcsupport/src/privateenv.c, + cpukit/libcsupport/src/unmount.c: Change to the new chains + interface. + + * cpukit/libcsupport/src/malloc_boundary.c: Remove warning. + 2008-07-02 Ralf Corsépius <ralf.corsepius@rtems.org> * score/include/rtems/score/thread.h, diff --git a/cpukit/libblock/src/bdbuf.c b/cpukit/libblock/src/bdbuf.c index f695ede2ab..17c710a668 100644 --- a/cpukit/libblock/src/bdbuf.c +++ b/cpukit/libblock/src/bdbuf.c @@ -687,8 +687,8 @@ bdbuf_initialize_pool(rtems_bdbuf_config *config, int pool) p->nblks = config->num; p->tree = NULL; - Chain_Initialize_empty(&p->free); - Chain_Initialize_empty(&p->lru); + rtems_chain_initialize_empty(&p->free); + rtems_chain_initialize_empty(&p->lru); /* Allocate memory for buffer descriptors */ p->bdbufs = calloc(config->num, sizeof(bdbuf_buffer)); @@ -720,7 +720,7 @@ bdbuf_initialize_pool(rtems_bdbuf_config *config, int pool) b->actual = b->modified = b->in_progress = FALSE; b->use_count = 0; b->pool = pool; - _Chain_Append(&p->free, &b->link); + rtems_chain_append(&p->free, &b->link); } rc = rtems_semaphore_create( @@ -795,7 +795,7 @@ rtems_bdbuf_init(rtems_bdbuf_config *conf_table, int size) return RTEMS_NO_MEMORY; } - Chain_Initialize_empty(&rtems_bdbuf_ctx.mod); + rtems_chain_initialize_empty(&rtems_bdbuf_ctx.mod); /* Initialize buffer pools and roll out if something failed */ for (i = 0; i < size; i++) @@ -927,9 +927,9 @@ again: if (bd_buf == NULL) { /* Assign new buffer descriptor */ - if (_Chain_Is_empty(&bd_pool->free)) + if (rtems_chain_is_empty(&bd_pool->free)) { - bd_buf = (bdbuf_buffer *)Chain_Get(&bd_pool->lru); + bd_buf = (bdbuf_buffer *)rtems_chain_get(&bd_pool->lru); if (bd_buf != NULL) { int avl_result; @@ -943,7 +943,7 @@ again: } else { - bd_buf = (bdbuf_buffer *)Chain_Get(&(bd_pool->free)); + bd_buf = (bdbuf_buffer *)rtems_chain_get(&(bd_pool->free)); } if (bd_buf == NULL) @@ -1009,7 +1009,7 @@ again: /* Buffer descriptor is linked to the lru or mod chain. Remove it from there. */ - Chain_Extract(&bd_buf->link); + rtems_chain_extract(&bd_buf->link); } bd_buf->use_count++; while (bd_buf->in_progress != 0) @@ -1453,7 +1453,7 @@ bdbuf_release(bdbuf_buffer *bd_buf) /* Buffer was modified. Insert buffer to the modified buffers * list and initiate flushing. */ - Chain_Append(&rtems_bdbuf_ctx.mod, &bd_buf->link); + rtems_chain_append(&rtems_bdbuf_ctx.mod, &bd_buf->link); /* Release the flush_sema */ rc = rtems_semaphore_release(rtems_bdbuf_ctx.flush_sema); @@ -1462,7 +1462,7 @@ bdbuf_release(bdbuf_buffer *bd_buf) { /* Buffer was not modified. Add this descriptor to the * end of lru chain and make it available for reuse. */ - Chain_Append(&bd_pool->lru, &bd_buf->link); + rtems_chain_append(&bd_pool->lru, &bd_buf->link); rc = rtems_semaphore_release(bd_pool->bufget_sema); } } @@ -1690,7 +1690,7 @@ bdbuf_swapout_task(rtems_task_argument unused) : RTEMS_NO_WAIT, 0); if (rc == RTEMS_SUCCESSFUL) { - nxt_bd_buf = (bdbuf_buffer *)Chain_Get(&rtems_bdbuf_ctx.mod); + nxt_bd_buf = (bdbuf_buffer *)rtems_chain_get(&rtems_bdbuf_ctx.mod); if (nxt_bd_buf != NULL) { nxt_bd_buf->in_progress = TRUE; /* IMD try: clear "modified" bit early */ @@ -1784,12 +1784,12 @@ bdbuf_swapout_task(rtems_task_argument unused) { if (bd_buf->modified) { - Chain_Append(&rtems_bdbuf_ctx.mod, &bd_buf->link); + rtems_chain_append(&rtems_bdbuf_ctx.mod, &bd_buf->link); rc = rtems_semaphore_release(rtems_bdbuf_ctx.flush_sema); } else { - Chain_Append(&bd_pool->lru, &bd_buf->link); + rtems_chain_append(&bd_pool->lru, &bd_buf->link); rc = rtems_semaphore_release(bd_pool->bufget_sema); } } diff --git a/cpukit/libcsupport/Makefile.am b/cpukit/libcsupport/Makefile.am index 72dfdc264f..0dfa4357a3 100644 --- a/cpukit/libcsupport/Makefile.am +++ b/cpukit/libcsupport/Makefile.am @@ -10,7 +10,7 @@ noinst_LIBRARIES = libcsupport.a libcsupport_a_CPPFLAGS = $(AM_CPPFLAGS) include_rtemsdir = $(includedir)/rtems -include_rtems_HEADERS = include/chain.h include/console.h include/clockdrv.h \ +include_rtems_HEADERS = include/console.h include/clockdrv.h \ include/iosupp.h include/ringbuf.h include/rtc.h include/spurious.h \ include/timerdrv.h include/vmeintr.h diff --git a/cpukit/libcsupport/include/rtems/libio.h b/cpukit/libcsupport/include/rtems/libio.h index baa2219352..1767d1d789 100644 --- a/cpukit/libcsupport/include/rtems/libio.h +++ b/cpukit/libcsupport/include/rtems/libio.h @@ -24,6 +24,7 @@ #define _RTEMS_RTEMS_LIBIO_H #include <rtems.h> +#include <rtems/chain.h> #include <sys/types.h> #include <sys/stat.h> #include <sys/ioctl.h> @@ -308,7 +309,7 @@ typedef struct { */ struct rtems_filesystem_mount_table_entry_tt { - Chain_Node Node; + rtems_chain_node Node; rtems_filesystem_location_info_t mt_point_node; rtems_filesystem_location_info_t mt_fs_root; int options; diff --git a/cpukit/libcsupport/preinstall.am b/cpukit/libcsupport/preinstall.am index cccde53bc0..d76efdf511 100644 --- a/cpukit/libcsupport/preinstall.am +++ b/cpukit/libcsupport/preinstall.am @@ -32,10 +32,6 @@ $(PROJECT_INCLUDE)/rtems/$(dirstamp): @: > $(PROJECT_INCLUDE)/rtems/$(dirstamp) PREINSTALL_DIRS += $(PROJECT_INCLUDE)/rtems/$(dirstamp) -$(PROJECT_INCLUDE)/rtems/chain.h: include/chain.h $(PROJECT_INCLUDE)/rtems/$(dirstamp) - $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/chain.h -PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/chain.h - $(PROJECT_INCLUDE)/rtems/console.h: include/console.h $(PROJECT_INCLUDE)/rtems/$(dirstamp) $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/console.h PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/console.h diff --git a/cpukit/libcsupport/src/malloc_boundary.c b/cpukit/libcsupport/src/malloc_boundary.c index 706e224294..75ec05c1b6 100644 --- a/cpukit/libcsupport/src/malloc_boundary.c +++ b/cpukit/libcsupport/src/malloc_boundary.c @@ -159,7 +159,7 @@ void reportMallocError(const char *msg, struct mallocNode *mp) mp, mp->forw, mp->forw->back, mp->back, mp->back->forw); if (mp->memory != (mp + 1)) ind += sprintf(cbuf+ind, "mp+1:%p ", mp + 1); - ind += sprintf(cbuf+ind, "mp->memory:%p mp->size:%d\n", mp->memory, mp->size); + ind += sprintf(cbuf+ind, "mp->memory:%p mp->size:%li\n", mp->memory, mp->size); if (memcmp((char *)mp->memory + mp->size, SENTINEL, SENTINELSIZE) != 0) { ind += sprintf(cbuf+ind, "mp->sentinel: "); for (i = 0 ; i < SENTINELSIZE ; i++) diff --git a/cpukit/libcsupport/src/malloc_deferred.c b/cpukit/libcsupport/src/malloc_deferred.c index 57fd8752c3..923b0d980d 100644 --- a/cpukit/libcsupport/src/malloc_deferred.c +++ b/cpukit/libcsupport/src/malloc_deferred.c @@ -22,7 +22,7 @@ #include "malloc_p.h" -Chain_Control RTEMS_Malloc_GC_list; +rtems_chain_control RTEMS_Malloc_GC_list; boolean malloc_is_system_state_OK(void) { @@ -37,17 +37,17 @@ boolean malloc_is_system_state_OK(void) void malloc_deferred_frees_initialize(void) { - Chain_Initialize_empty(&RTEMS_Malloc_GC_list); + rtems_chain_initialize_empty(&RTEMS_Malloc_GC_list); } void malloc_deferred_frees_process(void) { - Chain_Node *to_be_freed; + rtems_chain_node *to_be_freed; /* * If some free's have been deferred, then do them now. */ - while ((to_be_freed = Chain_Get(&RTEMS_Malloc_GC_list)) != NULL) + while ((to_be_freed = rtems_chain_get(&RTEMS_Malloc_GC_list)) != NULL) free(to_be_freed); } @@ -55,6 +55,6 @@ void malloc_deferred_free( void *pointer ) { - Chain_Append(&RTEMS_Malloc_GC_list, (Chain_Node *)pointer); + rtems_chain_append(&RTEMS_Malloc_GC_list, (rtems_chain_node *)pointer); } #endif diff --git a/cpukit/libcsupport/src/mount.c b/cpukit/libcsupport/src/mount.c index 997cf859b1..f66778217d 100644 --- a/cpukit/libcsupport/src/mount.c +++ b/cpukit/libcsupport/src/mount.c @@ -33,7 +33,7 @@ #include <rtems/libio_.h> -Chain_Control rtems_filesystem_mount_table_control; +rtems_chain_control rtems_filesystem_mount_table_control; /* * Prototypes that probably should be somewhere else. @@ -227,7 +227,8 @@ int mount( * Add the mount table entry to the mount table chain */ - Chain_Append( &rtems_filesystem_mount_table_control, &temp_mt_entry->Node ); + rtems_chain_append( &rtems_filesystem_mount_table_control, + &temp_mt_entry->Node ); if ( mt_entry ) *mt_entry = temp_mt_entry; @@ -255,7 +256,7 @@ cleanup_and_bail: int init_fs_mount_table() { - Chain_Initialize_empty ( &rtems_filesystem_mount_table_control ); + rtems_chain_initialize_empty ( &rtems_filesystem_mount_table_control ); return 0; } @@ -274,7 +275,7 @@ static int Is_node_fs_root( rtems_filesystem_location_info_t *loc ) { - Chain_Node *the_node; + rtems_chain_node *the_node; rtems_filesystem_mount_table_entry_t *the_mount_entry; /* @@ -282,7 +283,7 @@ static int Is_node_fs_root( */ for ( the_node = rtems_filesystem_mount_table_control.first; - !Chain_Is_tail( &rtems_filesystem_mount_table_control, the_node ); + !rtems_chain_is_tail( &rtems_filesystem_mount_table_control, the_node ); the_node = the_node->next ) { the_mount_entry = (rtems_filesystem_mount_table_entry_t *) the_node; if ( the_mount_entry->mt_fs_root.node_access == loc->node_access ) diff --git a/cpukit/libcsupport/src/privateenv.c b/cpukit/libcsupport/src/privateenv.c index e1a5e674e3..286a2f6733 100644 --- a/cpukit/libcsupport/src/privateenv.c +++ b/cpukit/libcsupport/src/privateenv.c @@ -20,10 +20,11 @@ #include <stdlib.h> /* free */ #include <rtems.h> +#include <rtems/chain.h> #include <rtems/libio.h> #include <rtems/libio_.h> -extern Chain_Control rtems_filesystem_mount_table_control; +extern rtems_chain_control rtems_filesystem_mount_table_control; #define THE_ROOT_FS_LOC \ (((rtems_filesystem_mount_table_entry_t*)\ diff --git a/cpukit/libcsupport/src/unmount.c b/cpukit/libcsupport/src/unmount.c index f37d3f2e56..422e89ea6e 100644 --- a/cpukit/libcsupport/src/unmount.c +++ b/cpukit/libcsupport/src/unmount.c @@ -37,7 +37,7 @@ * Data structures and routines private to mount/unmount pair. */ -extern Chain_Control rtems_filesystem_mount_table_control; +extern rtems_chain_control rtems_filesystem_mount_table_control; int search_mt_for_mount_point( rtems_filesystem_location_info_t *location_of_mount_point @@ -69,7 +69,7 @@ rtems_boolean file_systems_below_this_mountpoint( rtems_filesystem_mount_table_entry_t *fs_to_unmount ) { - Chain_Node *the_node; + rtems_chain_node *the_node; rtems_filesystem_mount_table_entry_t *the_mount_entry; /* @@ -78,7 +78,7 @@ rtems_boolean file_systems_below_this_mountpoint( */ for ( the_node = rtems_filesystem_mount_table_control.first; - !Chain_Is_tail( &rtems_filesystem_mount_table_control, the_node ); + !rtems_chain_is_tail( &rtems_filesystem_mount_table_control, the_node ); the_node = the_node->next ) { the_mount_entry = ( rtems_filesystem_mount_table_entry_t * )the_node; if (the_mount_entry->mt_point_node.mt_entry == fs_root_loc->mt_entry ) { @@ -205,7 +205,7 @@ int unmount( * Extract the mount table entry from the chain */ - Chain_Extract( ( Chain_Node * ) mt_entry ); + rtems_chain_extract( ( rtems_chain_node * ) mt_entry ); /* * Free the memory node that was allocated in mount diff --git a/cpukit/libfs/src/imfs/imfs.h b/cpukit/libfs/src/imfs/imfs.h index ae1839b3f7..6f872e507c 100644 --- a/cpukit/libfs/src/imfs/imfs.h +++ b/cpukit/libfs/src/imfs/imfs.h @@ -42,7 +42,7 @@ struct IMFS_jnode_tt; typedef struct IMFS_jnode_tt IMFS_jnode_t; typedef struct { - Chain_Control Entries; + rtems_chain_control Entries; rtems_filesystem_mount_table_entry_t *mt_fs; } IMFS_directory_t; @@ -158,7 +158,7 @@ typedef union { */ struct IMFS_jnode_tt { - Chain_Node Node; /* for chaining them together */ + rtems_chain_node Node; /* for chaining them together */ IMFS_jnode_t *Parent; /* Parent node */ char name[IMFS_NAME_MAX+1]; /* "basename" */ mode_t st_mode; /* File mode */ diff --git a/cpukit/libfs/src/imfs/imfs_creat.c b/cpukit/libfs/src/imfs/imfs_creat.c index 1eaea0b384..ccf88bdf64 100644 --- a/cpukit/libfs/src/imfs/imfs_creat.c +++ b/cpukit/libfs/src/imfs/imfs_creat.c @@ -85,7 +85,7 @@ IMFS_jnode_t *IMFS_create_node( switch (type) { case IMFS_DIRECTORY: - Chain_Initialize_empty(&node->info.directory.Entries); + rtems_chain_initialize_empty(&node->info.directory.Entries); break; case IMFS_HARD_LINK: @@ -122,7 +122,7 @@ IMFS_jnode_t *IMFS_create_node( */ if ( parent ) { - Chain_Append( &parent->info.directory.Entries, &node->Node ); + rtems_chain_append( &parent->info.directory.Entries, &node->Node ); node->Parent = parent; fs_info = parent_loc->mt_entry->fs_info; diff --git a/cpukit/libfs/src/imfs/imfs_debug.c b/cpukit/libfs/src/imfs/imfs_debug.c index 8b53aea1d6..d766c5e8b1 100644 --- a/cpukit/libfs/src/imfs/imfs_debug.c +++ b/cpukit/libfs/src/imfs/imfs_debug.c @@ -119,8 +119,8 @@ void IMFS_dump_directory( int level ) { - Chain_Node *the_node; - Chain_Control *the_chain; + rtems_chain_node *the_node; + rtems_chain_control *the_chain; IMFS_jnode_t *the_jnode; int i; @@ -133,7 +133,7 @@ void IMFS_dump_directory( the_chain = &the_directory->info.directory.Entries; for ( the_node = the_chain->first; - !_Chain_Is_tail( the_chain, the_node ); + !rtems_chain_is_tail( the_chain, the_node ); the_node = the_node->next ) { the_jnode = (IMFS_jnode_t *) the_node; diff --git a/cpukit/libfs/src/imfs/imfs_directory.c b/cpukit/libfs/src/imfs/imfs_directory.c index 6f7c889d59..fd3988b59e 100644 --- a/cpukit/libfs/src/imfs/imfs_directory.c +++ b/cpukit/libfs/src/imfs/imfs_directory.c @@ -82,19 +82,19 @@ ssize_t imfs_dir_read( * Read up to element iop->offset in the directory chain of the * imfs_jnode_t struct for this file descriptor. */ - Chain_Node *the_node; - Chain_Control *the_chain; - IMFS_jnode_t *the_jnode; - int bytes_transferred; - int current_entry; - int first_entry; - int last_entry; - struct dirent tmp_dirent; + rtems_chain_node *the_node; + rtems_chain_control *the_chain; + IMFS_jnode_t *the_jnode; + int bytes_transferred; + int current_entry; + int first_entry; + int last_entry; + struct dirent tmp_dirent; the_jnode = (IMFS_jnode_t *)iop->file_info; the_chain = &the_jnode->info.directory.Entries; - if ( Chain_Is_empty( the_chain ) ) + if ( rtems_chain_is_empty( the_chain ) ) return 0; /* Move to the first of the desired directory entries */ @@ -112,7 +112,7 @@ ssize_t imfs_dir_read( current_entry < last_entry; current_entry = current_entry + sizeof(struct dirent) ){ - if ( Chain_Is_tail( the_chain, the_node ) ){ + if ( rtems_chain_is_tail( the_chain, the_node ) ){ /* We hit the tail of the chain while trying to move to the first */ /* entry in the read */ return bytes_transferred; /* Indicate that there are no more */ @@ -238,9 +238,9 @@ int imfs_dir_fstat( struct stat *buf ) { - Chain_Node *the_node; - Chain_Control *the_chain; - IMFS_jnode_t *the_jnode; + rtems_chain_node *the_node; + rtems_chain_control *the_chain; + IMFS_jnode_t *the_jnode; the_jnode = (IMFS_jnode_t *) loc->node_access; @@ -265,7 +265,7 @@ int imfs_dir_fstat( /* Run through the chain and count the number of directory entries */ /* that are subordinate to this directory node */ for ( the_node = the_chain->first ; - !_Chain_Is_tail( the_chain, the_node ) ; + !rtems_chain_is_tail( the_chain, the_node ) ; the_node = the_node->next ) { buf->st_size = buf->st_size + sizeof( struct dirent ); @@ -293,7 +293,7 @@ int imfs_dir_rmnod( * You cannot remove a node that still has children */ - if ( ! Chain_Is_empty( &the_jnode->info.directory.Entries ) ) + if ( ! rtems_chain_is_empty( &the_jnode->info.directory.Entries ) ) rtems_set_errno_and_return_minus_one( ENOTEMPTY ); /* @@ -315,7 +315,7 @@ int imfs_dir_rmnod( */ if ( the_jnode->Parent != NULL ) { - Chain_Extract( (Chain_Node *) the_jnode ); + rtems_chain_extract( (rtems_chain_node *) the_jnode ); the_jnode->Parent = NULL; } diff --git a/cpukit/libfs/src/imfs/imfs_fsunmount.c b/cpukit/libfs/src/imfs/imfs_fsunmount.c index c87b2e665b..c3a12efb14 100644 --- a/cpukit/libfs/src/imfs/imfs_fsunmount.c +++ b/cpukit/libfs/src/imfs/imfs_fsunmount.c @@ -37,13 +37,13 @@ (&jnode->info.directory.Entries) #define jnode_has_no_children( jnode ) \ - Chain_Is_empty( jnode_get_control( jnode ) ) + rtems_chain_is_empty( jnode_get_control( jnode ) ) #define jnode_has_children( jnode ) \ ( ! jnode_has_no_children( jnode ) ) #define jnode_get_first_child( jnode ) \ - ((IMFS_jnode_t *)( Chain_Head( jnode_get_control( jnode ) )->next)) + ((IMFS_jnode_t *)( rtems_chain_head( jnode_get_control( jnode ) )->next)) int IMFS_fsunmount( rtems_filesystem_mount_table_entry_t *temp_mt_entry diff --git a/cpukit/libfs/src/imfs/imfs_getchild.c b/cpukit/libfs/src/imfs/imfs_getchild.c index 0c29516dd7..2b47ba2714 100644 --- a/cpukit/libfs/src/imfs/imfs_getchild.c +++ b/cpukit/libfs/src/imfs/imfs_getchild.c @@ -30,9 +30,9 @@ IMFS_jnode_t *IMFS_find_match_in_dir( char *name ) { - Chain_Node *the_node; - Chain_Control *the_chain; - IMFS_jnode_t *the_jnode; + rtems_chain_node *the_node; + rtems_chain_control *the_chain; + IMFS_jnode_t *the_jnode; /* * Check for fatal errors. A NULL directory show a problem in the @@ -60,7 +60,7 @@ IMFS_jnode_t *IMFS_find_match_in_dir( the_chain = &directory->info.directory.Entries; for ( the_node = the_chain->first; - !_Chain_Is_tail( the_chain, the_node ); + !rtems_chain_is_tail( the_chain, the_node ); the_node = the_node->next ) { the_jnode = (IMFS_jnode_t *) the_node; diff --git a/cpukit/libfs/src/imfs/imfs_load_tar.c b/cpukit/libfs/src/imfs/imfs_load_tar.c index e229f3be67..0846f2e1ee 100644 --- a/cpukit/libfs/src/imfs/imfs_load_tar.c +++ b/cpukit/libfs/src/imfs/imfs_load_tar.c @@ -22,7 +22,6 @@ #include <rtems.h> #include <rtems/libio_.h> -#include <rtems/chain.h> #include <rtems/imfs.h> #include <rtems/untar.h> #include <rtems/tar.h> diff --git a/cpukit/libfs/src/imfs/imfs_rmnod.c b/cpukit/libfs/src/imfs/imfs_rmnod.c index f37cb6d23c..85202b2c87 100644 --- a/cpukit/libfs/src/imfs/imfs_rmnod.c +++ b/cpukit/libfs/src/imfs/imfs_rmnod.c @@ -43,7 +43,7 @@ int IMFS_rmnod( */ if ( the_jnode->Parent != NULL ) { - Chain_Extract( (Chain_Node *) the_jnode ); + rtems_chain_extract( (rtems_chain_node *) the_jnode ); the_jnode->Parent = NULL; } @@ -73,7 +73,7 @@ int IMFS_rmnod( if ( the_jnode->type == IMFS_SYM_LINK ) { if ( the_jnode->info.sym_link.name ) - free( the_jnode->info.sym_link.name ); + free( (void*) the_jnode->info.sym_link.name ); } free( the_jnode ); } diff --git a/cpukit/libfs/src/imfs/memfile.c b/cpukit/libfs/src/imfs/memfile.c index 799715f06c..2391373acb 100644 --- a/cpukit/libfs/src/imfs/memfile.c +++ b/cpukit/libfs/src/imfs/memfile.c @@ -1117,7 +1117,7 @@ int memfile_rmnod( */ if ( the_jnode->Parent != NULL ) { - Chain_Extract( (Chain_Node *) the_jnode ); + rtems_chain_extract( (rtems_chain_node *) the_jnode ); the_jnode->Parent = NULL; } diff --git a/cpukit/libfs/src/nfsclient/src/nfs.c b/cpukit/libfs/src/nfsclient/src/nfs.c index 62160886d1..7eb207fe65 100644 --- a/cpukit/libfs/src/nfsclient/src/nfs.c +++ b/cpukit/libfs/src/nfsclient/src/nfs.c @@ -1870,7 +1870,7 @@ static int nfs_unmount( /* for reference (libio.h) */ struct rtems_filesystem_mount_table_entry_tt { - Chain_Node Node; + rtems_chain_node Node; rtems_filesystem_location_info_t mt_point_node; rtems_filesystem_location_info_t mt_fs_root; int options; diff --git a/cpukit/sapi/Makefile.am b/cpukit/sapi/Makefile.am index ad4b3fa864..a9de4c47e0 100644 --- a/cpukit/sapi/Makefile.am +++ b/cpukit/sapi/Makefile.am @@ -8,13 +8,14 @@ include $(top_srcdir)/automake/compile.am include_rtemsdir = $(includedir)/rtems include_rtems_HEADERS = include/confdefs.h -include_rtems_HEADERS += include/rtems/config.h include/rtems/extension.h \ - include/rtems/fatal.h include/rtems/init.h include/rtems/io.h \ - include/rtems/mptables.h include/rtems/sptables.h +include_rtems_HEADERS += include/rtems/chain.h include/rtems/config.h \ + include/rtems/extension.h include/rtems/fatal.h include/rtems/init.h \ + include/rtems/io.h include/rtems/mptables.h include/rtems/sptables.h EXTRA_DIST = include/rtems/README -include_rtems_HEADERS += inline/rtems/extension.inl +include_rtems_HEADERS += inline/rtems/chain.inl \ + inline/rtems/extension.inl ## src AM_CPPFLAGS += -D__RTEMS_INSIDE__ diff --git a/cpukit/sapi/include/rtems/chain.h b/cpukit/sapi/include/rtems/chain.h new file mode 100644 index 0000000000..77ff4fceac --- /dev/null +++ b/cpukit/sapi/include/rtems/chain.h @@ -0,0 +1,54 @@ +/** + * @file rtems/chain.h + * + * This include file contains all the constants and structures associated + * with the Chain API in RTEMS. The chain is a double linked list that + * is part of the Super Core. This is the published interface to that + * code. + * + */ + +/* + * COPYRIGHT (c) 1989-2008. + * On-Line Applications Research Corporation (OAR). + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rtems.com/license/LICENSE. + * + * $Id$ + */ + +#ifndef _RTEMS_CHAIN_H +#define _RTEMS_CHAIN_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include <rtems/system.h> +#include <rtems/score/chain.h> + +/** + * @typedef rtems_chain_node + * + * A node that can be manipulated in the chain. + */ +typedef Chain_Node rtems_chain_node; + +/** + * @typedef rtems_chain_control + * + * The chain's control anchors the chain. + */ +typedef Chain_Control rtems_chain_control; + + +#include <rtems/chain.inl> + +#ifdef __cplusplus +} +#endif + +#endif +/* end of include file */ diff --git a/cpukit/sapi/inline/rtems/chain.inl b/cpukit/sapi/inline/rtems/chain.inl new file mode 100644 index 0000000000..6885f3b1f3 --- /dev/null +++ b/cpukit/sapi/inline/rtems/chain.inl @@ -0,0 +1,314 @@ +/** + * @file rtems/chain.inl + * + * This include file contains all the constants and structures associated + * with the Chain API in RTEMS. The chain is a double linked list that + * is part of the Super Core. This is the published interface to that + * code. + * + * Iterate the node of a chain can be performed with the following code: + * + * rtems_chain_control* cc = &object->pending; + * rtems_chain_node* cn = cc->first; + * while (!rtems_chain_is_tail (cc, cn)) + * { + * cn = cn->next; + * } + */ + +/* + * COPYRIGHT (c) 1989-2008. + * On-Line Applications Research Corporation (OAR). + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rtems.com/license/LICENSE. + * + * $Id$ + */ + +#ifndef _RTEMS_CHAIN_INL +#define _RTEMS_CHAIN_INL + +#include <rtems/score/chain.inl> + +/** + * @brief Initialize this Chain as Empty + * + * This routine initializes the specified chain to contain zero nodes. + * + * @param[in] the_chain is the chain to be initialized. + */ +RTEMS_INLINE_ROUTINE void rtems_chain_initialize_empty( + rtems_chain_control *the_chain +) +{ + _Chain_Initialize_empty( the_chain ); +} + +/** + * @brief Is the Chain Node Pointer NULL + * + * This function returns TRUE if the_node is NULL and FALSE otherwise. + * + * @param[in] the_node is the node pointer to check. + * + * @return This method returns TRUE if the_node is NULL and FALSE otherwise. + */ +RTEMS_INLINE_ROUTINE boolean rtems_chain_is_null_node( + const rtems_chain_node *the_node +) +{ + return _Chain_Is_null_node( the_node ); +} + +/** + * @brief Return pointer to Chain Head + * + * This function returns a pointer to the first node on the chain. + * + * @param[in] the_chain is the chain to be operated upon. + * + * @return This method returns the permanent head node of the chain. + */ +RTEMS_INLINE_ROUTINE rtems_chain_node *rtems_chain_head( + rtems_chain_control *the_chain +) +{ + return _Chain_Head( the_chain ); +} + +/** + * @brief Return pointer to Chain Tail + * + * This function returns a pointer to the last node on the chain. + * + * @param[in] the_chain is the chain to be operated upon. + * + * @return This method returns the permanent tail node of the chain. + */ +RTEMS_INLINE_ROUTINE rtems_chain_node *rtems_chain_tail( + rtems_chain_control *the_chain +) +{ + return _Chain_Tail( the_chain ); +} + +/** + * @brief Are Two Nodes Equal + * + * This function returns TRUE if @a left and @a right are equal, + * and FALSE otherwise. + * + * @param[in] left is the node on the left hand side of the comparison. + * @param[in] right is the node on the left hand side of the comparison. + * + * @return This function returns TRUE if @a left and @a right are equal, + * and FALSE otherwise. + */ +RTEMS_INLINE_ROUTINE boolean rtems_chain_are_nodes_equal( + const rtems_chain_node *left, + const rtems_chain_node *right +) +{ + return _Chain_Are_nodes_equal( left, right ); +} + +/** + * @brief Is the Chain Empty + * + * This function returns TRUE if there a no nodes on @a the_chain and + * FALSE otherwise. + * + * @param[in] the_chain is the chain to be operated upon. + * + * @return This function returns TRUE if there a no nodes on @a the_chain and + * FALSE otherwise. + */ +RTEMS_INLINE_ROUTINE boolean rtems_chain_is_empty( + rtems_chain_control *the_chain +) +{ + return _Chain_Is_empty( the_chain ); +} + +/** + * @brief Is this the First Node on the Chain + * + * This function returns TRUE if the_node is the first node on a chain and + * FALSE otherwise. + * + * @param[in] the_node is the node the caller wants to know if it is + * the first node on a chain. + * + * @return This function returns TRUE if @a the_node is the first node on + * a chain and FALSE otherwise. + */ +RTEMS_INLINE_ROUTINE boolean rtems_chain_is_first( + const rtems_chain_node *the_node +) +{ + return _Chain_Is_first( the_node ); +} + +/** + * @brief Is this the Last Node on the Chain + * + * This function returns TRUE if @a the_node is the last node on a chain and + * FALSE otherwise. + * + * @param[in] the_node is the node to check as the last node. + * + * @return This function returns TRUE if @a the_node is the last node on + * a chain and FALSE otherwise. + */ +RTEMS_INLINE_ROUTINE boolean rtems_chain_is_last( + const rtems_chain_node *the_node +) +{ + return _Chain_Is_last( the_node ); +} + +/** + * @brief Does this Chain have only One Node + * + * This function returns TRUE if there is only one node on @a the_chain and + * FALSE otherwise. + * + * @param[in] the_chain is the chain to be operated upon. + * + * @return This function returns TRUE if there is only one node on + * @a the_chain and FALSE otherwise. + */ +RTEMS_INLINE_ROUTINE boolean rtems_chain_has_only_one_node( + const rtems_chain_control *the_chain +) +{ + return _Chain_Has_only_one_node( the_chain ); +} + +/** + * @brief Is this Node the Chain Head + * + * This function returns TRUE if @a the_node is the head of the_chain and + * FALSE otherwise. + * + * @param[in] the_chain is the chain to be operated upon. + * @param[in] the_node is the node to check for being the Chain Head. + * + * @return This function returns TRUE if @a the_node is the head of + * @a the_chain and FALSE otherwise. + */ +RTEMS_INLINE_ROUTINE boolean rtems_chain_is_head( + rtems_chain_control *the_chain, + const rtems_chain_node *the_node +) +{ + return _Chain_Is_head( the_chain, the_node ); +} + +/** + * @brief Is this Node the Chail Tail + * + * This function returns TRUE if the_node is the tail of the_chain and + * FALSE otherwise. + * + * @param[in] the_chain is the chain to be operated upon. + * @param[in] the_node is the node to check for being the Chain Tail. + */ +RTEMS_INLINE_ROUTINE boolean rtems_chain_is_tail( + rtems_chain_control *the_chain, + const rtems_chain_node *the_node +) +{ + return _Chain_Is_tail( the_chain, the_node ); +} + +/** + * @brief Extract the specified node from a chain + * + * This routine extracts @a the_node from the chain on which it resides. + * It disables interrupts to ensure the atomicity of the + * extract operation. + * + * @arg the_node specifies the node to extract + */ +RTEMS_INLINE_ROUTINE void rtems_chain_extract( + rtems_chain_node *the_node +) +{ + _Chain_Extract( the_node ); +} + +/** + * @brief Obtain the first node on a chain + * + * This function removes the first node from @a the_chain and returns + * a pointer to that node. If @a the_chain is empty, then NULL is returned. + * + * @return This method returns a pointer a node. If a node was removed, + * then a pointer to that node is returned. If @a the_chain was + * empty, then NULL is returned. + * + * @note It disables interrupts to ensure the atomicity of the get operation. + */ +RTEMS_INLINE_ROUTINE rtems_chain_node *rtems_chain_get( + rtems_chain_control *the_chain +) +{ + return _Chain_Get( the_chain ); +} + +/** + * @brief Insert a node on a chain + * + * This routine inserts @a the_node on a chain immediately following + * @a after_node. + * + * @note It disables interrupts to ensure the atomicity + * of the extract operation. + */ +RTEMS_INLINE_ROUTINE void rtems_chain_insert( + rtems_chain_node *after_node, + rtems_chain_node *the_node +) +{ + _Chain_Insert( after_node, the_node ); +} + +/** + * @brief Append a node on the end of a chain + * + * This routine appends @a the_node onto the end of @a the_chain. + * + * @note It disables interrupts to ensure the atomicity of the + * append operation. + */ +RTEMS_INLINE_ROUTINE void rtems_chain_append( + rtems_chain_control *the_chain, + rtems_chain_node *the_node +) +{ + _Chain_Append( the_chain, the_node ); +} + +/** @brief Prepend a Node + * + * This routine prepends the_node onto the front of the_chain. + * + * @param[in] the_chain is the chain to be operated upon. + * @param[in] the_node is the node to be prepended. + * + * @note It disables interrupts to ensure the atomicity of the + * prepend operation. + */ +RTEMS_INLINE_ROUTINE void rtems_chain_prepend( + rtems_chain_control *the_chain, + rtems_chain_node *the_node +) +{ + _Chain_Prepend( the_chain, the_node ); +} + +#endif +/* end of include file */ diff --git a/cpukit/sapi/preinstall.am b/cpukit/sapi/preinstall.am index e3f34d07ba..ba4ef1200c 100644 --- a/cpukit/sapi/preinstall.am +++ b/cpukit/sapi/preinstall.am @@ -22,6 +22,10 @@ $(PROJECT_INCLUDE)/rtems/confdefs.h: include/confdefs.h $(PROJECT_INCLUDE)/rtems $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/confdefs.h PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/confdefs.h +$(PROJECT_INCLUDE)/rtems/chain.h: include/rtems/chain.h $(PROJECT_INCLUDE)/rtems/$(dirstamp) + $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/chain.h +PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/chain.h + $(PROJECT_INCLUDE)/rtems/config.h: include/rtems/config.h $(PROJECT_INCLUDE)/rtems/$(dirstamp) $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/config.h PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/config.h @@ -50,6 +54,10 @@ $(PROJECT_INCLUDE)/rtems/sptables.h: include/rtems/sptables.h $(PROJECT_INCLUDE) $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/sptables.h PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/sptables.h +$(PROJECT_INCLUDE)/rtems/chain.inl: inline/rtems/chain.inl $(PROJECT_INCLUDE)/rtems/$(dirstamp) + $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/chain.inl +PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/chain.inl + $(PROJECT_INCLUDE)/rtems/extension.inl: inline/rtems/extension.inl $(PROJECT_INCLUDE)/rtems/$(dirstamp) $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/extension.inl PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/extension.inl |