mirror of
https://github.com/harivansh-afk/betterNAS.git
synced 2026-04-17 19:03:53 +00:00
Stabilize the node agent runtime loop.
Keep the NAS-side runtime bounded to the configured export path, make WebDAV and registration behavior env-driven, and add runtime coverage so the first storage loop can be verified locally. Generated with [Devin](https://cli.devin.ai/docs) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
parent
a7f85f4871
commit
273af4b0ab
14 changed files with 3294 additions and 36 deletions
23
apps/node-agent/internal/nodeagent/capacity_supported.go
Normal file
23
apps/node-agent/internal/nodeagent/capacity_supported.go
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
//go:build android || darwin || dragonfly || freebsd || illumos || ios || linux || netbsd || openbsd || solaris
|
||||
|
||||
package nodeagent
|
||||
|
||||
import (
|
||||
"math"
|
||||
"syscall"
|
||||
)
|
||||
|
||||
func detectCapacityBytes(path string) *int64 {
|
||||
var stats syscall.Statfs_t
|
||||
if err := syscall.Statfs(path, &stats); err != nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
capacity := uint64(stats.Blocks) * uint64(stats.Bsize)
|
||||
if capacity > math.MaxInt64 {
|
||||
return nil
|
||||
}
|
||||
|
||||
value := int64(capacity)
|
||||
return &value
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue