source: rtems/c/src/libfs/src/imfs/imfs_stat.c @ b2709481

4.104.114.84.95
Last change on this file since b2709481 was b2709481, checked in by Joel Sherrill <joel.sherrill@…>, on 01/04/02 at 18:30:58

2002-01-04 Ralf Corsepius <corsepiu@…>

  • src/imfs/imfs_eval.c: Include <rtems/seterr.h>. Apply rtems_set_errno_and_return_minus_one.
  • src/imfs/memfile.c: Include <rtems/seterr.h>. Apply rtems_set_errno_and_return_minus_one.
  • src/imfs/imfs_readlink.c: Include <rtems/seterr.h>. Apply rtems_set_errno_and_return_minus_one.
  • src/imfs/imfs_unlink.c: Include <rtems/seterr.h>. Apply rtems_set_errno_and_return_minus_one.
  • src/imfs/imfs_link.c: Include <rtems/seterr.h>. Apply rtems_set_errno_and_return_minus_one.
  • src/imfs/imfs_chown.c: Include <rtems/seterr.h>. Apply rtems_set_errno_and_return_minus_one.
  • src/imfs/ioman.c: Include <rtems/seterr.h>. Apply rtems_set_errno_and_return_minus_one.
  • src/imfs/imfs_mount.c: Include <rtems/seterr.h>. Apply rtems_set_errno_and_return_minus_one.
  • src/imfs/imfs_directory.c: Include <rtems/seterr.h>. Apply rtems_set_errno_and_return_minus_one.
  • src/imfs/imfs_stat.c: Include <rtems/seterr.h>. Apply rtems_set_errno_and_return_minus_one.
  • src/imfs/imfs_fchmod.c: Include <rtems/seterr.h>. Apply rtems_set_errno_and_return_minus_one.
  • src/imfs/imfs_symlink.c: Include <rtems/seterr.h>. Apply rtems_set_errno_and_return_minus_one.
  • src/imfs/imfs_mknod.c: Include <rtems/seterr.h>. Apply rtems_set_errno_and_return_minus_one.
  • src/imfs/linearfile.c: Include <rtems/seterr.h>. Apply rtems_set_errno_and_return_minus_one.
  • src/imfs/imfs_unmount.c: Include <rtems/seterr.h>. Apply rtems_set_errno_and_return_minus_one.
  • src/imfs/imfs.h: Apply rtems_set_errno_and_return_minus_one. Comment out increment_and_check_linkcounts.
  • 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#include <rtems/seterr.h>
24
25int IMFS_stat(
26  rtems_filesystem_location_info_t *loc,
27  struct stat                      *buf
28)
29{
30  IMFS_jnode_t   *the_jnode;
31  IMFS_device_t  *io;
32
33  the_jnode = loc->node_access;
34
35
36  switch ( the_jnode->type ) {
37
38    case IMFS_DEVICE:
39      io          = &the_jnode->info.device;
40      buf->st_dev = rtems_filesystem_make_dev_t( io->major, io->minor );
41      break;
42
43    case IMFS_LINEAR_FILE:
44    case IMFS_MEMORY_FILE:
45      buf->st_size = the_jnode->info.file.size;
46      break;
47   
48    case IMFS_SYM_LINK:
49      buf->st_size = 0;
50      break;
51   
52    default:
53      rtems_set_errno_and_return_minus_one( ENOTSUP );
54      break;
55  }
56
57  buf->st_mode  = the_jnode->st_mode;
58  buf->st_nlink = the_jnode->st_nlink;
59  buf->st_ino   = the_jnode->st_ino;
60  buf->st_uid   = the_jnode->st_uid;
61  buf->st_gid   = the_jnode->st_gid;
62
63  buf->st_atime = the_jnode->stat_atime;
64  buf->st_mtime = the_jnode->stat_mtime;
65  buf->st_ctime = the_jnode->stat_ctime;
66
67  return 0;
68}
Note: See TracBrowser for help on using the repository browser.