bfsStat()

PROTOTYPE

#include <bfs.h>

int bfsStat(const char *name, BfsStat *buf);

DESCRIPTION

bfsStat() obtains information about the file specified by name. buf points to a BfsStat structure, defined in “bfs.h” and reproduced below, that the file information is written to.

typedef struct
{
  char *fname;  /* null-terminated file name */
  ui32 size;    /* file size in bytes */
  ui32 rd_cnt;  /* number times read since last boot */
  ui32 wr_seq;  /* f-node sequence # when file written */
  ui8 num_ext;  /* current number of extents used */
  ui8 max_ext;  /* maximum number of extents used */
  ui8 flags;    /* may contain RECYCLE_REQ (NAND only) */
} BfsStat;

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

ERROR CODES

EFAULT name equals NULL or the empty string or buf equals NULL.
EMFILE A file is open or a fatal error has occurred.
ENOENT The file specified by name was not found.

EXAMPLE

/*-------------------------------------------------------------------*/
/* Program loaded image into the FPGA. Return -1 if error.           */
/*-------------------------------------------------------------------*/
bfsStat("system.bit", &stat);
i = plConfig(TMP_BUF_BEG, stat.size);
if (i <= 0)
  return -1;