パーティション情報について
Posted: 2011年5月25日(水) 14:37
下記のプログラムに使用ブロック数の表示機能を追加したい(dfコマンドの表示に合わせる)のですが、分かりません。分かる人は教えてください。
#include <stdio.h>
#include <stdlib.h>
#include <sys/vfs.h>
#include <unistd.h>
int main(int argc, char *argv[])
{
struct statfs sblock;
sync();
if(statfs(argv[1],&sblock),0){
puts("スーパブロックが読めません!");
exit(EXIT_FAILURE);
}
printf("block size = %d byte\n",sblock.f_bsize);
printf("%4.1f %% use\n", 100.0*(1-(float)sblock.f_bfree/(float)sblock.f_blocks));
return EXIT_SUCCESS;
}