Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
go-fuse
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Levin Zimmermann
go-fuse
Commits
ba9f7973
Commit
ba9f7973
authored
May 28, 2012
by
Han-Wen Nienhuys
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Identify mounts by name rather than '/dev/fuse'.
parent
035be141
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
42 additions
and
2 deletions
+42
-2
fuse/api.go
fuse/api.go
+7
-1
fuse/defaultraw.go
fuse/defaultraw.go
+6
-0
fuse/fsops.go
fuse/fsops.go
+7
-0
fuse/mountstate.go
fuse/mountstate.go
+13
-0
zipfs/memtree.go
zipfs/memtree.go
+5
-0
zipfs/zipfs.go
zipfs/zipfs.go
+4
-1
No files found.
fuse/api.go
View file @
ba9f7973
...
...
@@ -254,6 +254,10 @@ type MountOptions struct {
// If RememberInodes is set, we will never forget inodes.
// This may be useful for NFS.
RememberInodes
bool
// The Name will show up on the output of the mount. Keep this string
// small.
Name
string
}
// DefaultFileSystem implements a FileSystem that returns ENOSYS for every operation.
...
...
@@ -271,6 +275,8 @@ type DefaultFile struct{}
//
// Include DefaultRawFileSystem to inherit a null implementation.
type
RawFileSystem
interface
{
String
()
string
Lookup
(
out
*
raw
.
EntryOut
,
header
*
raw
.
InHeader
,
name
string
)
(
status
Status
)
Forget
(
nodeid
,
nlookup
uint64
)
...
...
fuse/defaultraw.go
View file @
ba9f7973
...
...
@@ -2,6 +2,8 @@ package fuse
import
(
"github.com/hanwen/go-fuse/raw"
"os"
)
var
_
=
RawFileSystem
((
*
DefaultRawFileSystem
)(
nil
))
...
...
@@ -9,6 +11,10 @@ var _ = RawFileSystem((*DefaultRawFileSystem)(nil))
func
(
fs
*
DefaultRawFileSystem
)
Init
(
init
*
RawFsInit
)
{
}
func
(
fs
*
DefaultRawFileSystem
)
String
()
string
{
return
os
.
Args
[
0
]
}
func
(
fs
*
DefaultRawFileSystem
)
StatFs
(
out
*
StatfsOut
,
h
*
raw
.
InHeader
)
Status
{
return
ENOSYS
}
...
...
fuse/fsops.go
View file @
ba9f7973
...
...
@@ -12,6 +12,13 @@ import (
var
_
=
log
.
Println
func
(
c
*
FileSystemConnector
)
String
()
string
{
if
c
.
rootNode
==
nil
||
c
.
rootNode
.
mount
==
nil
{
return
"go-fuse:unmounted"
}
return
c
.
rootNode
.
mount
.
fs
.
String
()
}
func
(
c
*
FileSystemConnector
)
Init
(
fsInit
*
RawFsInit
)
{
c
.
fsInit
=
*
fsInit
}
...
...
fuse/mountstate.go
View file @
ba9f7973
...
...
@@ -55,6 +55,8 @@ func (ms *MountState) MountPoint() string {
return
ms
.
mountPoint
}
const
_MAX_NAME_LEN
=
20
// Mount filesystem on mountPoint.
func
(
ms
*
MountState
)
Mount
(
mountPoint
string
,
opts
*
MountOptions
)
error
{
if
opts
==
nil
{
...
...
@@ -83,6 +85,17 @@ func (ms *MountState) Mount(mountPoint string, opts *MountOptions) error {
optStrs
=
append
(
optStrs
,
"allow_other"
)
}
name
:=
opts
.
Name
if
name
==
""
{
name
=
ms
.
fileSystem
.
String
()
l
:=
len
(
name
)
if
l
>
_MAX_NAME_LEN
{
l
=
_MAX_NAME_LEN
}
name
=
strings
.
Replace
(
name
[
:
l
],
","
,
";"
,
-
1
)
}
optStrs
=
append
(
optStrs
,
"subtype="
+
name
)
file
,
mp
,
err
:=
mount
(
mountPoint
,
strings
.
Join
(
optStrs
,
","
))
if
err
!=
nil
{
return
err
...
...
zipfs/memtree.go
View file @
ba9f7973
...
...
@@ -23,6 +23,7 @@ type MemTreeFs struct {
fuse
.
DefaultNodeFileSystem
root
memNode
files
map
[
string
]
MemFile
Name
string
}
func
NewMemTreeFs
()
*
MemTreeFs
{
...
...
@@ -30,6 +31,10 @@ func NewMemTreeFs() *MemTreeFs {
return
d
}
func
(
fs
*
MemTreeFs
)
String
()
string
{
return
fs
.
Name
}
func
(
fs
*
MemTreeFs
)
OnMount
(
conn
*
fuse
.
FileSystemConnector
)
{
for
k
,
v
:=
range
fs
.
files
{
fs
.
addFile
(
k
,
v
)
...
...
zipfs/zipfs.go
View file @
ba9f7973
...
...
@@ -61,7 +61,10 @@ func NewZipTree(name string) (map[string]MemFile, error) {
}
func
NewArchiveFileSystem
(
name
string
)
(
mfs
*
MemTreeFs
,
err
error
)
{
mfs
=
&
MemTreeFs
{}
mfs
=
&
MemTreeFs
{
Name
:
fmt
.
Sprintf
(
"fs(%s)"
,
name
),
}
if
strings
.
HasSuffix
(
name
,
".zip"
)
{
mfs
.
files
,
err
=
NewZipTree
(
name
)
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment