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

Remove fuse.Version().

Versions have to integrate with the build/version control system,
which the go tool does not provide.
parent 92507a54
#!/bin/sh
set -eux
sh genversion.sh fuse/version.gen.go
for target in "clean" "install" ; do
for d in fuse fuse/pathfs fuse/test zipfs unionfs \
example/hello example/loopback example/zipfs \
......
......@@ -13,7 +13,6 @@ import (
)
func main() {
version := flag.Bool("version", false, "print version number")
debug := flag.Bool("debug", false, "debug on")
hardlinks := flag.Bool("hardlinks", false, "support hardlinks")
delcache_ttl := flag.Float64("deletion_cache_ttl", 5.0, "Deletion cache TTL in seconds.")
......@@ -28,11 +27,6 @@ func main() {
flag.Parse()
if *version {
fmt.Println(fuse.Version())
os.Exit(0)
}
if len(flag.Args()) < 2 {
fmt.Println("Usage:\n main MOUNTPOINT BASEDIR")
os.Exit(2)
......@@ -59,7 +53,6 @@ func main() {
fsOpts := nodefs.Options{
PortableInodes: *portableInodes,
}
fmt.Printf("AutoUnionFs - Go-FUSE Version %v.\n", fuse.Version())
gofs := unionfs.NewAutoUnionFs(flag.Arg(1), options)
pathfs := pathfs.NewPathNodeFs(gofs, nil)
state, conn, err := nodefs.MountFileSystem(flag.Arg(0), pathfs, &fsOpts)
......
......@@ -65,13 +65,6 @@ func toSlice(dest *[]byte, ptr unsafe.Pointer, byteCount uintptr) {
*h = reflect.SliceHeader{uintptr(ptr), int(byteCount), int(byteCount)}
}
func Version() string {
if version != nil {
return *version
}
return "unknown"
}
func CurrentOwner() *Owner {
return &Owner{
Uid: uint32(os.Getuid()),
......
package fuse
// Autogenerated .go file can set this to a version string in its
// init() file.
var version *string
......@@ -50,6 +50,9 @@ type AutoUnionFsOptions struct {
// If set hides the _READONLY file.
HideReadonly bool
// Expose this version in /status/gounionfs_version
Version string
}
const (
......@@ -324,7 +327,7 @@ func (fs *autoUnionFs) GetAttr(path string, context *fuse.Context) (*fuse.Attr,
if path == filepath.Join(_STATUS, _VERSION) {
a := &fuse.Attr{
Mode: fuse.S_IFREG | 0644,
Size: uint64(len(fuse.Version())),
Size: uint64(len(fs.options.Version)),
}
return a, fuse.OK
}
......@@ -391,7 +394,7 @@ func (fs *autoUnionFs) DebugData() string {
"Version: %v\n"+
"Bufferpool: %v\n"+
"Kernel: %v\n",
fuse.Version(),
fs.options.Version,
conn.Server().DebugData(),
&setting)
......@@ -414,7 +417,7 @@ func (fs *autoUnionFs) Open(path string, flags uint32, context *fuse.Context) (n
if flags&fuse.O_ANYWRITE != 0 {
return nil, fuse.EPERM
}
return nodefs.NewDataFile([]byte(fuse.Version())), fuse.OK
return nodefs.NewDataFile([]byte(fs.options.Version)), fuse.OK
}
if path == filepath.Join(_CONFIG, _SCAN_CONFIG) {
if flags&fuse.O_ANYWRITE != 0 {
......
......@@ -22,6 +22,7 @@ var testAOpts = AutoUnionFsOptions{
NegativeTimeout: 0,
},
HideReadonly: true,
Version: "version",
}
func WriteFile(t *testing.T, name string, contents string) {
......
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