posix: Create spinlock implementation header

Move implementation specific parts of spinlock.h and spinlock.inl into
new header file spinlockimpl.h.  The spinlock.h contains now only the
application visible API.
This commit is contained in:
Sebastian Huber
2013-07-22 16:57:24 +02:00
parent f17c779828
commit eb448eece9
13 changed files with 57 additions and 55 deletions
+1 -1
View File
@@ -39,7 +39,7 @@
#include <rtems/posix/pthreadimpl.h>
#include <rtems/posix/rwlockimpl.h>
#include <rtems/posix/semaphoreimpl.h>
#include <rtems/posix/spinlock.h>
#include <rtems/posix/spinlockimpl.h>
#include <rtems/posix/timerimpl.h>
#endif
+1 -1
View File
@@ -52,9 +52,9 @@ include_rtems_posix_HEADERS += include/rtems/posix/barrierimpl.h
include_rtems_posix_HEADERS += include/rtems/posix/rwlock.h
include_rtems_posix_HEADERS += include/rtems/posix/rwlockimpl.h
include_rtems_posix_HEADERS += include/rtems/posix/spinlock.h
include_rtems_posix_HEADERS += include/rtems/posix/spinlockimpl.h
include_rtems_posix_HEADERS += inline/rtems/posix/key.inl
include_rtems_posix_HEADERS += inline/rtems/posix/spinlock.inl
## src
libposix_a_SOURCES += src/aio_cancel.c src/aio_error.c src/aio_fsync.c \
+3 -36
View File
@@ -25,6 +25,9 @@
#ifndef _RTEMS_POSIX_SPINLOCK_H
#define _RTEMS_POSIX_SPINLOCK_H
#include <rtems/score/object.h>
#include <rtems/score/corespinlock.h>
#ifdef __cplusplus
extern "C" {
#endif
@@ -39,9 +42,6 @@ extern "C" {
*/
/**@{**/
#include <rtems/score/object.h>
#include <rtems/score/corespinlock.h>
/**
* This type defines the control block used to manage each spinlock.
*/
@@ -53,39 +53,6 @@ typedef struct {
CORE_spinlock_Control Spinlock;
} POSIX_Spinlock_Control;
/**
* The following defines the information control block used to manage
* this class of objects.
*/
POSIX_EXTERN Objects_Information _POSIX_Spinlock_Information;
/**
* @brief POSIX spinlock manager initialization.
*
* This routine performs the initialization necessary for this manager.
*/
void _POSIX_Spinlock_Manager_initialization(void);
/**
* @brief Translate core spinlock status code.
*
* This routine translates SuperCore Spinlock status codes into the
* corresponding POSIX ones.
*
* @param[in] the_spinlock_status is the SuperCore status.
*
* @return the corresponding POSIX status
*/
int _POSIX_Spinlock_Translate_core_spinlock_return_code(
CORE_spinlock_Status the_spinlock_status
);
#ifndef __RTEMS_APPLICATION__
#include <rtems/posix/spinlock.inl>
#endif
/** @} */
#ifdef __cplusplus
@@ -16,15 +16,46 @@
* http://www.rtems.com/license/LICENSE.
*/
#ifndef _RTEMS_POSIX_SPINLOCK_H
# error "Never use <rtems/posix/spinlock.inl> directly; include <rtems/posix/spinlock.h> instead."
#endif
#ifndef _RTEMS_POSIX_SPINLOCKIMPL_H
#define _RTEMS_POSIX_SPINLOCKIMPL_H
#ifndef _RTEMS_POSIX_SPINLOCK_INL
#define _RTEMS_POSIX_SPINLOCK_INL
#include <rtems/posix/spinlock.h>
#include <pthread.h>
#ifdef __cplusplus
extern "C" {
#endif
/**
* The following defines the information control block used to manage
* this class of objects.
*/
POSIX_EXTERN Objects_Information _POSIX_Spinlock_Information;
/**
* @brief POSIX spinlock manager initialization.
*
* This routine performs the initialization necessary for this manager.
*/
void _POSIX_Spinlock_Manager_initialization(void);
/**
* @brief Translate core spinlock status code.
*
* This routine translates SuperCore Spinlock status codes into the
* corresponding POSIX ones.
*
* @param[in] the_spinlock_status is the SuperCore status.
*
* @return the corresponding POSIX status
*/
int _POSIX_Spinlock_Translate_core_spinlock_return_code(
CORE_spinlock_Status the_spinlock_status
);
/**
* @brief Allocate a spinlock control block.
*
@@ -92,5 +123,9 @@ RTEMS_INLINE_ROUTINE bool _POSIX_Spinlock_Is_null (
return ( the_spinlock == NULL );
}
#ifdef __cplusplus
}
#endif
#endif
/* end of include file */
+4 -4
View File
@@ -152,11 +152,11 @@ $(PROJECT_INCLUDE)/rtems/posix/spinlock.h: include/rtems/posix/spinlock.h $(PROJ
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/posix/spinlock.h
PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/posix/spinlock.h
$(PROJECT_INCLUDE)/rtems/posix/spinlockimpl.h: include/rtems/posix/spinlockimpl.h $(PROJECT_INCLUDE)/rtems/posix/$(dirstamp)
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/posix/spinlockimpl.h
PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/posix/spinlockimpl.h
$(PROJECT_INCLUDE)/rtems/posix/key.inl: inline/rtems/posix/key.inl $(PROJECT_INCLUDE)/rtems/posix/$(dirstamp)
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/posix/key.inl
PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/posix/key.inl
$(PROJECT_INCLUDE)/rtems/posix/spinlock.inl: inline/rtems/posix/spinlock.inl $(PROJECT_INCLUDE)/rtems/posix/$(dirstamp)
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/posix/spinlock.inl
PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/posix/spinlock.inl
endif
+1 -1
View File
@@ -29,7 +29,7 @@
#include <rtems/system.h>
#include <rtems/config.h>
#include <rtems/posix/spinlock.h>
#include <rtems/posix/spinlockimpl.h>
/**
* @brief _POSIX_Spinlock_Manager_initialization
+1 -1
View File
@@ -22,7 +22,7 @@
#include <errno.h>
#include <rtems/system.h>
#include <rtems/posix/spinlock.h>
#include <rtems/posix/spinlockimpl.h>
/**
* This directive allows a thread to delete a spinlock specified by
+1 -1
View File
@@ -24,7 +24,7 @@
#include <errno.h>
#include <rtems/system.h>
#include <rtems/posix/spinlock.h>
#include <rtems/posix/spinlockimpl.h>
/*
* pthread_spinlock_init
+1 -1
View File
@@ -22,7 +22,7 @@
#include <errno.h>
#include <rtems/system.h>
#include <rtems/posix/spinlock.h>
#include <rtems/posix/spinlockimpl.h>
/**
* This directive allows a thread to wait at a spinlock.
@@ -23,7 +23,7 @@
#include <rtems/system.h>
#include <rtems/score/corespinlock.h>
#include <rtems/posix/spinlock.h>
#include <rtems/posix/spinlockimpl.h>
static int _POSIX_Spinlock_Return_codes[CORE_SPINLOCK_STATUS_LAST + 1] = {
0, /* CORE_SPINLOCK_SUCCESSFUL */
+1 -1
View File
@@ -22,7 +22,7 @@
#include <errno.h>
#include <rtems/system.h>
#include <rtems/posix/spinlock.h>
#include <rtems/posix/spinlockimpl.h>
/*
* pthread_spin_trylock
+1 -1
View File
@@ -24,7 +24,7 @@
#include <errno.h>
#include <rtems/system.h>
#include <rtems/posix/spinlock.h>
#include <rtems/posix/spinlockimpl.h>
/*
* pthread_spin_unlock
+1 -1
View File
@@ -41,7 +41,7 @@
#include <rtems/posix/rwlockimpl.h>
#include <rtems/posix/timerimpl.h>
#include <rtems/posix/semaphoreimpl.h>
#include <rtems/posix/spinlock.h>
#include <rtems/posix/spinlockimpl.h>
#include <rtems/posix/time.h>
Objects_Information *_POSIX_Objects[ OBJECTS_POSIX_CLASSES_LAST + 1 ];