mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-27 23:42:58 +02:00
* system/helpers.cpp: Adding value 'bsize' as a possible return value
This commit is contained in:
@@ -193,7 +193,7 @@ int check_dir(const char * dir)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool get_fs_usage(const char * dir, long &btotal, long &bused)
|
bool get_fs_usage(const char * dir, long &btotal, long &bused, long *bsize/*=NULL*/)
|
||||||
{
|
{
|
||||||
btotal = bused = 0;
|
btotal = bused = 0;
|
||||||
struct statfs s;
|
struct statfs s;
|
||||||
@@ -201,6 +201,8 @@ bool get_fs_usage(const char * dir, long &btotal, long &bused)
|
|||||||
if (::statfs(dir, &s) == 0 && s.f_blocks) {
|
if (::statfs(dir, &s) == 0 && s.f_blocks) {
|
||||||
btotal = s.f_blocks;
|
btotal = s.f_blocks;
|
||||||
bused = s.f_blocks - s.f_bfree;
|
bused = s.f_blocks - s.f_bfree;
|
||||||
|
if (bsize != NULL)
|
||||||
|
*bsize = s.f_bsize;
|
||||||
//printf("fs (%s): total %ld used %ld\n", dir, btotal, bused);
|
//printf("fs (%s): total %ld used %ld\n", dir, btotal, bused);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@@ -31,7 +31,7 @@ int safe_mkdir(char * path);
|
|||||||
bool file_exists(const char *filename);
|
bool file_exists(const char *filename);
|
||||||
void wakeup_hdd(const char *hdd_dir);
|
void wakeup_hdd(const char *hdd_dir);
|
||||||
int check_dir(const char * dir);
|
int check_dir(const char * dir);
|
||||||
bool get_fs_usage(const char * dir, long &total, long &used);
|
bool get_fs_usage(const char * dir, long &total, long &used, long *bsize=NULL);
|
||||||
bool get_mem_usage(unsigned long &total, unsigned long &free);
|
bool get_mem_usage(unsigned long &total, unsigned long &free);
|
||||||
|
|
||||||
std::string trim(std::string &str, const std::string &trimChars = " \n\r\t");
|
std::string trim(std::string &str, const std::string &trimChars = " \n\r\t");
|
||||||
|
Reference in New Issue
Block a user