source: rtems/cpukit/libcsupport/src/statvfs.c @ c114654

4.10
Last change on this file since c114654 was 18daff9, checked in by Ralf Corsepius <ralf.corsepius@…>, on 11/29/09 at 13:35:32

Whitespace removal.

  • Property mode set to 100644
File size: 1.5 KB
Line 
1/*
2 *  COPYRIGHT (c) 2009 Chris Johns <chrisj@rtems.org>
3 *
4 *  The license and distribution terms for this file may be
5 *  found in the file LICENSE in this distribution or at
6 *  http://www.rtems.com/license/LICENSE.
7 *
8 *  $Id$
9 */
10/*
11 * The statvfs as defined by the SUS:
12 *    http://www.opengroup.org/onlinepubs/009695399/basedefs/sys/statvfs.h.html
13 */
14
15#if HAVE_CONFIG_H
16#include "config.h"
17#endif
18
19#include <rtems/libio_.h>
20#include <rtems/seterr.h>
21
22#include <sys/statvfs.h>
23
24/*
25 *  Data structures and routines private to mount/unmount pair.
26 */
27extern rtems_chain_control rtems_filesystem_mount_table_control;
28
29int
30statvfs (const char *path, struct statvfs *sb)
31{
32  rtems_filesystem_location_info_t      loc;
33  rtems_filesystem_location_info_t     *fs_mount_root;
34  rtems_filesystem_mount_table_entry_t *mt_entry;
35  int                                   result;
36
37  /*
38   *  Get
39   *    The root node of the mounted filesytem.
40   *    The node for the directory that the fileystem is mounted on.
41   *    The mount entry that is being refered to.
42   */
43
44  if ( rtems_filesystem_evaluate_path( path, strlen( path ), 0x0, &loc, true ) )
45    return -1;
46
47  mt_entry      = loc.mt_entry;
48  fs_mount_root = &mt_entry->mt_fs_root;
49
50  if ( !fs_mount_root->ops->statvfs_h )
51    rtems_set_errno_and_return_minus_one( ENOTSUP );
52
53  memset (sb, 0, sizeof (struct statvfs));
54
55  result = ( fs_mount_root->ops->statvfs_h )( fs_mount_root, sb );
56
57  rtems_filesystem_freenode( &loc );
58
59  return result;
60}
Note: See TracBrowser for help on using the repository browser.