source: rtems/cpukit/libfs/src/imfs/ioman.c @ c17d0b3

4.115
Last change on this file since c17d0b3 was 9b4422a2, checked in by Joel Sherrill <joel.sherrill@…>, on 05/03/12 at 15:09:24

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: 1.7 KB
Line 
1/*
2 *  This file emulates the old Classic RTEMS IO manager directives
3 *  which register and lookup names using the in-memory filesystem.
4 *
5 *  COPYRIGHT (c) 1989-1999.
6 *  On-Line Applications Research Corporation (OAR).
7 *
8 *  Modifications to support reference counting in the file system are
9 *  Copyright (c) 2012 embedded brains GmbH.
10 *
11 *  The license and distribution terms for this file may be
12 *  found in the file LICENSE in this distribution or at
13 *  http://www.rtems.com/license/LICENSE.
14 */
15
16#if HAVE_CONFIG_H
17  #include "config.h"
18#endif
19
20#include <sys/stat.h>
21#include <string.h>
22
23#include <rtems/libio_.h>
24
25/*
26 *  rtems_io_register_name
27 *
28 *  This assumes that all registered devices are character devices.
29 */
30
31rtems_status_code rtems_io_register_name(
32  const char                *device_name,
33  rtems_device_major_number  major,
34  rtems_device_minor_number  minor
35)
36{
37  int    status;
38  dev_t  dev;
39
40  dev = rtems_filesystem_make_dev_t( major, minor );
41  status = mknod( device_name, 0777 | S_IFCHR, dev );
42
43  /* this is the only error returned by the old version */
44  if ( status )
45    return RTEMS_TOO_MANY;
46
47  return RTEMS_SUCCESSFUL;
48}
49
50rtems_status_code rtems_io_lookup_name(
51  const char           *name,
52  rtems_driver_name_t  *device_info
53)
54{
55  rtems_status_code sc = RTEMS_SUCCESSFUL;
56  struct stat st;
57  int rv = stat( name, &st );
58
59  if ( rv == 0 && S_ISCHR( st.st_mode ) ) {
60    device_info->device_name = name;
61    device_info->device_name_length = strlen( name );
62    device_info->major = rtems_filesystem_dev_major_t( st.st_rdev );
63    device_info->minor = rtems_filesystem_dev_minor_t( st.st_rdev );
64  } else {
65    sc = RTEMS_UNSATISFIED;
66  }
67
68  return sc;
69}
Note: See TracBrowser for help on using the repository browser.