source: rtems/cpukit/libcsupport/src/unmount.c @ 7666afc

4.115
Last change on this file since 7666afc was 9b4422a2, checked in by Joel Sherrill <joel.sherrill@…>, on 05/03/12 at 15:09:24

Remove All CVS Id Strings Possible Using a Script

Script does what is expected and tries to do it as
smartly as possible.

+ remove occurrences of two blank comment lines

next to each other after Id string line removed.

+ remove entire comment blocks which only exited to

contain CVS Ids

+ If the processing left a blank line at the top of

a file, it was removed.

  • Property mode set to 100644
File size: 1.4 KB
Line 
1/*
2 *  unmount() - Unmount a File System
3 *
4 *  This routine is not defined in the POSIX 1003.1b standard but
5 *  in some form is supported on most UNIX and POSIX systems.  This
6 *  routine is necessary to mount instantiations of a file system
7 *  into the file system name space.
8 *
9 *  COPYRIGHT (c) 1989-2010.
10 *  On-Line Applications Research Corporation (OAR).
11 *
12 *  The license and distribution terms for this file may be
13 *  found in the file LICENSE in this distribution or at
14 *  http://www.rtems.com/license/LICENSE.
15 */
16
17#if HAVE_CONFIG_H
18  #include "config.h"
19#endif
20
21#include <errno.h>
22
23#include <rtems/libio_.h>
24
25int unmount( const char *path )
26{
27  int rv = 0;
28  rtems_filesystem_eval_path_context_t ctx;
29  int eval_flags = RTEMS_FS_FOLLOW_LINK;
30  const rtems_filesystem_location_info_t *currentloc =
31    rtems_filesystem_eval_path_start( &ctx, path, eval_flags );
32  rtems_filesystem_mount_table_entry_t *mt_entry = currentloc->mt_entry;
33
34  if ( rtems_filesystem_location_is_root( currentloc ) ) {
35    rv = (*mt_entry->mt_point_node->location.ops->unmount_h)( mt_entry );
36    if ( rv == 0 ) {
37      rtems_filesystem_mt_entry_declare_lock_context( lock_context );
38
39      rtems_filesystem_mt_entry_lock( lock_context );
40      mt_entry->mounted = false;
41      rtems_filesystem_mt_entry_unlock( lock_context );
42    }
43  } else {
44    errno = EACCES;
45    rv = -1;
46  }
47
48  rtems_filesystem_eval_path_cleanup( &ctx );
49
50  return rv;
51}
Note: See TracBrowser for help on using the repository browser.