bfsVolStat()

PROTOTYPE

#include <bfs.h>

int bfsVolStat(BfsVolStat *buf);

DESCRIPTION

bfsVolStat() outputs information about the TargetBFS volume, writing it to the BfsVolStat structure pointed to by buf. The BfsVolStat structure is defined in “bfs.h” and reproduced below:

typedef struct
{
  uint bf_used; /* number of blocks used by boot file */
  uint bf_free; /* number of free blocks for boot file */
  uint nf_used; /* number of blocks used by normal files */
  uint nf_free; /* number of free blocks for normal files */
  ui8 num_ext;  /* number of extents available. I.e. MAX_EXTENTS */
  ui8 max_ext;  /* highest max_ext value among all files */
} BfsVolStat;

If successful, bfsVolStat() returns 0. Otherwise, it sets errno and returns -1.

ERROR CODES

EFAULT buf equals NULL.
EMFILE A file is open or a fatal error has occurred.

EXAMPLE

  BfsVolStat vstat;

  /*-------------------------------------------------------------------*/
  /* Display volume geometry and total size.                           */
  /*-------------------------------------------------------------------*/
  bfsVolStat(&vstat);
  printf(" BFS free blocks: %u boot/%u other\n", vstat.bf_free,
                                                 vstat.nf_free);
  printf(" BFS used blocks: %u boot/%u other\n", vstat.bf_used,
                                                 vstat.nf_used);
  printf(" BFS extents: %u avail/%u max used\n", vstat.num_ext,
                                                 vstat.max_ext);