Commit 58233848 authored by Han-Wen Nienhuys's avatar Han-Wen Nienhuys

Move StatfsOut and Kstatfs to raw.

parent 75c95c33
...@@ -12,6 +12,8 @@ import ( ...@@ -12,6 +12,8 @@ import (
"path/filepath" "path/filepath"
"syscall" "syscall"
"time" "time"
"github.com/hanwen/go-fuse/raw"
) )
var _ = fmt.Println var _ = fmt.Println
...@@ -187,7 +189,7 @@ func (me *LoopbackFileSystem) StatFs(name string) *StatfsOut { ...@@ -187,7 +189,7 @@ func (me *LoopbackFileSystem) StatFs(name string) *StatfsOut {
err := syscall.Statfs(me.GetPath(name), &s) err := syscall.Statfs(me.GetPath(name), &s)
if err == nil { if err == nil {
return &StatfsOut{ return &StatfsOut{
Kstatfs{ raw.Kstatfs{
Blocks: s.Blocks, Blocks: s.Blocks,
Bsize: uint32(s.Bsize), Bsize: uint32(s.Bsize),
Bfree: s.Bfree, Bfree: s.Bfree,
......
...@@ -41,13 +41,6 @@ func (me *ReadIn) String() string { ...@@ -41,13 +41,6 @@ func (me *ReadIn) String() string {
raw.FlagString(raw.OpenFlagNames, int(me.Flags), "RDONLY")) raw.FlagString(raw.OpenFlagNames, int(me.Flags), "RDONLY"))
} }
func (me *Kstatfs) String() string {
return fmt.Sprintf(
"{b%d f%d fs%d ff%d bs%d nl%d frs%d}",
me.Blocks, me.Bfree, me.Bavail, me.Files, me.Ffree,
me.Bsize, me.NameLen, me.Frsize)
}
func (me *WithFlags) String() string { func (me *WithFlags) String() string {
return fmt.Sprintf("File %s (%s) %s %s", return fmt.Sprintf("File %s (%s) %s %s",
me.File, me.Description, raw.FlagString(raw.OpenFlagNames, int(me.OpenFlags), "O_RDONLY"), me.File, me.Description, raw.FlagString(raw.OpenFlagNames, int(me.OpenFlags), "O_RDONLY"),
......
...@@ -48,18 +48,7 @@ type Owner raw.Owner ...@@ -48,18 +48,7 @@ type Owner raw.Owner
type Context raw.Context type Context raw.Context
type Kstatfs struct { type StatfsOut raw.StatfsOut
Blocks uint64
Bfree uint64
Bavail uint64
Files uint64
Ffree uint64
Bsize uint32
NameLen uint32
Frsize uint32
Padding uint32
Spare [6]uint32
}
const ( const (
READ_LOCKOWNER = (1 << 1) READ_LOCKOWNER = (1 << 1)
...@@ -90,10 +79,6 @@ type WriteIn struct { ...@@ -90,10 +79,6 @@ type WriteIn struct {
Padding uint32 Padding uint32
} }
type StatfsOut struct {
Kstatfs
}
type Dirent struct { type Dirent struct {
Ino uint64 Ino uint64
Off uint64 Off uint64
......
...@@ -196,3 +196,9 @@ func (me *CreateOut) String() string { ...@@ -196,3 +196,9 @@ func (me *CreateOut) String() string {
return fmt.Sprintf("{%v %v}", &me.EntryOut, &me.OpenOut) return fmt.Sprintf("{%v %v}", &me.EntryOut, &me.OpenOut)
} }
func (me *Kstatfs) String() string {
return fmt.Sprintf(
"{b%d f%d fs%d ff%d bs%d nl%d frs%d}",
me.Blocks, me.Bfree, me.Bavail, me.Files, me.Ffree,
me.Bsize, me.NameLen, me.Frsize)
}
...@@ -367,3 +367,21 @@ type InHeader struct { ...@@ -367,3 +367,21 @@ type InHeader struct {
Context Context
Padding uint32 Padding uint32
} }
type Kstatfs struct {
Blocks uint64
Bfree uint64
Bavail uint64
Files uint64
Ffree uint64
Bsize uint32
NameLen uint32
Frsize uint32
Padding uint32
Spare [6]uint32
}
type StatfsOut struct {
Kstatfs
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment