[rtems commit] posix: Create spinlock implementation header

Sebastian Huber sebh at rtems.org
Mon Jul 22 14:51:44 UTC 2013


Module:    rtems
Branch:    master
Commit:    eb448eece9305b2bba641471a428af4dad97effc
Changeset: http://git.rtems.org/rtems/commit/?id=eb448eece9305b2bba641471a428af4dad97effc

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Fri Jul 19 15:18:08 2013 +0200

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.

---

 cpukit/libcsupport/src/resource_snapshot.c         |    2 +-
 cpukit/posix/Makefile.am                           |    2 +-
 cpukit/posix/include/rtems/posix/spinlock.h        |   39 +----------------
 .../rtems/posix/spinlockimpl.h}                    |   45 +++++++++++++++++--
 cpukit/posix/preinstall.am                         |    8 ++--
 cpukit/posix/src/pspin.c                           |    2 +-
 cpukit/posix/src/pspindestroy.c                    |    2 +-
 cpukit/posix/src/pspininit.c                       |    2 +-
 cpukit/posix/src/pspinlock.c                       |    2 +-
 cpukit/posix/src/pspinlocktranslatereturncode.c    |    2 +-
 cpukit/posix/src/pspintrylock.c                    |    2 +-
 cpukit/posix/src/pspinunlock.c                     |    2 +-
 cpukit/sapi/src/posixapi.c                         |    2 +-
 13 files changed, 57 insertions(+), 55 deletions(-)

diff --git a/cpukit/libcsupport/src/resource_snapshot.c b/cpukit/libcsupport/src/resource_snapshot.c
index 48bbdc8..3318d38 100644
--- a/cpukit/libcsupport/src/resource_snapshot.c
+++ b/cpukit/libcsupport/src/resource_snapshot.c
@@ -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
 
diff --git a/cpukit/posix/Makefile.am b/cpukit/posix/Makefile.am
index 9bea73b..e7ec45f 100644
--- a/cpukit/posix/Makefile.am
+++ b/cpukit/posix/Makefile.am
@@ -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 \
diff --git a/cpukit/posix/include/rtems/posix/spinlock.h b/cpukit/posix/include/rtems/posix/spinlock.h
index 34b04eb..c27a8c1 100644
--- a/cpukit/posix/include/rtems/posix/spinlock.h
+++ b/cpukit/posix/include/rtems/posix/spinlock.h
@@ -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
diff --git a/cpukit/posix/inline/rtems/posix/spinlock.inl b/cpukit/posix/include/rtems/posix/spinlockimpl.h
similarity index 73%
rename from cpukit/posix/inline/rtems/posix/spinlock.inl
rename to cpukit/posix/include/rtems/posix/spinlockimpl.h
index b8ababd..5853d45 100644
--- a/cpukit/posix/inline/rtems/posix/spinlock.inl
+++ b/cpukit/posix/include/rtems/posix/spinlockimpl.h
@@ -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 */
diff --git a/cpukit/posix/preinstall.am b/cpukit/posix/preinstall.am
index 7cb8ee8..3ae3896 100644
--- a/cpukit/posix/preinstall.am
+++ b/cpukit/posix/preinstall.am
@@ -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
diff --git a/cpukit/posix/src/pspin.c b/cpukit/posix/src/pspin.c
index 27a8973..a31cb5d 100644
--- a/cpukit/posix/src/pspin.c
+++ b/cpukit/posix/src/pspin.c
@@ -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
diff --git a/cpukit/posix/src/pspindestroy.c b/cpukit/posix/src/pspindestroy.c
index f724354..4b84850 100644
--- a/cpukit/posix/src/pspindestroy.c
+++ b/cpukit/posix/src/pspindestroy.c
@@ -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
diff --git a/cpukit/posix/src/pspininit.c b/cpukit/posix/src/pspininit.c
index 164cb50..fc65177 100644
--- a/cpukit/posix/src/pspininit.c
+++ b/cpukit/posix/src/pspininit.c
@@ -24,7 +24,7 @@
 #include <errno.h>
 
 #include <rtems/system.h>
-#include <rtems/posix/spinlock.h>
+#include <rtems/posix/spinlockimpl.h>
 
 /*
  *  pthread_spinlock_init
diff --git a/cpukit/posix/src/pspinlock.c b/cpukit/posix/src/pspinlock.c
index 2f4bfff..a48750f 100644
--- a/cpukit/posix/src/pspinlock.c
+++ b/cpukit/posix/src/pspinlock.c
@@ -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.
diff --git a/cpukit/posix/src/pspinlocktranslatereturncode.c b/cpukit/posix/src/pspinlocktranslatereturncode.c
index ce133a4..a77284a 100644
--- a/cpukit/posix/src/pspinlocktranslatereturncode.c
+++ b/cpukit/posix/src/pspinlocktranslatereturncode.c
@@ -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 */
diff --git a/cpukit/posix/src/pspintrylock.c b/cpukit/posix/src/pspintrylock.c
index 7f7c6c1..0aa3aab 100644
--- a/cpukit/posix/src/pspintrylock.c
+++ b/cpukit/posix/src/pspintrylock.c
@@ -22,7 +22,7 @@
 #include <errno.h>
 
 #include <rtems/system.h>
-#include <rtems/posix/spinlock.h>
+#include <rtems/posix/spinlockimpl.h>
 
 /*
  *  pthread_spin_trylock
diff --git a/cpukit/posix/src/pspinunlock.c b/cpukit/posix/src/pspinunlock.c
index dc43d1d..7e4e830 100644
--- a/cpukit/posix/src/pspinunlock.c
+++ b/cpukit/posix/src/pspinunlock.c
@@ -24,7 +24,7 @@
 #include <errno.h>
 
 #include <rtems/system.h>
-#include <rtems/posix/spinlock.h>
+#include <rtems/posix/spinlockimpl.h>
 
 /*
  *  pthread_spin_unlock
diff --git a/cpukit/sapi/src/posixapi.c b/cpukit/sapi/src/posixapi.c
index 6cdffa7..7563e82 100644
--- a/cpukit/sapi/src/posixapi.c
+++ b/cpukit/sapi/src/posixapi.c
@@ -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 ];




More information about the vc mailing list