forked from CyberDocsOfficial/memErase
-
Notifications
You must be signed in to change notification settings - Fork 0
/
devmem.h
23 lines (20 loc) · 690 Bytes
/
devmem.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#include <sys/statvfs.h>
#include <cmath>
#include <string>
#include <cstring>
#include "user.h"
#include "devicelist.h"
#ifndef __massstoragedevicememory_h_
#define __massstoragedevicememory_h_
using namespace std;
int deviceMemory(){
const uint GB = (1024 * 1024) * 1024;
string currentSystemUser = systemUserRead();
string * currentlyConnectedSystemDrives = systemConnectedDrives();
string diskMountPoint = "/media/"+ currentSystemUser + "/" + * currentlyConnectedSystemDrives;
struct statvfs buffer;
int ret = statvfs(diskMountPoint.c_str(), &buffer);
const double totalDiskSpace = ceil((double)(buffer.f_blocks * buffer.f_frsize)/GB);
return totalDiskSpace;
}
#endif