[rtems commit] posix: Create rwlock implementation header
Sebastian Huber
sebh at rtems.org
Mon Jul 22 14:51:43 UTC 2013
Module: rtems
Branch: master
Commit: 0e8656b49eecdff64d639e765ef861cd974392e9
Changeset: http://git.rtems.org/rtems/commit/?id=0e8656b49eecdff64d639e765ef861cd974392e9
Author: Sebastian Huber <sebastian.huber at embedded-brains.de>
Date: Fri Jul 19 14:39:45 2013 +0200
posix: Create rwlock implementation header
Move implementation specific parts of rwlock.h and rwlock.inl into new
header file rwlockimpl.h. The rwlock.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/rwlock.h | 48 +----------------
.../rtems/posix/rwlockimpl.h} | 54 ++++++++++++++++++--
cpukit/posix/preinstall.am | 8 ++--
cpukit/posix/src/prwlock.c | 2 +-
cpukit/posix/src/prwlockdestroy.c | 2 +-
cpukit/posix/src/prwlockinit.c | 2 +-
cpukit/posix/src/prwlockrdlock.c | 2 +-
cpukit/posix/src/prwlocktimedrdlock.c | 2 +-
cpukit/posix/src/prwlocktimedwrlock.c | 2 +-
cpukit/posix/src/prwlocktranslatereturncode.c | 2 +-
cpukit/posix/src/prwlocktryrdlock.c | 2 +-
cpukit/posix/src/prwlocktrywrlock.c | 2 +-
cpukit/posix/src/prwlockunlock.c | 2 +-
cpukit/posix/src/prwlockwrlock.c | 2 +-
cpukit/sapi/src/posixapi.c | 2 +-
17 files changed, 70 insertions(+), 68 deletions(-)
diff --git a/cpukit/libcsupport/src/resource_snapshot.c b/cpukit/libcsupport/src/resource_snapshot.c
index d3f162f..6b875a8 100644
--- a/cpukit/libcsupport/src/resource_snapshot.c
+++ b/cpukit/libcsupport/src/resource_snapshot.c
@@ -37,7 +37,7 @@
#include <rtems/posix/key.h>
#include <rtems/posix/psignal.h>
#include <rtems/posix/pthreadimpl.h>
- #include <rtems/posix/rwlock.h>
+ #include <rtems/posix/rwlockimpl.h>
#include <rtems/posix/semaphoreimpl.h>
#include <rtems/posix/spinlock.h>
#include <rtems/posix/timer.h>
diff --git a/cpukit/posix/Makefile.am b/cpukit/posix/Makefile.am
index f378209..6e69fdd 100644
--- a/cpukit/posix/Makefile.am
+++ b/cpukit/posix/Makefile.am
@@ -49,11 +49,11 @@ include_rtems_posix_HEADERS += include/rtems/posix/timer.h
include_rtems_posix_HEADERS += include/rtems/posix/barrier.h
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 += inline/rtems/posix/key.inl
include_rtems_posix_HEADERS += inline/rtems/posix/timer.inl
-include_rtems_posix_HEADERS += inline/rtems/posix/rwlock.inl
include_rtems_posix_HEADERS += inline/rtems/posix/spinlock.inl
## src
diff --git a/cpukit/posix/include/rtems/posix/rwlock.h b/cpukit/posix/include/rtems/posix/rwlock.h
index 0cfd20d..31f75c2 100644
--- a/cpukit/posix/include/rtems/posix/rwlock.h
+++ b/cpukit/posix/include/rtems/posix/rwlock.h
@@ -25,6 +25,9 @@
#ifndef _RTEMS_POSIX_RWLOCK_H
#define _RTEMS_POSIX_RWLOCK_H
+#include <rtems/score/object.h>
+#include <rtems/score/corerwlock.h>
+
#ifdef __cplusplus
extern "C" {
#endif
@@ -39,9 +42,6 @@ extern "C" {
*/
/**@{**/
-#include <rtems/score/object.h>
-#include <rtems/score/corerwlock.h>
-
/**
* This type defines the control block used to manage each RWLock.
*/
@@ -53,48 +53,6 @@ typedef struct {
CORE_RWLock_Control RWLock;
} POSIX_RWLock_Control;
-/**
- * The following defines the information control block used to manage
- * this class of objects.
- */
-
-POSIX_EXTERN Objects_Information _POSIX_RWLock_Information;
-
-/**
- * @brief POSIX RWLock manager initialization.
- *
- * This routine performs the initialization necessary for this manager.
- */
-
-void _POSIX_RWLock_Manager_initialization(void);
-
-/**
- * @brief POSIX translate core RWLock return code.
- *
- * This routine translates SuperCore RWLock status codes into the
- * corresponding POSIX ones.
- *
- *
- * @param[in] the_RWLock_status is the SuperCore status.
- *
- * @return the corresponding POSIX status
- * @retval 0 The status indicates that the operation completed successfully.
- * @retval EINVAL The status indicates that the thread was blocked waiting for
- * an operation to complete and the RWLock was deleted.
- * @retval EBUSY This status indicates that the RWLock was not
- * immediately available.
- * @retval ETIMEDOUT This status indicates that the calling task was
- * willing to block but the operation was unable to complete within
- * the time allotted because the resource never became available.
- */
-int _POSIX_RWLock_Translate_core_RWLock_return_code(
- CORE_RWLock_Status the_RWLock_status
-);
-
-#ifndef __RTEMS_APPLICATION__
-#include <rtems/posix/rwlock.inl>
-#endif
-
/** @} */
#ifdef __cplusplus
diff --git a/cpukit/posix/inline/rtems/posix/rwlock.inl b/cpukit/posix/include/rtems/posix/rwlockimpl.h
similarity index 62%
rename from cpukit/posix/inline/rtems/posix/rwlock.inl
rename to cpukit/posix/include/rtems/posix/rwlockimpl.h
index ac641c9..5911a8f 100644
--- a/cpukit/posix/inline/rtems/posix/rwlock.inl
+++ b/cpukit/posix/include/rtems/posix/rwlockimpl.h
@@ -16,15 +16,55 @@
* http://www.rtems.com/license/LICENSE.
*/
-#ifndef _RTEMS_POSIX_RWLOCK_H
-# error "Never use <rtems/posix/rwlock.inl> directly; include <rtems/posix/rwlock.h> instead."
-#endif
+#ifndef _RTEMS_POSIX_RWLOCKIMPL_H
+#define _RTEMS_POSIX_RWLOCKIMPL_H
-#ifndef _RTEMS_POSIX_RWLOCK_INL
-#define _RTEMS_POSIX_RWLOCK_INL
+#include <rtems/posix/rwlock.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_RWLock_Information;
+
+/**
+ * @brief POSIX RWLock manager initialization.
+ *
+ * This routine performs the initialization necessary for this manager.
+ */
+
+void _POSIX_RWLock_Manager_initialization(void);
+
+/**
+ * @brief POSIX translate core RWLock return code.
+ *
+ * This routine translates SuperCore RWLock status codes into the
+ * corresponding POSIX ones.
+ *
+ *
+ * @param[in] the_RWLock_status is the SuperCore status.
+ *
+ * @return the corresponding POSIX status
+ * @retval 0 The status indicates that the operation completed successfully.
+ * @retval EINVAL The status indicates that the thread was blocked waiting for
+ * an operation to complete and the RWLock was deleted.
+ * @retval EBUSY This status indicates that the RWLock was not
+ * immediately available.
+ * @retval ETIMEDOUT This status indicates that the calling task was
+ * willing to block but the operation was unable to complete within
+ * the time allotted because the resource never became available.
+ */
+int _POSIX_RWLock_Translate_core_RWLock_return_code(
+ CORE_RWLock_Status the_RWLock_status
+);
+
/**
* @brief Allocate a RWLock control block.
*
@@ -92,5 +132,9 @@ RTEMS_INLINE_ROUTINE bool _POSIX_RWLock_Is_null (
return ( the_RWLock == NULL );
}
+#ifdef __cplusplus
+}
+#endif
+
#endif
/* end of include file */
diff --git a/cpukit/posix/preinstall.am b/cpukit/posix/preinstall.am
index 2cb9261..07e987a 100644
--- a/cpukit/posix/preinstall.am
+++ b/cpukit/posix/preinstall.am
@@ -140,6 +140,10 @@ $(PROJECT_INCLUDE)/rtems/posix/rwlock.h: include/rtems/posix/rwlock.h $(PROJECT_
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/posix/rwlock.h
PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/posix/rwlock.h
+$(PROJECT_INCLUDE)/rtems/posix/rwlockimpl.h: include/rtems/posix/rwlockimpl.h $(PROJECT_INCLUDE)/rtems/posix/$(dirstamp)
+ $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/posix/rwlockimpl.h
+PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/posix/rwlockimpl.h
+
$(PROJECT_INCLUDE)/rtems/posix/spinlock.h: include/rtems/posix/spinlock.h $(PROJECT_INCLUDE)/rtems/posix/$(dirstamp)
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/posix/spinlock.h
PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/posix/spinlock.h
@@ -152,10 +156,6 @@ $(PROJECT_INCLUDE)/rtems/posix/timer.inl: inline/rtems/posix/timer.inl $(PROJECT
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/posix/timer.inl
PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/posix/timer.inl
-$(PROJECT_INCLUDE)/rtems/posix/rwlock.inl: inline/rtems/posix/rwlock.inl $(PROJECT_INCLUDE)/rtems/posix/$(dirstamp)
- $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/posix/rwlock.inl
-PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/posix/rwlock.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
diff --git a/cpukit/posix/src/prwlock.c b/cpukit/posix/src/prwlock.c
index 1e803cb..c27ca94 100644
--- a/cpukit/posix/src/prwlock.c
+++ b/cpukit/posix/src/prwlock.c
@@ -17,7 +17,7 @@
#include <rtems/system.h>
#include <rtems/config.h>
-#include <rtems/posix/rwlock.h>
+#include <rtems/posix/rwlockimpl.h>
/**
* @brief _POSIX_RWLock_Manager_initialization
diff --git a/cpukit/posix/src/prwlockdestroy.c b/cpukit/posix/src/prwlockdestroy.c
index 329a297..a55e985 100644
--- a/cpukit/posix/src/prwlockdestroy.c
+++ b/cpukit/posix/src/prwlockdestroy.c
@@ -21,7 +21,7 @@
#include <errno.h>
#include <rtems/system.h>
-#include <rtems/posix/rwlock.h>
+#include <rtems/posix/rwlockimpl.h>
/**
* This directive allows a thread to delete a rwlock specified by
diff --git a/cpukit/posix/src/prwlockinit.c b/cpukit/posix/src/prwlockinit.c
index 0ee53e8..a438e5f 100644
--- a/cpukit/posix/src/prwlockinit.c
+++ b/cpukit/posix/src/prwlockinit.c
@@ -24,7 +24,7 @@
#include <errno.h>
#include <rtems/system.h>
-#include <rtems/posix/rwlock.h>
+#include <rtems/posix/rwlockimpl.h>
/*
* pthread_rwlock_init
diff --git a/cpukit/posix/src/prwlockrdlock.c b/cpukit/posix/src/prwlockrdlock.c
index 621a7f8..3d4d76f 100644
--- a/cpukit/posix/src/prwlockrdlock.c
+++ b/cpukit/posix/src/prwlockrdlock.c
@@ -22,7 +22,7 @@
#include <errno.h>
#include <rtems/system.h>
-#include <rtems/posix/rwlock.h>
+#include <rtems/posix/rwlockimpl.h>
/**
* This directive attempts to obtain a read only lock on an rwlock instance.
diff --git a/cpukit/posix/src/prwlocktimedrdlock.c b/cpukit/posix/src/prwlocktimedrdlock.c
index 732ba2a..29e1c1b 100644
--- a/cpukit/posix/src/prwlocktimedrdlock.c
+++ b/cpukit/posix/src/prwlocktimedrdlock.c
@@ -22,7 +22,7 @@
#include <errno.h>
#include <rtems/system.h>
-#include <rtems/posix/rwlock.h>
+#include <rtems/posix/rwlockimpl.h>
#include <rtems/posix/time.h>
/*
diff --git a/cpukit/posix/src/prwlocktimedwrlock.c b/cpukit/posix/src/prwlocktimedwrlock.c
index bd6232a..7a4d760 100644
--- a/cpukit/posix/src/prwlocktimedwrlock.c
+++ b/cpukit/posix/src/prwlocktimedwrlock.c
@@ -24,7 +24,7 @@
#include <errno.h>
#include <rtems/system.h>
-#include <rtems/posix/rwlock.h>
+#include <rtems/posix/rwlockimpl.h>
#include <rtems/posix/time.h>
/*
diff --git a/cpukit/posix/src/prwlocktranslatereturncode.c b/cpukit/posix/src/prwlocktranslatereturncode.c
index 48be176..72baee3 100644
--- a/cpukit/posix/src/prwlocktranslatereturncode.c
+++ b/cpukit/posix/src/prwlocktranslatereturncode.c
@@ -22,7 +22,7 @@
#include <errno.h>
#include <rtems/system.h>
-#include <rtems/posix/rwlock.h>
+#include <rtems/posix/rwlockimpl.h>
static int _POSIX_RWLock_Return_codes[CORE_RWLOCK_STATUS_LAST + 1] = {
0, /* CORE_RWLOCK_SUCCESSFUL */
diff --git a/cpukit/posix/src/prwlocktryrdlock.c b/cpukit/posix/src/prwlocktryrdlock.c
index c6e2875..c4cfd76 100644
--- a/cpukit/posix/src/prwlocktryrdlock.c
+++ b/cpukit/posix/src/prwlocktryrdlock.c
@@ -22,7 +22,7 @@
#include <errno.h>
#include <rtems/system.h>
-#include <rtems/posix/rwlock.h>
+#include <rtems/posix/rwlockimpl.h>
/*
* pthread_rwlock_tryrdlock
diff --git a/cpukit/posix/src/prwlocktrywrlock.c b/cpukit/posix/src/prwlocktrywrlock.c
index 26eb3e1..23259db 100644
--- a/cpukit/posix/src/prwlocktrywrlock.c
+++ b/cpukit/posix/src/prwlocktrywrlock.c
@@ -22,7 +22,7 @@
#include <errno.h>
#include <rtems/system.h>
-#include <rtems/posix/rwlock.h>
+#include <rtems/posix/rwlockimpl.h>
/*
* pthread_rwlock_trywrlock
diff --git a/cpukit/posix/src/prwlockunlock.c b/cpukit/posix/src/prwlockunlock.c
index 67fca02..13fc6dc 100644
--- a/cpukit/posix/src/prwlockunlock.c
+++ b/cpukit/posix/src/prwlockunlock.c
@@ -24,7 +24,7 @@
#include <errno.h>
#include <rtems/system.h>
-#include <rtems/posix/rwlock.h>
+#include <rtems/posix/rwlockimpl.h>
/*
* pthread_rwlock_unlock
diff --git a/cpukit/posix/src/prwlockwrlock.c b/cpukit/posix/src/prwlockwrlock.c
index 8643be1..b53a7e0 100644
--- a/cpukit/posix/src/prwlockwrlock.c
+++ b/cpukit/posix/src/prwlockwrlock.c
@@ -24,7 +24,7 @@
#include <errno.h>
#include <rtems/system.h>
-#include <rtems/posix/rwlock.h>
+#include <rtems/posix/rwlockimpl.h>
/*
* pthread_rwlock_wrlock
diff --git a/cpukit/sapi/src/posixapi.c b/cpukit/sapi/src/posixapi.c
index ba003b6..b460406 100644
--- a/cpukit/sapi/src/posixapi.c
+++ b/cpukit/sapi/src/posixapi.c
@@ -38,7 +38,7 @@
#include <rtems/posix/priorityimpl.h>
#include <rtems/posix/psignalimpl.h>
#include <rtems/posix/pthreadimpl.h>
-#include <rtems/posix/rwlock.h>
+#include <rtems/posix/rwlockimpl.h>
#include <rtems/posix/timer.h>
#include <rtems/posix/semaphoreimpl.h>
#include <rtems/posix/spinlock.h>
More information about the vc
mailing list