LIBKYDISKINFO(3)

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 - 获取磁盘信息

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.

Detailed Description
This library contains disk information.

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.

RETURN VALUE
The return value is generally specific to the individual function called.

CONFORMING TO
These functions are as per the withdrawn POSIX.1e draft specification. The following functions are Linux extensions: kdk_get_disklist(), kdk_get_diskinfo(), kdk_get_hard_disk(), and kdk_get_hard_disk_size().

SEE ALSO
kdk_free_disklist(3), kdk_get_diskinfo(3), kdk_free_diskinfo(3) kdk_get_disklist(3)