system/helpers: rework get_fs_usage()

also comment some unuses variables in src/infoviever_bb.{h,cpp}


Origin commit data
------------------
Branch: ni/coolstream
Commit: 7c01980e94
Author: vanhofen <vanhofen@gmx.de>
Date: 2012-09-27 (Thu, 27 Sep 2012)

Origin message was:
------------------
- system/helpers: rework get_fs_usage()

also comment some unuses variables in src/infoviever_bb.{h,cpp}


------------------
This commit was generated by Migit
This commit is contained in:
vanhofen
2012-09-27 12:22:33 +02:00
parent fc9c3d7dd9
commit 732594fa2e
4 changed files with 30 additions and 26 deletions

View File

@@ -191,17 +191,18 @@ int check_dir(const char * dir)
return ret;
}
int get_fs_usage(const char * dir)
bool get_fs_usage(const char * dir, long &btotal, long &bused)
{
int ret = 0;
long blocks_used;
btotal = bused = 0;
struct statfs s;
if (::statfs(dir, &s) == 0 && s.f_blocks) {
blocks_used = s.f_blocks - s.f_bfree;
ret = (blocks_used * 100ULL) / s.f_blocks;
btotal = s.f_blocks;
bused = s.f_blocks - s.f_bfree;
//printf("fs (%s): total %ld used %ld\n", dir, btotal, bused);
return true;
}
return ret;
return false;
}
bool get_mem_usage(unsigned long &kbtotal, unsigned long &kbfree)