github.com/NVIDIA/aistore@v1.3.23-0.20240517131212-7df6609be51d/ios/utils.go (about) 1 // Package ios is a collection of interfaces to the local storage subsystem; 2 // the package includes OS-dependent implementations for those interfaces. 3 /* 4 * Copyright (c) 2018-2021, NVIDIA CORPORATION. All rights reserved. 5 */ 6 package ios 7 8 import "os" 9 10 func FinfoAtime(fqn string) (finfo os.FileInfo, atime int64, err error) { 11 if finfo, err = os.Stat(fqn); err != nil { 12 return 13 } 14 atime = GetATime(finfo).UnixNano() 15 return 16 } 17 18 func GetFSUsedPercentage(path string) (usedPercentage int64, ok bool) { 19 totalBlocks, blocksAvailable, _, err := GetFSStats(path) 20 if err != nil { 21 return 22 } 23 usedBlocks := totalBlocks - blocksAvailable 24 return int64(usedBlocks * 100 / totalBlocks), true 25 }