rclone/vendor/github.com/pkg/sftp/server_statvfs_impl.go

26 lines
535 B
Go
Raw Normal View History

2018-03-19 16:51:38 +01:00
// +build darwin linux
2016-11-13 01:04:55 +01:00
// fill in statvfs structure with OS specific values
// Statfs_t is different per-kernel, and only exists on some unixes (not Solaris for instance)
package sftp
import (
"syscall"
)
func (p sshFxpExtendedPacketStatVFS) respond(svr *Server) responsePacket {
2016-11-13 01:04:55 +01:00
stat := &syscall.Statfs_t{}
if err := syscall.Statfs(p.Path, stat); err != nil {
return statusFromError(p, err)
2016-11-13 01:04:55 +01:00
}
retPkt, err := statvfsFromStatfst(stat)
if err != nil {
return statusFromError(p, err)
2016-11-13 01:04:55 +01:00
}
retPkt.ID = p.ID
return retPkt
2016-11-13 01:04:55 +01:00
}