KySdkDisk(3)
πΎ KySdkDisk β the disk-info D-Bus signal girly β¨
okay bestie, welcome to KySdkDisk, a manual page from the Disk Information D-Bus Library section of your friendly neighborhood kysdkdbus.h docs. She's a class, she's a whole vibe, and she's about to tell you literally everything about your disks π«Ά
β¨ NAME β¨
KySdkDisk β the class that generates D-Bus signals for disk information, no cap π
πΈ SYNOPSIS πΈ
#include <kysdkdbus.h>
that's it. that's the include. one line. iconic π
π¦ DESCRIPTION π¦
so like, the KySdkDisk class is mainly used to generate D-Bus signals for a whole shopping list of disk stuff: the disk list, number of sectors, bytes per sector, capacity, model, serial number, number of sub-partitions, type, and firmware version information. she does it all, fr fr π
and the family tree? this class inherits from QObject. so she's got Qt blood in her veins π
π PUBLIC SLOTS π
these are the slots, bestie. nine of them. every single one is const, because she's not about to change anything, she's just here to report the tea π
π QStringList getDiskList () const
Get the list of all disks. the whole roster. the full lineup β¨
Return value:
QStringListβ list of disks, where each string represents the absolute path of a disk. yes, absolute. the full path. no shortcuts.
π unsigned int getDiskSectorSize (const QString diskname) const
Get the number of bytes per sector of the disk. tiny units, big importance π«
Parameters:
disknameβ specify the disk name, and it should be an absolute path such as/dev/sda
Return value:
unsigned intβ number of bytes per sector
π double getDiskTotalSizeMiB (const QString diskname) const
Get the disk capacity. how much room she's got π
Parameters:
disknameβ specify the disk name, and it should be an absolute path such as/dev/sda
Return value:
doubleβ disk capacity in MiB
π QString getDiskModel (const QString diskname) const
Get the disk model. who is she. what's her name π
Parameters:
disknameβ specify the disk name, and it should be an absolute path such as/dev/sda
Return value:
QStringβ disk model
π QString getDiskSerial (const QString diskname) const
Get the disk serial number. her government name, basically π
Parameters:
disknameβ specify the disk name, and it should be an absolute path such as/dev/sda
Return value:
QStringβ disk serial number
π unsigned int getDiskPartitionNums (const QString diskname) const
Get the number of sub-partitions under the disk/partition. yes, partitions can have partitions, it's giving nesting dolls πͺ
Parameters:
disknameβ specify the disk name, and it should be an absolute path such as/dev/sda
Return value:
unsigned intβ number of sub-partitions under this disk/partition
π QString getDiskType (const QString diskname) const
Get the disk type. is she a vibe or is she a vibe πΈ
Parameters:
disknameβ specify the disk name, and it should be an absolute path such as/dev/sda
Return value:
QStringβ disk type:SSDorHDDorHybrid
π QString getDiskVersion (const QString diskname) const
Get the disk firmware version information. the software inside the hardware, very meta β
Parameters:
disknameβ specify the disk name, and it should be an absolute path such as/dev/sda
Return value:
QStringβ firmware version information
π unsigned long long getDiskSectorNum (const QString diskname) const
Get the number of disk sectors. huge number energy, she's a unsigned long long for a reason π₯
Parameters:
disknameβ specify the disk name, and it should be an absolute path such as/dev/sda
Return value:
unsigned long longβ number of sectors
π EXAMPLE USAGE π
here's the moment you've been waiting for, bestie. a whole working main() that just uses the thing:
#include <kysdkdbus.h>
#include <QCoreApplication>
int main(int argc, char *argv[])
{
QCoreApplication app(argc, argv);
KySdkDisk diskInfo;
// Get disk list
QStringList disks = diskInfo.getDiskList();
// Get information of the first disk
if (!disks.isEmpty()) {
QString diskName = disks.first();
QString model = diskInfo.getDiskModel(diskName);
double size = diskInfo.getDiskTotalSizeMiB(diskName);
// ... use other methods
}
return 0;
}
see how she grabs the list, checks it's not empty, then pulls the model and the size off the first disk? clean. simple. ate and left no crumbs πβ¨
π«Ά SEE ALSO π«Ά
QObject(3qt5)D-Bus(1)libkyfilewatcher(3)
go read those too, iykyk π
π AUTHOR π
Generated automatically by Doxygen for kysdkdbus.h from the source code. so like, no human author to thank here, it's just Doxygen doing Doxygen things, and honestly? respect the hustle π€β¨
and that's the whole page, bestie!! version 1.0, dated Wed Sep 20 2023, from the Disk Information D-Bus Library. go forth and query your disks, you absolute main character ππ
π¦ where this page comes from
- arch rolling: libkysdk-system 3.0.1.4-1 Β· LGPL-3.0-or-later AND LGPL-2.1-only OR LGPL-3.0-only AND LGPL-2.1-only WITH Qt-LGPL-exception-1.1 OR LGPL-3.0-only WITH Qt-LGPL-exception-1.1 AND MIT
- ubuntu resolute: libkysdk-system-dev 3.0.1.2-0ubuntu1 Β· LGPL-3.0-only
- ubuntu stonking: libkysdk-system-dev 3.0.1.3-0ubuntu1 Β· LGPL-3.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms