Comment:添加必要的注释

This commit is contained in:
xxxizum1kxxx
2025-12-02 19:57:33 +08:00
parent a4fc402efa
commit 9e6d354117

View File

@@ -14,6 +14,7 @@ type DiskInfo struct {
func Disk() DiskInfo { func Disk() DiskInfo {
diskinfo := DiskInfo{} diskinfo := DiskInfo{}
// 获取所有分区,使用 true 避免物理磁盘被 gopsutil 错误排除
usage, err := disk.Partitions(true) usage, err := disk.Partitions(true)
if err != nil { if err != nil {
diskinfo.Total = 0 diskinfo.Total = 0
@@ -107,7 +108,8 @@ func isPhysicalDisk(part disk.PartitionStat) bool {
} }
fstype := strings.ToLower(part.Fstype) fstype := strings.ToLower(part.Fstype)
// // 针对 Linux autofs它只是自动挂载的触发器真实文件系统会作为单独分区出现。
// 针对 Linux autofs排除自动挂载的 trigger真实文件系统会作为单独分区出现不会被排除。
// 将 autofs 视为“非物理磁盘”可以避免重复统计容量。 // 将 autofs 视为“非物理磁盘”可以避免重复统计容量。
if fstype == "autofs" && !strings.HasPrefix(part.Device, "/dev/") { if fstype == "autofs" && !strings.HasPrefix(part.Device, "/dev/") {
return false return false