Changeset 0940648f in rtems


Ignore:
Timestamp:
Dec 13, 2017, 3:23:34 PM (3 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
5, master
Children:
8ddd92d
Parents:
3b77417
git-author:
Sebastian Huber <sebastian.huber@…> (12/13/17 15:23:34)
git-committer:
Sebastian Huber <sebastian.huber@…> (02/02/18 14:01:22)
Message:

RFS: Use self-contained recursive mutex

Update #2843.

Location:
cpukit
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • cpukit/include/rtems/confdefs.h

    r3b77417 r0940648f  
    428428    defined(CONFIGURE_FILESYSTEM_RFS)
    429429  #include <rtems/rtems-rfs.h>
    430   #if !defined(CONFIGURE_MAXIMUM_RFS_MOUNTS)
    431     #define CONFIGURE_MAXIMUM_RFS_MOUNTS 1
    432   #endif
    433430  #define CONFIGURE_FILESYSTEM_ENTRY_RFS \
    434431    { RTEMS_FILESYSTEM_TYPE_RFS, rtems_rfs_rtems_initialise }
    435   #define _CONFIGURE_SEMAPHORES_FOR_RFS CONFIGURE_MAXIMUM_RFS_MOUNTS
    436 #else
    437   #define _CONFIGURE_SEMAPHORES_FOR_RFS 0
    438432#endif
    439433
     
    454448#define _CONFIGURE_SEMAPHORES_FOR_FILE_SYSTEMS \
    455449    (_CONFIGURE_SEMAPHORES_FOR_FIFOS + \
    456      _CONFIGURE_SEMAPHORES_FOR_NFS + \
    457      _CONFIGURE_SEMAPHORES_FOR_RFS)
     450     _CONFIGURE_SEMAPHORES_FOR_NFS)
    458451
    459452#ifdef CONFIGURE_INIT
  • cpukit/include/rtems/rfs/rtems-rfs-mutex.h

    r3b77417 r0940648f  
    3030#include <rtems.h>
    3131#include <rtems/error.h>
     32#include <rtems/thread.h>
    3233#endif
    3334
     
    3637 */
    3738#if __rtems__
    38 typedef rtems_id rtems_rfs_mutex;
     39typedef rtems_recursive_mutex rtems_rfs_mutex;
    3940#else
    4041typedef uint32_t rtems_rfs_mutex; /* place holder */
     
    7475{
    7576#if __rtems__
    76   rtems_status_code sc = rtems_semaphore_obtain (*mutex, RTEMS_WAIT, 0);
    77   if (sc != RTEMS_SUCCESSFUL)
    78   {
    79 #if RTEMS_RFS_TRACE
    80     if (rtems_rfs_trace (RTEMS_RFS_TRACE_MUTEX))
    81       printf ("rtems-rfs: mutex: obtain failed: %s\n",
    82               rtems_status_text (sc));
    83 #endif
    84     return EIO;
    85   }
     77  rtems_recursive_mutex_lock(mutex);
    8678#endif
    8779  return 0;
     
    10092{
    10193#if __rtems__
    102   rtems_status_code sc = rtems_semaphore_release (*mutex);
    103   if (sc != RTEMS_SUCCESSFUL)
    104   {
    105 #if RTEMS_RFS_TRACE
    106     if (rtems_rfs_trace (RTEMS_RFS_TRACE_MUTEX))
    107       printf ("rtems-rfs: mutex: release failed: %s\n",
    108               rtems_status_text (sc));
    109 #endif
    110     return EIO;
    111   }
     94  rtems_recursive_mutex_unlock(mutex);
    11295#endif
    11396  return 0;
  • cpukit/libfs/src/rfs/rtems-rfs-mutex.c

    r3b77417 r0940648f  
    1919#include <rtems/rfs/rtems-rfs-mutex.h>
    2020
    21 #if __rtems__
    22 /**
    23  * RTEMS_RFS Mutex Attributes
    24  */
    25 #define RTEMS_RFS_MUTEX_ATTRIBS \
    26   (RTEMS_PRIORITY | RTEMS_BINARY_SEMAPHORE | \
    27    RTEMS_INHERIT_PRIORITY | RTEMS_NO_PRIORITY_CEILING | RTEMS_LOCAL)
    28 #endif
    29 
    3021int
    3122rtems_rfs_mutex_create (rtems_rfs_mutex* mutex)
    3223{
    3324#if __rtems__
    34   rtems_status_code sc;
    35   sc = rtems_semaphore_create (rtems_build_name ('R', 'F', 'S', 'm'),
    36                                1, RTEMS_RFS_MUTEX_ATTRIBS, 0,
    37                                mutex);
    38   if (sc != RTEMS_SUCCESSFUL)
    39   {
    40     if (rtems_rfs_trace (RTEMS_RFS_TRACE_MUTEX))
    41       printf ("rtems-rfs: mutex: open failed: %s\n",
    42               rtems_status_text (sc));
    43     return EIO;
    44   }
     25  rtems_recursive_mutex_init(mutex, "RFS");
    4526#endif
    4627  return 0;
     
    5132{
    5233#if __rtems__
    53   rtems_status_code sc;
    54   sc = rtems_semaphore_delete (*mutex);
    55   if (sc != RTEMS_SUCCESSFUL)
    56   {
    57     if (rtems_rfs_trace (RTEMS_RFS_TRACE_MUTEX))
    58       printf ("rtems-rfs: mutex: close failed: %s\n",
    59               rtems_status_text (sc));
    60     return EIO;
    61   }
     34  rtems_recursive_mutex_destroy(mutex);
    6235#endif
    6336  return 0;
Note: See TracChangeset for help on using the changeset viewer.