LIBKYDISKINFO(3)
💖 libkydiskinfo(3) 💖
okay so bestie, welcome to libkydiskinfo — that's the ✨ Library Functions Manual ✨ page, section 3, the one you open when you wanna know literally everything about the disks in your machine. no cap, this library is your main character for hardware detective work. let's get into it 🫶
✨ NAME ✨
kdk_get_disklist, kdk_free_disklist, kdk_get_diskinfo, kdk_get_hard_disk, kdk_get_hard_disk_size, kdk_get_hard_fwrev, kdk_get_hard_type, kdk_get_hard_model, kdk_get_hard_serial, kdk_get_hard_vendor, kdk_free_diskinfo — 获取磁盘信息 (aka: go get that disk info, queen 👑)
so basically every one of these functions is about pulling disk facts out into the world. that's the whole vibe. that's the assignment. 💅
🌸 SYNOPSIS 🌸
#include <libkydiskinfo.h>
extern char** kdk_get_disklist();
extern void kdk_free_disklist(char** disklist);
extern kdk_diskinfo *kdk_get_diskinfo(const char *diskname);
extern char** kdk_get_hard_disk();
extern char* kdk_get_hard_disk_size(const char *hardname);
extern char* kdk_get_hard_fwrev(const char *hardname);
extern char* kdk_get_hard_type(const char *hardname);
extern char* kdk_get_hard_model(const char *hardname);
extern char* kdk_get_hard_serial(const char *hardname);
extern char* kdk_get_hard_vendor(const char *hardname);
extern void kdk_free_diskinfo(kdk_diskinfo *disk);
Link with -lkydiskinfo.
🚨 friendly reminder bestie: Link with -lkydiskinfo. — if you forget that flag your linker is gonna ghost you and you'll be sitting there like 😭
💫 Detailed Description 💫
This library contains disk information.
like. that's it. that's the description. short, sweet, and honestly? iconic. it does exactly what it says on the tin — it hands you the tea on your disks. 🍓
🎀 DATA STRUCTURES 🎀
Structure kdk_diskinfo contains information related to a disk:
typedef struct _kdk_diskinfo {
char *name; // 绝对路径
char *vendor; // 制造商
char *model; // 型号
char *serial; // 序列号
kdk_disk_type disk_type; // 磁盘类型,固态 or 机械 or 混合
kdk_disk_interface_type inter_type; // 接口类型
unsigned int rpm; // 转速,注意固态是没有转速概念的
unsigned long long sectors_num; // 扇区数量
unsigned int sector_size; // 每个扇区的字节数
float total_size_MiB; // 磁盘容量,MiB为单位
unsigned int partition_nums; // 该磁盘/分区下的子分区数量
char *uuid; // UUID
short mounted; // 是否已挂载
char *mount_path; // 挂载路径
kdk_disk_format format; // 格式化类型
kdk_disk_partition_type part_type; // 分区类型
char *fwrev; //固件版本信息
}kdk_diskinfo;
There are other members not documented here, which are only meant for libkydiskinfo internal use.
🙈 yes bestie, there are secret fields. they're for libkydiskinfo internal use only — do not poke them, they're not your business, they're giving private story energy. 💀
⭐ RETURN VALUE ⭐
The return value is generally specific to the individual function called.
ngl that's the whole thing — every function does its own thing with its return, so go check the one you're actually calling. no universal answer, no shortcuts. periodt. 💅
🌈 CONFORMING TO 🌈
These functions are as per the withdrawn POSIX.1e draft specification.
and the Linux extensions in the house are: kdk_get_disklist(), kdk_get_diskinfo(), kdk_get_hard_disk(), and kdk_get_hard_disk_size(). ✨ those four are the Linux-only girlies, iykyk.
🦋 SEE ALSO 🦋
kdk_free_disklist(3)kdk_get_diskinfo(3)kdk_free_diskinfo(3)kdk_get_disklist(3)
okay that's the whole page, bestie, you ate it 🫶 this was the Linux Programmer's Manual, dated Thu Aug 10 2023, and the page itself is LIBKYDISKINFO(3). now go read some disks. slay. 💖✨🎀
📦 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