OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [rtems/] [c/] [src/] [lib/] [libc/] [imfs_stat.c] - Blame information for rev 507

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 30 unneback
/*
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: imfs_stat.c,v 1.2 2001-09-27 12:01:15 chris Exp $
14
 */
15
 
16
#include <errno.h>
17
#include "imfs.h"
18
#include "libio_.h"
19
 
20
int IMFS_stat(
21
  rtems_filesystem_location_info_t *loc,
22
  struct stat                      *buf
23
)
24
{
25
  IMFS_jnode_t   *the_jnode;
26
  IMFS_device_t  *io;
27
 
28
  the_jnode = loc->node_access;
29
 
30
 
31
  switch ( the_jnode->type ) {
32
 
33
    case IMFS_DEVICE:
34
      io          = &the_jnode->info.device;
35
      buf->st_dev = rtems_filesystem_make_dev_t( io->major, io->minor );
36
      break;
37
 
38
    case IMFS_MEMORY_FILE:
39
      buf->st_size = the_jnode->info.file.size;
40
      break;
41
 
42
    default:
43
      set_errno_and_return_minus_one( ENOTSUP );
44
      break;
45
  }
46
 
47
  buf->st_mode  = the_jnode->st_mode;
48
  buf->st_nlink = the_jnode->st_nlink;
49
  buf->st_ino   = the_jnode->st_ino;
50
  buf->st_uid   = the_jnode->st_uid;
51
  buf->st_gid   = the_jnode->st_gid;
52
 
53
  buf->st_atime = the_jnode->stat_atime;
54
  buf->st_mtime = the_jnode->stat_mtime;
55
  buf->st_ctime = the_jnode->stat_ctime;
56
 
57
  return 0;
58
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.