source: rtems/cpukit/libfs/src/devfs/devfs_eval.c @ d40da79b

4.104.115
Last change on this file since d40da79b was d40da79b, checked in by Joel Sherrill <joel.sherrill@…>, on 09/17/08 at 16:12:04

2008-09-17 Miao Yan <yanmiaobest@…>

  • Makefile.am, preinstall.am, libcsupport/Makefile.am, libcsupport/include/rtems/libcsupport.h, libcsupport/include/rtems/libio.h, libcsupport/src/base_fs.c, libcsupport/src/libio_init.c, libcsupport/src/newlibc_exit.c, libcsupport/src/newlibc_init.c, libcsupport/src/sync.c, libfs/Makefile.am, libfs/src/imfs/deviceio.c, sapi/include/confdefs.h: Merge GSOC project code to add simple device only filesystem (devfs), optionally completely drop out filesystem, and to clean up disabling newlib reentrancy support. This dropped 17K from the minimum.exe for sparc/sis and arm/rtl22xx_t now has a 15K code space.
  • libcsupport/src/usrenv.c, libcsupport/src/newlibc_reent.c, libfs/src/devfs/devclose.c, libfs/src/devfs/devfs.h, libfs/src/devfs/devfs_eval.c, libfs/src/devfs/devfs_init.c, libfs/src/devfs/devfs_mknod.c, libfs/src/devfs/devfs_node_type.c, libfs/src/devfs/devfs_show.c, libfs/src/devfs/devioctl.c, libfs/src/devfs/devopen.c, libfs/src/devfs/devread.c, libfs/src/devfs/devstat.c, libfs/src/devfs/devwrite.c, libfs/src/imfs/deviceerrno.c: New files.
  • libcsupport/src/newlibc.c: Removed.
  • Property mode set to 100644
File size: 1.7 KB
Line 
1/*
2 *  The license and distribution terms for this file may be
3 *  found in the file LICENSE in this distribution or at
4 *  http://www.rtems.com/license/LICENSE.
5 *
6 *  $Id$
7 */
8
9#if HAVE_CONFIG_H
10#include "config.h"
11#endif
12
13#include <rtems/seterr.h>
14#include <fcntl.h>
15#include <assert.h>
16#include "devfs.h"
17
18int devFS_evaluate_path(
19  const char                        *pathname,
20  int                                flags,
21  rtems_filesystem_location_info_t  *pathloc
22)
23{
24    int                   i;
25    rtems_device_name_t  *device_name_table;
26
27    /* see if 'flags' is valid */
28    if ( !rtems_libio_is_valid_perms( flags ) ) {
29        assert( 0 );
30        rtems_set_errno_and_return_minus_one( EIO );
31    }
32
33    /* get the device name table */
34    device_name_table = (rtems_device_name_t *)pathloc->node_access;
35    if (!device_name_table)
36        rtems_set_errno_and_return_minus_one( EFAULT );
37
38    for (i = 0; i < rtems_device_table_size; i++){
39        if ((device_name_table[i].device_name) &&
40                (strcmp(device_name_table[i].device_name, pathname) == 0)){
41            /* find the device, set proper values */
42            pathloc->node_access = (void *)&device_name_table[i];
43            pathloc->handlers = &devFS_file_handlers;
44            pathloc->ops = &devFS_ops;
45            pathloc->mt_entry = &rtems_filesystem_root;
46            return 0;
47        }
48    }
49    /* no such file or directory */
50    rtems_set_errno_and_return_minus_one( ENOENT );
51}
52
53
54
55int devFS_evaluate_for_make(
56   const char                         *path,
57   rtems_filesystem_location_info_t   *pathloc,
58   const char                        **name
59)
60{
61    /* we do nothing, just set name to path */
62   *name = path;
63    return 0;
64}
65
Note: See TracBrowser for help on using the repository browser.