mirror of
https://github.com/ipfs/kubo.git
synced 2025-06-27 16:07:42 +08:00
added fuseversion for osxfuse
This commit is contained in:
4
Godeps/Godeps.json
generated
4
Godeps/Godeps.json
generated
@ -108,6 +108,10 @@
|
|||||||
"ImportPath": "github.com/jbenet/go-datastore",
|
"ImportPath": "github.com/jbenet/go-datastore",
|
||||||
"Rev": "6a1c83bda2a71a9bdc936749fdb507df958ed949"
|
"Rev": "6a1c83bda2a71a9bdc936749fdb507df958ed949"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"ImportPath": "github.com/jbenet/go-fuse-version",
|
||||||
|
"Rev": "ff72c39433f95ada15f116fa493a51eeec2bd52e"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "github.com/jbenet/go-is-domain",
|
"ImportPath": "github.com/jbenet/go-is-domain",
|
||||||
"Rev": "93b717f2ae17838a265e30277275ee99ee7198d6"
|
"Rev": "93b717f2ae17838a265e30277275ee99ee7198d6"
|
||||||
|
45
Godeps/_workspace/src/github.com/jbenet/go-fuse-version/README.md
generated
vendored
Normal file
45
Godeps/_workspace/src/github.com/jbenet/go-fuse-version/README.md
generated
vendored
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
# go-fuse-version
|
||||||
|
|
||||||
|
Simple package to get the user's FUSE libraries information.
|
||||||
|
|
||||||
|
- Godoc: https://godoc.org/github.com/jbenet/go-fuse-version
|
||||||
|
|
||||||
|
**Warning** Currently only supports OSXFUSE. if you want more, add them, it's really trivial now.
|
||||||
|
|
||||||
|
## Example
|
||||||
|
|
||||||
|
```Go
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
|
||||||
|
fuseversion "github.com/jbenet/go-fuse-version"
|
||||||
|
)
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
sys, err := fuseversion.LocalFuseSystems()
|
||||||
|
if err != nil {
|
||||||
|
fmt.Fprintf(os.Stderr, "%s\n", err)
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
|
|
||||||
|
fmt.Printf("FuseVersion, AgentVersion, Agent\n")
|
||||||
|
for _, s := range *sys {
|
||||||
|
fmt.Printf("%s, %s, %s\n", s.FuseVersion, s.AgentVersion, s.AgentName)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## fuseprint
|
||||||
|
|
||||||
|
If you dont use Go, you can also install the example as the silly util fuseprint:
|
||||||
|
|
||||||
|
```
|
||||||
|
> go get github.com/jbenet/go-fuse-version/fuseprint
|
||||||
|
> go install github.com/jbenet/go-fuse-version/fuseprint
|
||||||
|
> fuseprint
|
||||||
|
FuseVersion, AgentVersion, Agent
|
||||||
|
27, 2.7.2, OSXFUSE
|
||||||
|
```
|
1
Godeps/_workspace/src/github.com/jbenet/go-fuse-version/fuseprint/.gitignore
generated
vendored
Normal file
1
Godeps/_workspace/src/github.com/jbenet/go-fuse-version/fuseprint/.gitignore
generated
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
fuseprint
|
1
Godeps/_workspace/src/github.com/jbenet/go-fuse-version/fuseprint/README.md
generated
vendored
Symbolic link
1
Godeps/_workspace/src/github.com/jbenet/go-fuse-version/fuseprint/README.md
generated
vendored
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
../README.md
|
21
Godeps/_workspace/src/github.com/jbenet/go-fuse-version/fuseprint/index.go
generated
vendored
Normal file
21
Godeps/_workspace/src/github.com/jbenet/go-fuse-version/fuseprint/index.go
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
|
||||||
|
fuseversion "github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-fuse-version"
|
||||||
|
)
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
sys, err := fuseversion.LocalFuseSystems()
|
||||||
|
if err != nil {
|
||||||
|
fmt.Fprintf(os.Stderr, "%s\n", err)
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
|
|
||||||
|
fmt.Printf("FuseVersion, AgentVersion, Agent\n")
|
||||||
|
for _, s := range *sys {
|
||||||
|
fmt.Printf("%s, %s, %s\n", s.FuseVersion, s.AgentVersion, s.AgentName)
|
||||||
|
}
|
||||||
|
}
|
37
Godeps/_workspace/src/github.com/jbenet/go-fuse-version/version.go
generated
vendored
Normal file
37
Godeps/_workspace/src/github.com/jbenet/go-fuse-version/version.go
generated
vendored
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
// package fuseversion simply exposes the version of FUSE installed
|
||||||
|
// in the user's machine. For reasoning, see:
|
||||||
|
// - https://github.com/jbenet/go-ipfs/issues/177
|
||||||
|
// - https://github.com/jbenet/go-ipfs/issues/202
|
||||||
|
// - https://github.com/osxfuse/osxfuse/issues/175#issuecomment-61888505
|
||||||
|
package fuseversion
|
||||||
|
|
||||||
|
type Systems map[string]FuseSystem
|
||||||
|
|
||||||
|
type FuseSystem struct {
|
||||||
|
// FuseVersion is the version of the FUSE protocol
|
||||||
|
FuseVersion string
|
||||||
|
|
||||||
|
// AgentName identifies the system implementing FUSE, or Agent
|
||||||
|
AgentName string
|
||||||
|
|
||||||
|
// AgentVersion is the version of the Agent program
|
||||||
|
// (it fights for the user! Sometimes it fights the user...)
|
||||||
|
AgentVersion string
|
||||||
|
}
|
||||||
|
|
||||||
|
// LocalFuseSystems returns a map of FuseSystems, keyed by name.
|
||||||
|
// For example:
|
||||||
|
//
|
||||||
|
// systems := fuseversion.LocalFuseSystems()
|
||||||
|
// for n, sys := range systems {
|
||||||
|
// fmt.Printf("%s, %s, %s", n, sys.FuseVersion, sys.AgentVersion)
|
||||||
|
// }
|
||||||
|
// // Outputs:
|
||||||
|
// // OSXFUSE, , 2.7.2
|
||||||
|
//
|
||||||
|
func LocalFuseSystems() (*Systems, error) {
|
||||||
|
return getLocalFuseSystems() // implemented by each platform
|
||||||
|
}
|
||||||
|
|
||||||
|
var notImplYet = `Error: not implemented for %s yet. :(
|
||||||
|
Please do it: https://github.com/jbenet/go-fuse-version`
|
11
Godeps/_workspace/src/github.com/jbenet/go-fuse-version/version_bsd.go
generated
vendored
Normal file
11
Godeps/_workspace/src/github.com/jbenet/go-fuse-version/version_bsd.go
generated
vendored
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
// +build dragonfly freebsd netbsd openbsd
|
||||||
|
|
||||||
|
package fuseversion
|
||||||
|
|
||||||
|
import (
|
||||||
|
"runtime"
|
||||||
|
)
|
||||||
|
|
||||||
|
func getLocalFuseSystems() (*Systems, error) {
|
||||||
|
return nil, fmt.Sprintf(notImplYet, runtime.GOARCH())
|
||||||
|
}
|
24
Godeps/_workspace/src/github.com/jbenet/go-fuse-version/version_darwin.go
generated
vendored
Normal file
24
Godeps/_workspace/src/github.com/jbenet/go-fuse-version/version_darwin.go
generated
vendored
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
package fuseversion
|
||||||
|
|
||||||
|
// #cgo CFLAGS: -I /usr/local/include/osxfuse/ -D_FILE_OFFSET_BITS=64 -DFUSE_USE_VERSION=25
|
||||||
|
// #cgo LDFLAGS: /usr/local/lib/libosxfuse.dylib
|
||||||
|
//
|
||||||
|
// #include <fuse/fuse.h>
|
||||||
|
// #include <fuse/fuse_common.h>
|
||||||
|
// #include <fuse/fuse_darwin.h>
|
||||||
|
import "C"
|
||||||
|
import "fmt"
|
||||||
|
|
||||||
|
func getLocalFuseSystems() (*Systems, error) {
|
||||||
|
sys := Systems{}
|
||||||
|
sys["OSXFUSE"] = getOSXFUSE()
|
||||||
|
return &sys, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func getOSXFUSE() FuseSystem {
|
||||||
|
return FuseSystem{
|
||||||
|
FuseVersion: fmt.Sprintf("%d", int(C.fuse_version())),
|
||||||
|
AgentName: "OSXFUSE",
|
||||||
|
AgentVersion: C.GoString(C.osxfuse_version()),
|
||||||
|
}
|
||||||
|
}
|
9
Godeps/_workspace/src/github.com/jbenet/go-fuse-version/version_linux.go
generated
vendored
Normal file
9
Godeps/_workspace/src/github.com/jbenet/go-fuse-version/version_linux.go
generated
vendored
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
package fuseversion
|
||||||
|
|
||||||
|
import (
|
||||||
|
"runtime"
|
||||||
|
)
|
||||||
|
|
||||||
|
func getLocalFuseSystems() (*Systems, error) {
|
||||||
|
return nil, fmt.Sprintf(notImplYet, runtime.GOARCH())
|
||||||
|
}
|
9
Godeps/_workspace/src/github.com/jbenet/go-fuse-version/version_windows.go
generated
vendored
Normal file
9
Godeps/_workspace/src/github.com/jbenet/go-fuse-version/version_windows.go
generated
vendored
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
package fuseversion
|
||||||
|
|
||||||
|
import (
|
||||||
|
"runtime"
|
||||||
|
)
|
||||||
|
|
||||||
|
func getLocalFuseSystems() (*Systems, error) {
|
||||||
|
return nil, fmt.Sprintf(notImplYet, runtime.GOARCH())
|
||||||
|
}
|
Reference in New Issue
Block a user