bfsStatIth()
PROTOTYPE
#include <bfs.h>
int bfsStatIth(int i, BfsStat *buf);
DESCRIPTION
bfsStatIth() outputs information on the file specified by i, an index value ranging from 0 to one less than the number of existing files. 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, bfsStatIth() 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. |
| ENOENT | The file specified by i was not found. |
EXAMPLE
/*---------------------------------------------------------------------*/
/* If index is viable, delete file (after confirmation). */
/*---------------------------------------------------------------------*/
if ((sel >= 0) && (sel <= i))
{
bfsStatIth(sel, &buf);
printf("%c\nDelete \"%s\" ('1' = yes, other = no): ", cmd, buf.fname);
cmd = getCmdKey();
if (cmd == '1')
{
printf("1 ...");
bfsUnlink(buf.fname);
printf("finished");
}
putchar('\n');
}