source: rtems/cpukit/libfs/src/imfs/deviceerrno.c @ 9b4422a2

4.11
Last change on this file since 9b4422a2 was 9b4422a2, checked in by Joel Sherrill <joel.sherrill@…>, on May 3, 2012 at 3:09:24 PM

Remove All CVS Id Strings Possible Using a Script

Script does what is expected and tries to do it as
smartly as possible.

+ remove occurrences of two blank comment lines

next to each other after Id string line removed.

+ remove entire comment blocks which only exited to

contain CVS Ids

+ If the processing left a blank line at the top of

a file, it was removed.

  • Property mode set to 100644
File size: 2.1 KB
Line 
1/*
2 *  IMFS Device Node Handlers
3 *
4 *  This file contains the set of handlers used to map operations on
5 *  IMFS device nodes onto calls to the RTEMS Classic API IO Manager.
6 *
7 *  COPYRIGHT (c) 1989-2008.
8 *  On-Line Applications Research Corporation (OAR).
9 *
10 *  The license and distribution terms for this file may be
11 *  found in the file LICENSE in this distribution or at
12 *  http://www.rtems.com/license/LICENSE.
13 */
14
15#if HAVE_CONFIG_H
16#include "config.h"
17#endif
18
19#include <errno.h>
20
21#include <rtems.h>
22#include <rtems/libio.h>
23#include <rtems/devfs.h>
24
25static const int status_code_to_errno [RTEMS_STATUS_CODES_LAST + 1] = {
26  [RTEMS_SUCCESSFUL]               = 0,
27  [RTEMS_TASK_EXITTED]             = EIO,
28  [RTEMS_MP_NOT_CONFIGURED]        = EIO,
29  [RTEMS_INVALID_NAME]             = EINVAL,
30  [RTEMS_INVALID_ID]               = EIO,
31  [RTEMS_TOO_MANY]                 = EIO,
32  [RTEMS_TIMEOUT]                  = ETIMEDOUT,
33  [RTEMS_OBJECT_WAS_DELETED]       = EIO,
34  [RTEMS_INVALID_SIZE]             = EIO,
35  [RTEMS_INVALID_ADDRESS]          = EIO,
36  [RTEMS_INVALID_NUMBER]           = EBADF,
37  [RTEMS_NOT_DEFINED]              = EIO,
38  [RTEMS_RESOURCE_IN_USE]          = EBUSY,
39  [RTEMS_UNSATISFIED]              = ENODEV,
40  [RTEMS_INCORRECT_STATE]          = EIO,
41  [RTEMS_ALREADY_SUSPENDED]        = EIO,
42  [RTEMS_ILLEGAL_ON_SELF]          = EIO,
43  [RTEMS_ILLEGAL_ON_REMOTE_OBJECT] = EIO,
44  [RTEMS_CALLED_FROM_ISR]          = EIO,
45  [RTEMS_INVALID_PRIORITY]         = EIO,
46  [RTEMS_INVALID_CLOCK]            = EINVAL,
47  [RTEMS_INVALID_NODE]             = EINVAL,
48  [RTEMS_NOT_CONFIGURED]           = ENOSYS,
49  [RTEMS_NOT_OWNER_OF_RESOURCE]    = EPERM,
50  [RTEMS_NOT_IMPLEMENTED]          = ENOSYS,
51  [RTEMS_INTERNAL_ERROR]           = EIO,
52  [RTEMS_NO_MEMORY]                = ENOMEM,
53  [RTEMS_IO_ERROR]                 = EIO,
54  [RTEMS_PROXY_BLOCKING]           = EIO
55};
56
57int rtems_deviceio_errno(rtems_status_code sc)
58{
59  if (sc == RTEMS_SUCCESSFUL) {
60    return 0;
61  } else {
62    int eno = EINVAL;
63
64    if ((unsigned) sc <= RTEMS_STATUS_CODES_LAST) {
65      eno = status_code_to_errno [sc];
66    }
67
68    errno = eno;
69
70    return -1;
71  }
72}
Note: See TracBrowser for help on using the repository browser.