diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2012-04-26 14:28:52 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2012-05-04 10:53:51 +0200 |
commit | 5a4bb758c0017374352ccf065fb1aac4ebb3e27d (patch) | |
tree | 5b69f58aac905d40a70923eaab5b0fa43cfa57bb /cpukit/libcsupport/src/libio.c | |
parent | Remove CVS-Ids. (diff) | |
download | rtems-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 '')
-rw-r--r-- | cpukit/libcsupport/src/libio.c | 28 |
1 files changed, 4 insertions, 24 deletions
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; |