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

Add memfs example binary.

parent f4c835e5
# Use "gomake install" to build and install this package.
include $(GOROOT)/src/Make.inc
TARG=memfs
GOFILES=main.go
DEPS=../../fuse
include $(GOROOT)/src/Make.cmd
// Mounts MemNodeFs for testing purposes.
package main
import (
"flag"
"fmt"
"github.com/hanwen/go-fuse/fuse"
"log"
"os"
"runtime"
)
var _ = runtime.GOMAXPROCS
var _ = log.Print
func main() {
// Scans the arg list and sets up flags
debug := flag.Bool("debug", false, "print debugging messages.")
flag.Parse()
if flag.NArg() < 2 {
// TODO - where to get program name?
fmt.Println("usage: main MOUNTPOINT BACKING-PREFIX")
os.Exit(2)
}
mountPoint := flag.Arg(0)
prefix := flag.Arg(1)
fs := fuse.NewMemNodeFs(prefix)
conn := fuse.NewFileSystemConnector(fs, nil)
state := fuse.NewMountState(conn)
state.Debug = *debug
fmt.Println("Mounting")
err := state.Mount(mountPoint, nil)
if err != nil {
fmt.Printf("Mount fail: %v\n", err)
os.Exit(1)
}
fmt.Println("Mounted!")
state.Loop()
}
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