Skip to content

Commit

Permalink
ufs: fix command
Browse files Browse the repository at this point in the history
Based on NewServer rather than NewUFS.
  • Loading branch information
jcrussell committed Jun 12, 2018
1 parent 0595326 commit 3042477
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions cmd/ufs/ufs.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ import (
var (
ntype = flag.String("ntype", "tcp4", "Default network type")
naddr = flag.String("addr", ":5640", "Network address")
root = flag.String("root", "/", "filesystem root")
debug = flag.Bool("debug", false, "enable debug messages")
)

func main() {
Expand All @@ -26,8 +28,24 @@ func main() {
log.Fatalf("Listen failed: %v", err)
}

s, err := ufs.NewUFS(func(s *protocol.Server) error {
s.Trace = nil // log.Printf
fs, err := ufs.NewServer(ufs.Root(*root), func(fs *ufs.FileServer) error {
if *debug {
return ufs.Trace(log.Printf)(fs)
}

return nil
})

var ninefs protocol.NineServer = fs
if *debug {
ninefs = fs.Debug()
}

s, err := protocol.NewServer(ninefs, func(s *protocol.Server) error {
if *debug {
s.Trace = log.Printf
}

return nil
})

Expand Down

0 comments on commit 3042477

Please sign in to comment.