summaryrefslogtreecommitdiffstats
path: root/cpukit/libfs/src/devfs/devfs_show.c
blob: b5984bde4c27368f339f6c41ee3895db992c7306 (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
42
43
44
45
46
47
48
49
/**
 * @file
 *
 * @brief Retrieves and Prints all the Device Registered in System
 * @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 "devfs.h"

void devFS_Show(void)
{
  rtems_filesystem_location_info_t *rootloc = &rtems_filesystem_root->location;

  if (rootloc->mt_entry->ops == &devFS_ops) {
    const devFS_data *data = devFS_get_data(rootloc);
    size_t i = 0;
    size_t n = data->count;
    devFS_node *nodes = data->nodes;

    for (i = 0; i < n; ++i) {
      devFS_node *current = nodes + i;

      if (current->name != NULL) {
        size_t j = 0;
        size_t m = current->namelen;

        printk("/");
        for (j = 0; j < m; ++j) {
          printk("%c", current->name [j]);
        }
        printk(
          " %lu %lu\n",
          (unsigned long) current->major,
          (unsigned long) current->minor
        );
      }
    }
  }
}