1 /* This file contains miscellaneous file system call handlers.
3 * The entry points into this file are:
4 * do_statvfs perform the STATVFS file system call
7 * April 2009 (D.C. van Moolenbroek)
12 #include <sys/statvfs.h>
14 /*===========================================================================*
16 *===========================================================================*/
17 int do_statvfs(struct statvfs
*st
)
19 /* Retrieve file system statistics.
26 /* Unfortunately, we cannot be any more specific than this, because we are
27 * not given an inode number. Statistics of individual shared folders can
28 * only be obtained by making sure that the root of the file system is an
29 * actual share, and not a list of available shares.
31 if ((ino
= find_inode(ROOT_INODE_NR
)) == NULL
)
34 if ((r
= verify_inode(ino
, path
, NULL
)) != OK
)
37 if ((r
= sffs_table
->t_queryvol(path
, &bfree
, &btotal
)) != OK
)
40 /* Returning zero for unknown values seems to be the convention. However, we
41 * do have to use a nonzero block size, even though it is entirely arbitrary.
43 st
->f_flag
= ST_NOTRUNC
;
44 st
->f_bsize
= BLOCK_SIZE
;
45 st
->f_frsize
= BLOCK_SIZE
;
46 st
->f_iosize
= BLOCK_SIZE
;
47 st
->f_blocks
= (fsblkcnt_t
)(btotal
/ BLOCK_SIZE
);
48 st
->f_bfree
= (fsblkcnt_t
)(bfree
/ BLOCK_SIZE
);
49 st
->f_bavail
= st
->f_bfree
;
50 st
->f_namemax
= NAME_MAX
;