small refactor*
This commit is contained in:
parent
b6b541e050
commit
24a4d30275
232 changed files with 2164 additions and 1906 deletions
server/pkg/go-nfs/file
24
server/pkg/go-nfs/file/file_unix.go
Normal file
24
server/pkg/go-nfs/file/file_unix.go
Normal file
|
@ -0,0 +1,24 @@
|
|||
//go:build darwin || dragonfly || freebsd || linux || nacl || netbsd || openbsd || solaris
|
||||
|
||||
package file
|
||||
|
||||
import (
|
||||
"os"
|
||||
"syscall"
|
||||
|
||||
"golang.org/x/sys/unix"
|
||||
)
|
||||
|
||||
func getInfo(info os.FileInfo) *FileInfo {
|
||||
fi := &FileInfo{}
|
||||
if s, ok := info.Sys().(*syscall.Stat_t); ok {
|
||||
fi.Nlink = uint32(s.Nlink)
|
||||
fi.UID = s.Uid
|
||||
fi.GID = s.Gid
|
||||
fi.Major = unix.Major(uint64(s.Rdev))
|
||||
fi.Minor = unix.Minor(uint64(s.Rdev))
|
||||
fi.Fileid = s.Ino
|
||||
return fi
|
||||
}
|
||||
return nil
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue