source: rtems/cpukit/libcsupport/src/eval.c @ 07a3253d

4.104.114.84.95
Last change on this file since 07a3253d 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: 1.7 KB
Line 
1/*
2 *  rtems_filesystem_evaluate_path()
3 *
4 *  Routine to seed the evaluate path routine.
5 *
6 *  COPYRIGHT (c) 1989-1998.
7 *  On-Line Applications Research Corporation (OAR).
8 *  Copyright assigned to U.S. Government, 1994.
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.OARcorp.com/rtems/license.html.
13 *
14 *  $Id$
15 */
16
17#include <rtems.h>
18#include "libio_.h"
19
20int rtems_filesystem_evaluate_path(
21  const char                        *pathname,
22  int                                flags,
23  rtems_filesystem_location_info_t  *pathloc,
24  int                                follow_link
25)
26{
27  int                           i;
28  int                           result;
29  rtems_filesystem_node_types_t type;
30
31  /*
32   * Verify Input parameters.
33   */
34
35  if ( !pathname )
36    set_errno_and_return_minus_one( EFAULT );
37
38  if ( !pathloc )
39    set_errno_and_return_minus_one( EIO );       /* should never happen */
40 
41  /*
42   * Evaluate the path using the optable evalpath.
43   */
44
45  rtems_filesystem_get_start_loc( pathname, &i, pathloc );
46
47  result = (*pathloc->ops->evalpath)( &pathname[i], flags, pathloc );
48
49  /*
50   * Get the Node type and determine if you need to follow the link or
51   * not.
52   */
53
54  if ( follow_link ) {
55
56    if ( !pathloc->ops->node_type )
57      set_errno_and_return_minus_one( ENOTSUP );
58
59    type = (*pathloc->ops->node_type)( pathloc );
60
61    if ( ( type == RTEMS_FILESYSTEM_HARD_LINK ) ||
62         ( type == RTEMS_FILESYSTEM_SYM_LINK ) ) {
63
64        if ( !pathloc->ops->eval_link )
65          set_errno_and_return_minus_one( ENOTSUP );
66
67         result =  (*pathloc->ops->eval_link)( pathloc, flags );
68 
69    }
70  }
71
72  return result;
73}
74
Note: See TracBrowser for help on using the repository browser.