Fix the creation of the dumpdir directory in stress_floppy Makefile
[ltp-debian.git] / lib / tst_cwd_has_free.c
blob18209aa7a36938a5204046febacf0f6e2d82533d
1 /*
2 * AUTHOR
3 * Ricky Ng-Adam <rngadam@yahoo.com>, 2005-01-01
5 * DESCRIPTION
6 * Check if there is enough blocks to fill number of KiB specified
7 * If current directory has enough blocks, return 1
8 * If current directory has NOT enough blocks, return 0
12 #include <sys/vfs.h>
14 int
15 tst_cwd_has_free(int required_kib)
17 struct statfs sf;
18 statfs(".", &sf);
20 /* check that we have enough blocks to create swap file */
21 return ((float)sf.f_bfree)/(1024/sf.f_bsize) >= required_kib?1:0;