summaryrefslogtreecommitdiff
path: root/cpukit/libfs/src/devfs/devstat.c
blob: c88f7299245a0943359e2921b42d09ba999ca9ff (plain)
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
/**
 * @file
 *
 * @brief Gets the Device File Information
 * @ingroup DevFsDeviceTable Define Device Table Type
 */

/*
 *  The license and distribution terms for this file may be
 *  found in the file LICENSE in this distribution or at
 *  http://www.rtems.org/license/LICENSE.
 */

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

#include <rtems/devfs.h>

int devFS_stat(
  const rtems_filesystem_location_info_t *loc,
  struct stat *buf
)
{
  int rv = 0;
  const devFS_node *the_dev = loc->node_access;

  if (the_dev != NULL) {
    buf->st_rdev = rtems_filesystem_make_dev_t( the_dev->major, the_dev->minor );
    buf->st_mode = the_dev->mode;
  } else {
    rv = rtems_filesystem_default_fstat(loc, buf);
  }

  return rv;
}