summaryrefslogtreecommitdiffstats
path: root/cpukit
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2012-04-26 14:28:52 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2012-05-04 10:53:51 +0200
commit5a4bb758c0017374352ccf065fb1aac4ebb3e27d (patch)
tree5b69f58aac905d40a70923eaab5b0fa43cfa57bb /cpukit
parentRemove CVS-Ids. (diff)
downloadrtems-5a4bb758c0017374352ccf065fb1aac4ebb3e27d.tar.bz2
Filesystem: Remove per file descriptor semaphore
The per file descriptor semaphore (field of rtems_libio_t) is unused in RTEMS. There is a considerable memory overhead due to that. A semaphore needs roughly 124 bytes which is huge compared to the approximately 72 bytes for the file descriptor structure itself. Device drivers can create their own synchronization primitives in the open handler on demand.
Diffstat (limited to 'cpukit')
-rw-r--r--cpukit/libcsupport/include/rtems/libio.h1
-rw-r--r--cpukit/libcsupport/src/libio.c28
-rw-r--r--cpukit/sapi/include/confdefs.h6
3 files changed, 6 insertions, 29 deletions
diff --git a/cpukit/libcsupport/include/rtems/libio.h b/cpukit/libcsupport/include/rtems/libio.h
index f1908f7da2..04ca52c4aa 100644
--- a/cpukit/libcsupport/include/rtems/libio.h
+++ b/cpukit/libcsupport/include/rtems/libio.h
@@ -1165,7 +1165,6 @@ struct rtems_libio_tt {
off_t offset; /* current offset into file */
uint32_t flags;
rtems_filesystem_location_info_t pathinfo;
- rtems_id sem;
uint32_t data0; /* private to "driver" */
void *data1; /* ... */
};
diff --git a/cpukit/libcsupport/src/libio.c b/cpukit/libcsupport/src/libio.c
index 985ad8bad9..e75b66bfaf 100644
--- a/cpukit/libcsupport/src/libio.c
+++ b/cpukit/libcsupport/src/libio.c
@@ -131,36 +131,19 @@ int rtems_libio_to_fcntl_flags( uint32_t flags )
rtems_libio_t *rtems_libio_allocate( void )
{
- rtems_libio_t *iop, *next;
- rtems_status_code rc;
- rtems_id sema;
+ rtems_libio_t *iop = NULL;
rtems_libio_lock();
if (rtems_libio_iop_freelist) {
- rc = rtems_semaphore_create(
- RTEMS_LIBIO_IOP_SEM(rtems_libio_iop_freelist - rtems_libio_iops),
- 1,
- RTEMS_BINARY_SEMAPHORE | RTEMS_INHERIT_PRIORITY | RTEMS_PRIORITY,
- 0,
- &sema
- );
- if (rc != RTEMS_SUCCESSFUL)
- goto failed;
iop = rtems_libio_iop_freelist;
- next = iop->data1;
- (void) memset( iop, 0, sizeof(rtems_libio_t) );
+ rtems_libio_iop_freelist = iop->data1;
+ memset( iop, 0, sizeof(*iop) );
iop->flags = LIBIO_FLAGS_OPEN;
- iop->sem = sema;
- rtems_libio_iop_freelist = next;
- goto done;
}
-failed:
- iop = 0;
-
-done:
rtems_libio_unlock();
+
return iop;
}
@@ -179,9 +162,6 @@ void rtems_libio_free(
rtems_libio_lock();
- if (iop->sem)
- rtems_semaphore_delete(iop->sem);
-
iop->flags &= ~LIBIO_FLAGS_OPEN;
iop->data1 = rtems_libio_iop_freelist;
rtems_libio_iop_freelist = iop;
diff --git a/cpukit/sapi/include/confdefs.h b/cpukit/sapi/include/confdefs.h
index d896c59e82..3e4cb90940 100644
--- a/cpukit/sapi/include/confdefs.h
+++ b/cpukit/sapi/include/confdefs.h
@@ -119,11 +119,9 @@ rtems_fs_init_functions_t rtems_fs_init_helper =
#endif
/**
- * From the number of file descriptors, we can determine how many
- * semaphores the implementation will require.
+ * Semaphore count used by the IO library.
*/
-#define CONFIGURE_LIBIO_SEMAPHORES \
- (CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS + 1)
+#define CONFIGURE_LIBIO_SEMAPHORES 1
#ifdef CONFIGURE_INIT
/**