source: rtems/c/src/exec/libfs/src/imfs/imfs_stat.c @ d6b1d73

4.104.114.84.95
Last change on this file since d6b1d73 was d6b1d73, checked in by Joel Sherrill <joel.sherrill@…>, on 01/22/01 at 14:05:14

2001-01-22 Ralf Corsepius <corsepiu@…>

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