1. 마운트정보
cat /proc/mounts
를 통해 현재 마운트되어 있는 정보를 확인가능하다
2. 자세한 마운트정보는 statfs와 statvfs로 습득가능하다
statfs는 bsd계열 명령이고
statvfs는 solaris, lrix, POSIX계열 명령이다.
cat /proc/mounts
를 통해 현재 마운트되어 있는 정보를 확인가능하다
2. 자세한 마운트정보는 statfs와 statvfs로 습득가능하다
statfs는 bsd계열 명령이고
statvfs는 solaris, lrix, POSIX계열 명령이다.
/**
* @brief
* get dir' avail space
*/
unsigned long long get_avail_space(char *dir)
{
//// statvfs
// unsigned long long result = 0;
// struct statvfs sfs;
//
// if (statvfs(dir, &sfs) != -1) {
//
// result = (unsigned long long)sfs.f_bsize * sfs.f_bavail;
// } else {
// fprintf(stderr, "cannot read dir");
// }
//
// return result;
unsigned long long result = 0;
struct statfs sfs;
if (statfs(dir, &sfs) != -1) {
result = (unsigned long long)sfs.f_bsize * sfs.f_bavail;
cout << "File system types:" << sfs.f_type << endl;
} else {
perror("cannot read dir");
}
return result;
}
Comments