source: rtems/c/src/lib/libc/imfs_stat.c @ 0bf2ff8

4.104.114.84.95
Last change on this file since 0bf2ff8 was 07a3253d, checked in by Joel Sherrill <joel.sherrill@…>, on 11/23/98 at 19:07:58

Added base version of file system infrastructure. This includes a major
overhaul of the RTEMS system call interface. This base file system is
the "In-Memory File System" aka IMFS.

The design and implementation was done by the following people:

+ Joel Sherrill (joel@…)
+ Jennifer Averett (jennifer@…)
+ Steve "Mr Mount" Salitasc (salitasc@…)
+ Kerwin Wade (wade@…)

PROBLEMS
========

+ It is VERY likely that merging this will break the UNIX port. This

can/will be fixed.

+ There is likely some reentrancy/mutual exclusion needed.

+ Eventually, there should be a "mini-IMFS" description table to

eliminate links, symlinks, etc to save memory. All you need to
have "classic RTEMS" functionality is technically directories
and device IO. All the rest could be left out to save memory.

  • Property mode set to 100644
File size: 1.3 KB
Line 
1/*
2 *  IMFS_stat
3 * 
4 *  This routine provides a stat for the IMFS file system.
5 *
6 *  COPYRIGHT (c) 1989-1998.
7 *  On-Line Applications Research Corporation (OAR).
8 *  Copyright assigned to U.S. Government, 1994.
9 *
10 *  The license and distribution terms for this file may be
11 *  found in the file LICENSE in this distribution or at
12 *  http://www.OARcorp.com/rtems/license.html.
13 *
14 *  $Id$
15 */
16
17#include <errno.h>
18#include "imfs.h"
19#include "libio_.h"
20
21int IMFS_stat(
22  rtems_filesystem_location_info_t *loc,
23  struct stat                      *buf
24)
25{
26  IMFS_jnode_t   *the_jnode;
27  IMFS_device_t  *io;
28
29  the_jnode = loc->node_access;
30
31
32  switch ( the_jnode->type ) {
33
34    case IMFS_DEVICE:
35      io          = &the_jnode->info.device;
36      buf->st_dev = rtems_filesystem_make_dev_t( io->major, io->minor );
37      break;
38
39    case IMFS_MEMORY_FILE:
40      buf->st_size = the_jnode->info.file.size;
41      break;
42   
43    default:
44      set_errno_and_return_minus_one( ENOTSUP );
45      break;
46  }
47
48  buf->st_mode  = the_jnode->st_mode;
49  buf->st_nlink = the_jnode->st_nlink;
50  buf->st_ino   = the_jnode->st_ino;
51  buf->st_uid   = the_jnode->st_uid;
52  buf->st_gid   = the_jnode->st_gid;
53
54  buf->st_atime = the_jnode->st_atime;
55  buf->st_mtime = the_jnode->st_mtime;
56  buf->st_ctime = the_jnode->st_ctime;
57
58  return 0;
59}
Note: See TracBrowser for help on using the repository browser.