source: rtems/cpukit/libcsupport/src/eval.c @ 9c49db4

4.104.114.84.95
Last change on this file since 9c49db4 was 9c49db4, checked in by Joel Sherrill <joel.sherrill@…>, on 01/08/01 at 18:26:44

2001-01-08 Ralf Corsepius <corsepiu@…>

  • configure.in: Add libc/config.h
  • libc/Makefile.am: Add INCLUDES += -I. to pickup config.h
  • libc/.cvsignore: Add config.h and stamp-h
  • libc/*.c: Add config.h support.
  • Property mode set to 100644
File size: 1.8 KB
Line 
1/*
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 *  $Id$
14 */
15
16#if HAVE_CONFIG_H
17#include "config.h"
18#endif
19
20#include <rtems.h>
21#include <rtems/libio_.h>
22
23int rtems_filesystem_evaluate_path(
24  const char                        *pathname,
25  int                                flags,
26  rtems_filesystem_location_info_t  *pathloc,
27  int                                follow_link
28)
29{
30  int                           i;
31  int                           result;
32  rtems_filesystem_node_types_t type;
33
34  /*
35   * Verify Input parameters.
36   */
37
38  if ( !pathname )
39    set_errno_and_return_minus_one( EFAULT );
40
41  if ( !pathloc )
42    set_errno_and_return_minus_one( EIO );       /* should never happen */
43 
44  /*
45   * Evaluate the path using the optable evalpath.
46   */
47
48  rtems_filesystem_get_start_loc( pathname, &i, pathloc );
49
50  if ( !pathloc->ops->evalpath_h )
51    set_errno_and_return_minus_one( ENOTSUP );
52
53  result = (*pathloc->ops->evalpath_h)( &pathname[i], flags, pathloc );
54
55  /*
56   * Get the Node type and determine if you need to follow the link or
57   * not.
58   */
59
60  if ( (result == 0) && follow_link ) {
61
62    if ( !pathloc->ops->node_type_h )
63      set_errno_and_return_minus_one( ENOTSUP );
64
65    type = (*pathloc->ops->node_type_h)( pathloc );
66
67    if ( ( type == RTEMS_FILESYSTEM_HARD_LINK ) ||
68         ( type == RTEMS_FILESYSTEM_SYM_LINK ) ) {
69
70        if ( !pathloc->ops->eval_link_h )
71          set_errno_and_return_minus_one( ENOTSUP );
72
73         result =  (*pathloc->ops->eval_link_h)( pathloc, flags );
74 
75    }
76  }
77
78  return result;
79}
80
Note: See TracBrowser for help on using the repository browser.