source: rtems/cpukit/libfs/src/rfs/rtems-rfs-mutex.c @ 1ddad65

4.115
Last change on this file since 1ddad65 was 66b8047, checked in by Ralf Corsepius <ralf.corsepius@…>, on 11/06/11 at 12:44:24

Remove stray whitespaces.

  • Property mode set to 100644
File size: 1.7 KB
Line 
1/*
2 *  COPYRIGHT (c) 2010 Chris Johns <chrisj@rtems.org>
3 *
4 *  The license and distribution terms for this file may be
5 *  found in the file LICENSE in this distribution or at
6 *  http://www.rtems.com/license/LICENSE.
7 *
8 *  $Id$
9 */
10/**
11 * @file
12 *
13 * @ingroup rtems-rfs
14 *
15 * RTEMS File System Mutex.
16 */
17
18#if HAVE_CONFIG_H
19#include "config.h"
20#endif
21
22#include <rtems/rfs/rtems-rfs-mutex.h>
23
24#if __rtems__
25/**
26 * RTEMS_RFS Mutex Attributes
27 *
28 * @warning Do not configure as inherit priority. If a driver is in the driver
29 *          initialisation table this locked semaphore will have the IDLE task
30 *          as the holder and a blocking task will raise the priority of the
31 *          IDLE task which can cause unsual side effects like not work.
32 */
33#define RTEMS_RFS_MUTEX_ATTRIBS \
34  (RTEMS_PRIORITY | RTEMS_SIMPLE_BINARY_SEMAPHORE | \
35   RTEMS_NO_INHERIT_PRIORITY | RTEMS_NO_PRIORITY_CEILING | RTEMS_LOCAL)
36#endif
37
38int
39rtems_rfs_mutex_create (rtems_rfs_mutex* mutex)
40{
41#if __rtems__
42  rtems_status_code sc;
43  sc = rtems_semaphore_create (rtems_build_name ('R', 'F', 'S', 'm'),
44                               1, RTEMS_RFS_MUTEX_ATTRIBS, 0,
45                               mutex);
46  if (sc != RTEMS_SUCCESSFUL)
47  {
48    if (rtems_rfs_trace (RTEMS_RFS_TRACE_MUTEX))
49      printf ("rtems-rfs: mutex: open failed: %s\n",
50              rtems_status_text (sc));
51    return EIO;
52  }
53#endif
54  return 0;
55}
56
57int
58rtems_rfs_mutex_destroy (rtems_rfs_mutex* mutex)
59{
60#if __rtems__
61  rtems_status_code sc;
62  sc = rtems_semaphore_delete (*mutex);
63  if (sc != RTEMS_SUCCESSFUL)
64  {
65    if (rtems_rfs_trace (RTEMS_RFS_TRACE_MUTEX))
66      printf ("rtems-rfs: mutex: close failed: %s\n",
67              rtems_status_text (sc));
68    return EIO;
69  }
70#endif
71  return 0;
72}
Note: See TracBrowser for help on using the repository browser.