git-svn-id: svn://db.shs.com.ru/pip@831 12ceb7fc-bf1f-11e4-8940-5bc7170c53b5

This commit is contained in:
2019-07-23 20:32:06 +00:00
parent bb910a28a7
commit 8891ba903c
2 changed files with 20 additions and 5 deletions

View File

@@ -29,6 +29,16 @@
#define SALT_SIZE 8
PISystemInfo::MountInfo::MountInfo() {
space_all = space_used = space_free = 0;
removable = false;
}
PISystemInfo::PISystemInfo() {
processorsCount = 1;
}
@@ -79,12 +89,14 @@ PIStringList PISystemInfo::mountRoots() {
struct String3 {PIString mp, type, label;};
PIVector<PISystemInfo::MountInfo> PISystemInfo::mountInfo() {
PIVector<PISystemInfo::MountInfo> PISystemInfo::mountInfo(bool ignore_cache) {
static PIVector<PISystemInfo::MountInfo> cache;
static PITimeMeasurer tm;
static bool first = true;
if (!ignore_cache) {
if (tm.elapsed_m() < piMountInfoRefreshIntervalMs && !first)
return cache;
}
first = false;
tm.reset();
cache.clear();
@@ -109,6 +121,8 @@ PIVector<PISystemInfo::MountInfo> PISystemInfo::mountInfo() {
m.space_used = m.space_all - m.space_free;
} else
m.space_all = m.space_free = m.space_used = 0U;
if (GetDriveType(clet.dataAscii()) == DRIVE_REMOVABLE)
m.removable = true;
clet.cutRight(1);
int qdd = QueryDosDevice(clet.data(), volfs, 1023);
if (qdd > 0)

View File

@@ -27,7 +27,7 @@ public:
PISystemInfo();
struct MountInfo {
MountInfo() {space_all = space_used = space_free = 0;}
MountInfo();
PIString mount_point;
PIString device;
PIString filesystem;
@@ -35,6 +35,7 @@ public:
ullong space_all;
ullong space_used;
ullong space_free;
bool removable;
};
PIString ifconfigPath, execCommand, hostname, user, OS_name, OS_version, architecture;
@@ -42,7 +43,7 @@ public:
int processorsCount;
static PIStringList mountRoots();
static PIVector<MountInfo> mountInfo();
static PIVector<MountInfo> mountInfo(bool ignore_cache = false);
static PIString machineKey();
static uint machineID();