mirror of
https://github.com/otakuto/crazydiskinfo.git
synced 2025-07-28 11:54:54 +00:00
cosme
This commit is contained in:
parent
2fb109dd67
commit
3a14ff1f37
1 changed files with 17 additions and 18 deletions
35
main.cpp
35
main.cpp
|
@ -397,7 +397,6 @@ int main()
|
||||||
init_pair(8, COLOR_YELLOW, COLOR_BLACK);
|
init_pair(8, COLOR_YELLOW, COLOR_BLACK);
|
||||||
|
|
||||||
int select = 0;
|
int select = 0;
|
||||||
int smart_ret = 0;
|
|
||||||
std::vector<SMART> smartList;
|
std::vector<SMART> smartList;
|
||||||
auto dir = opendir("/sys/block");
|
auto dir = opendir("/sys/block");
|
||||||
while (auto e = readdir(dir))
|
while (auto e = readdir(dir))
|
||||||
|
@ -407,23 +406,23 @@ int main()
|
||||||
std::string("ram") != std::string(e->d_name).substr(0,3) &&
|
std::string("ram") != std::string(e->d_name).substr(0,3) &&
|
||||||
std::string("loop") != std::string(e->d_name).substr(0,4))
|
std::string("loop") != std::string(e->d_name).substr(0,4))
|
||||||
{
|
{
|
||||||
SkDisk * skdisk;
|
SkDisk * skdisk;
|
||||||
SkBool b;
|
SkBool b;
|
||||||
int f = sk_disk_open((std::string("/dev/") + std::string(e->d_name)).c_str(), &skdisk);
|
int f = sk_disk_open((std::string("/dev/") + std::string(e->d_name)).c_str(), &skdisk);
|
||||||
if (f < 0)
|
if (f < 0)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
smart_ret = sk_disk_smart_is_available(skdisk, &b);
|
int smart_ret = sk_disk_smart_is_available(skdisk, &b);
|
||||||
sk_disk_free(skdisk);
|
sk_disk_free(skdisk);
|
||||||
if (smart_ret < 0)
|
if (smart_ret < 0)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (b)
|
if (b)
|
||||||
{
|
{
|
||||||
smartList.push_back(SMART(std::string("/dev/") + std::string(e->d_name)));
|
smartList.push_back(SMART(std::string("/dev/") + std::string(e->d_name)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
std::sort(smartList.begin(), smartList.end(), [](SMART const & lhs, SMART const & rhs){return lhs.deviceName < rhs.deviceName;});
|
std::sort(smartList.begin(), smartList.end(), [](SMART const & lhs, SMART const & rhs){return lhs.deviceName < rhs.deviceName;});
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue