minix/minix/fs/isofs/stadir.c
David van Moolenbroek 1311233cfb libminixfs: keep track of block usage
This patch changes the libminixfs API and implementation such that the
library is at all times aware of how many total and used blocks there
are in the file system.  This removes the last upcall of libminixfs
into file systems (fs_blockstats).  In the process, make this part of
the libminixfs API a little prettier and more robust.  Change file
systems accordingly.  Since this change only adds to MFS being unable
to deal with zones and blocks having different sizes, fail to mount
such file systems immediately rather than triggering an assert later.

Change-Id: I078e589c7e1be1fa691cf391bf5dfddd1baf2c86
2015-08-14 18:39:21 +00:00

28 lines
486 B
C

#include "inc.h"
#include <sys/stat.h>
#include <sys/statvfs.h>
int fs_stat(ino_t ino_nr, struct stat *statbuf)
{
struct inode *rip;
if ((rip = find_inode(ino_nr)) == NULL)
return EINVAL;
*statbuf = rip->i_stat;
return OK;
}
int fs_statvfs(struct statvfs *st)
{
st->f_flag = ST_NOTRUNC;
st->f_bsize = v_pri.logical_block_size_l;
st->f_frsize = st->f_bsize;
st->f_iosize = st->f_bsize;
st->f_blocks = v_pri.volume_space_size_l;
st->f_namemax = NAME_MAX;
return OK;
}