OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [rtems-20020807/] [cpukit/] [libcsupport/] [src/] [eval.c] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1026 ivang
/*
2
 *  rtems_filesystem_evaluate_path()
3
 *
4
 *  Routine to seed the evaluate path routine.
5
 *
6
 *  COPYRIGHT (c) 1989-1999.
7
 *  On-Line Applications Research Corporation (OAR).
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
 *  eval.c,v 1.8 2002/01/04 18:29:36 joel Exp
14
 */
15
 
16
#if HAVE_CONFIG_H
17
#include "config.h"
18
#endif
19
 
20
#include <rtems.h>
21
#include <rtems/libio_.h>
22
#include <rtems/seterr.h>
23
 
24
int rtems_filesystem_evaluate_path(
25
  const char                        *pathname,
26
  int                                flags,
27
  rtems_filesystem_location_info_t  *pathloc,
28
  int                                follow_link
29
)
30
{
31
  int                           i;
32
  int                           result;
33
  rtems_filesystem_node_types_t type;
34
 
35
  /*
36
   * Verify Input parameters.
37
   */
38
 
39
  if ( !pathname )
40
    rtems_set_errno_and_return_minus_one( EFAULT );
41
 
42
  if ( !pathloc )
43
    rtems_set_errno_and_return_minus_one( EIO );       /* should never happen */
44
 
45
  /*
46
   * Evaluate the path using the optable evalpath.
47
   */
48
 
49
  rtems_filesystem_get_start_loc( pathname, &i, pathloc );
50
 
51
  if ( !pathloc->ops->evalpath_h )
52
    rtems_set_errno_and_return_minus_one( ENOTSUP );
53
 
54
  result = (*pathloc->ops->evalpath_h)( &pathname[i], flags, pathloc );
55
 
56
  /*
57
   * Get the Node type and determine if you need to follow the link or
58
   * not.
59
   */
60
 
61
  if ( (result == 0) && follow_link ) {
62
 
63
    if ( !pathloc->ops->node_type_h )
64
      rtems_set_errno_and_return_minus_one( ENOTSUP );
65
 
66
    type = (*pathloc->ops->node_type_h)( pathloc );
67
 
68
    if ( ( type == RTEMS_FILESYSTEM_HARD_LINK ) ||
69
         ( type == RTEMS_FILESYSTEM_SYM_LINK ) ) {
70
 
71
        if ( !pathloc->ops->eval_link_h )
72
          rtems_set_errno_and_return_minus_one( ENOTSUP );
73
 
74
         result =  (*pathloc->ops->eval_link_h)( pathloc, flags );
75
 
76
    }
77
  }
78
 
79
  return result;
80
}
81
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.