summaryrefslogtreecommitdiffstats
path: root/cpukit/libfs/src/imfs/imfs_mount.c
blob: 243e5a0e30f2bd401b209b84eff6999b3115d8cf (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
/*
 *  IMFS_mount
 *
 *  COPYRIGHT (c) 1989-1999.
 *  On-Line Applications Research Corporation (OAR).
 *
 *  Modifications to support reference counting in the file system are
 *  Copyright (c) 2012 embedded brains GmbH.
 *
 *  The license and distribution terms for this file may be
 *  found in the file LICENSE in this distribution or at
 *  http://www.rtems.com/license/LICENSE.
 *
 *  $Id$
 */

#if HAVE_CONFIG_H
  #include "config.h"
#endif

#include "imfs.h"

int IMFS_mount( rtems_filesystem_mount_table_entry_t *mt_entry )
{
  int rv = 0;
  IMFS_jnode_t *node = mt_entry->mt_point_node->location.node_access;

  if ( node->type == IMFS_DIRECTORY ) {
    if ( node->info.directory.mt_fs == NULL ) {
      node->info.directory.mt_fs = mt_entry;
    } else {
      errno = EBUSY;
      rv = -1;
    }
  } else {
    errno = ENOTDIR;
    rv = -1;
  }

  return rv;
}