source: rtems/c/src/libfs/src/imfs/ioman.c @ af73d86f

4.104.114.84.95
Last change on this file since af73d86f was 07a3253d, checked in by Joel Sherrill <joel.sherrill@…>, on 11/23/98 at 19:07:58

Added base version of file system infrastructure. This includes a major
overhaul of the RTEMS system call interface. This base file system is
the "In-Memory File System" aka IMFS.

The design and implementation was done by the following people:

+ Joel Sherrill (joel@…)
+ Jennifer Averett (jennifer@…)
+ Steve "Mr Mount" Salitasc (salitasc@…)
+ Kerwin Wade (wade@…)

PROBLEMS
========

+ It is VERY likely that merging this will break the UNIX port. This

can/will be fixed.

+ There is likely some reentrancy/mutual exclusion needed.

+ Eventually, there should be a "mini-IMFS" description table to

eliminate links, symlinks, etc to save memory. All you need to
have "classic RTEMS" functionality is technically directories
and device IO. All the rest could be left out to save memory.

  • Property mode set to 100644
File size: 2.0 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-1998.
6 *  On-Line Applications Research Corporation (OAR).
7 *  Copyright assigned to U.S. Government, 1994.
8 *
9 *  The license and distribution terms for this file may be
10 *  found in the file LICENSE in this distribution or at
11 *  http://www.OARcorp.com/rtems/license.html.
12 *
13 *  $Id$
14 */
15
16#include <sys/types.h>
17#include <sys/stat.h>
18#include <fcntl.h>
19#include <unistd.h>
20
21#include <assert.h>
22
23#include <rtems.h>
24#include "libio_.h"
25#include "imfs.h"
26
27/*
28 *  rtems_io_register_name
29 *
30 *  This assumes that all registered devices are character devices.
31 */
32
33rtems_status_code rtems_io_register_name(
34  char *device_name,
35  rtems_device_major_number major,
36  rtems_device_minor_number minor
37)
38{
39  int    status;
40  dev_t  dev;
41
42  dev = rtems_filesystem_make_dev_t( major, minor );
43  status = mknod( device_name, 0777 | S_IFCHR, dev );
44
45  /* this is the only error returned by the old version */
46  if ( status )
47    return RTEMS_TOO_MANY;
48 
49  return RTEMS_SUCCESSFUL;
50}
51
52/*
53 *  rtems_io_lookup_name
54 *
55 *  This version is not reentrant.
56 */
57
58rtems_status_code rtems_io_lookup_name(
59  const char           *name,
60  rtems_driver_name_t **device_info
61)
62{
63  IMFS_jnode_t                      *the_jnode;
64  rtems_filesystem_location_info_t   temp_loc;
65  static rtems_driver_name_t         device;
66  int                                result;
67
68  result = rtems_filesystem_evaluate_path( name, 0x00, &temp_loc, TRUE );
69  the_jnode = temp_loc.node_access;
70
71  if ( (result != 0) || the_jnode->type != IMFS_DEVICE ) {
72    *device_info = 0;
73    return RTEMS_UNSATISFIED;
74  }
75
76  device.device_name        = (char *) name;
77  device.device_name_length = strlen( name );
78  device.major              = the_jnode->info.device.major;
79  device.minor              = the_jnode->info.device.minor;
80  *device_info              = &device;
81  return RTEMS_SUCCESSFUL;
82
83}
Note: See TracBrowser for help on using the repository browser.