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
Kirill Smelkov
go-fuse
Commits
3c0c2f7e
Commit
3c0c2f7e
authored
Jun 23, 2013
by
Han-Wen Nienhuys
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix zipfs and unionfs for pathfs.NewDefaultFileSystem() API change.
parent
5c9096d6
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
26 additions
and
20 deletions
+26
-20
example/hello/main.go
example/hello/main.go
+2
-2
example/zipfs/main.go
example/zipfs/main.go
+0
-2
unionfs/autounion.go
unionfs/autounion.go
+8
-5
unionfs/unionfs.go
unionfs/unionfs.go
+6
-4
unionfs/unionfs_test.go
unionfs/unionfs_test.go
+4
-3
zipfs/multizip.go
zipfs/multizip.go
+6
-4
No files found.
example/hello/main.go
View file @
3c0c2f7e
...
@@ -11,7 +11,7 @@ import (
...
@@ -11,7 +11,7 @@ import (
)
)
type
HelloFs
struct
{
type
HelloFs
struct
{
pathfs
.
Default
FileSystem
pathfs
.
FileSystem
}
}
func
(
me
*
HelloFs
)
GetAttr
(
name
string
,
context
*
fuse
.
Context
)
(
*
fuse
.
Attr
,
fuse
.
Status
)
{
func
(
me
*
HelloFs
)
GetAttr
(
name
string
,
context
*
fuse
.
Context
)
(
*
fuse
.
Attr
,
fuse
.
Status
)
{
...
@@ -51,7 +51,7 @@ func main() {
...
@@ -51,7 +51,7 @@ func main() {
if
len
(
flag
.
Args
())
<
1
{
if
len
(
flag
.
Args
())
<
1
{
log
.
Fatal
(
"Usage:
\n
hello MOUNTPOINT"
)
log
.
Fatal
(
"Usage:
\n
hello MOUNTPOINT"
)
}
}
nfs
:=
pathfs
.
NewPathNodeFs
(
&
HelloFs
{},
nil
)
nfs
:=
pathfs
.
NewPathNodeFs
(
&
HelloFs
{
FileSystem
:
pathfs
.
NewDefaultFileSystem
()
},
nil
)
state
,
_
,
err
:=
fuse
.
MountNodeFileSystem
(
flag
.
Arg
(
0
),
nfs
,
nil
)
state
,
_
,
err
:=
fuse
.
MountNodeFileSystem
(
flag
.
Arg
(
0
),
nfs
,
nil
)
if
err
!=
nil
{
if
err
!=
nil
{
log
.
Fatal
(
"Mount fail: %v
\n
"
,
err
)
log
.
Fatal
(
"Mount fail: %v
\n
"
,
err
)
...
...
example/zipfs/main.go
View file @
3c0c2f7e
...
@@ -20,7 +20,6 @@ var _ = log.Printf
...
@@ -20,7 +20,6 @@ var _ = log.Printf
func
main
()
{
func
main
()
{
// Scans the arg list and sets up flags
// Scans the arg list and sets up flags
debug
:=
flag
.
Bool
(
"debug"
,
false
,
"print debugging messages."
)
debug
:=
flag
.
Bool
(
"debug"
,
false
,
"print debugging messages."
)
latencies
:=
flag
.
Bool
(
"latencies"
,
false
,
"record operation latencies."
)
profile
:=
flag
.
String
(
"profile"
,
""
,
"record cpu profile."
)
profile
:=
flag
.
String
(
"profile"
,
""
,
"record cpu profile."
)
mem_profile
:=
flag
.
String
(
"mem-profile"
,
""
,
"record memory profile."
)
mem_profile
:=
flag
.
String
(
"mem-profile"
,
""
,
"record memory profile."
)
command
:=
flag
.
String
(
"run"
,
""
,
"run this command after mounting."
)
command
:=
flag
.
String
(
"run"
,
""
,
"run this command after mounting."
)
...
@@ -63,7 +62,6 @@ func main() {
...
@@ -63,7 +62,6 @@ func main() {
os
.
Exit
(
1
)
os
.
Exit
(
1
)
}
}
state
.
SetRecordStatistics
(
*
latencies
)
state
.
SetDebug
(
*
debug
)
state
.
SetDebug
(
*
debug
)
runtime
.
GC
()
runtime
.
GC
()
if
profFile
!=
nil
{
if
profFile
!=
nil
{
...
...
unionfs/autounion.go
View file @
3c0c2f7e
...
@@ -26,7 +26,7 @@ type knownFs struct {
...
@@ -26,7 +26,7 @@ type knownFs struct {
//
//
// A union for A/B/C will placed under directory A-B-C.
// A union for A/B/C will placed under directory A-B-C.
type
AutoUnionFs
struct
{
type
AutoUnionFs
struct
{
pathfs
.
Default
FileSystem
pathfs
.
FileSystem
debug
bool
debug
bool
lock
sync
.
RWMutex
lock
sync
.
RWMutex
...
@@ -68,10 +68,13 @@ func NewAutoUnionFs(directory string, options AutoUnionFsOptions) *AutoUnionFs {
...
@@ -68,10 +68,13 @@ func NewAutoUnionFs(directory string, options AutoUnionFsOptions) *AutoUnionFs {
if
options
.
HideReadonly
{
if
options
.
HideReadonly
{
options
.
HiddenFiles
=
append
(
options
.
HiddenFiles
,
_READONLY
)
options
.
HiddenFiles
=
append
(
options
.
HiddenFiles
,
_READONLY
)
}
}
a
:=
new
(
AutoUnionFs
)
a
:=
&
AutoUnionFs
{
a
.
knownFileSystems
=
make
(
map
[
string
]
knownFs
)
knownFileSystems
:
make
(
map
[
string
]
knownFs
),
a
.
nameRootMap
=
make
(
map
[
string
]
string
)
nameRootMap
:
make
(
map
[
string
]
string
),
a
.
options
=
&
options
options
:
&
options
,
FileSystem
:
pathfs
.
NewDefaultFileSystem
(),
}
directory
,
err
:=
filepath
.
Abs
(
directory
)
directory
,
err
:=
filepath
.
Abs
(
directory
)
if
err
!=
nil
{
if
err
!=
nil
{
panic
(
"filepath.Abs returned err"
)
panic
(
"filepath.Abs returned err"
)
...
...
unionfs/unionfs.go
View file @
3c0c2f7e
...
@@ -57,7 +57,7 @@ func filePathHash(path string) string {
...
@@ -57,7 +57,7 @@ func filePathHash(path string) string {
*/
*/
type
UnionFs
struct
{
type
UnionFs
struct
{
pathfs
.
Default
FileSystem
pathfs
.
FileSystem
// The same, but as interfaces.
// The same, but as interfaces.
fileSystems
[]
pathfs
.
FileSystem
fileSystems
[]
pathfs
.
FileSystem
...
@@ -87,9 +87,11 @@ const (
...
@@ -87,9 +87,11 @@ const (
)
)
func
NewUnionFs
(
fileSystems
[]
pathfs
.
FileSystem
,
options
UnionFsOptions
)
*
UnionFs
{
func
NewUnionFs
(
fileSystems
[]
pathfs
.
FileSystem
,
options
UnionFsOptions
)
*
UnionFs
{
g
:=
new
(
UnionFs
)
g
:=
&
UnionFs
{
g
.
options
=
&
options
options
:
&
options
,
g
.
fileSystems
=
fileSystems
fileSystems
:
fileSystems
,
FileSystem
:
pathfs
.
NewDefaultFileSystem
(),
}
writable
:=
g
.
fileSystems
[
0
]
writable
:=
g
.
fileSystems
[
0
]
code
:=
g
.
createDeletionStore
()
code
:=
g
.
createDeletionStore
()
...
...
unionfs/unionfs_test.go
View file @
3c0c2f7e
...
@@ -1135,8 +1135,9 @@ func TestUnionFsDisappearing(t *testing.T) {
...
@@ -1135,8 +1135,9 @@ func TestUnionFsDisappearing(t *testing.T) {
}
}
state
.
ThreadSanitizerSync
()
state
.
ThreadSanitizerSync
()
oldRoot
:=
wrFs
.
Root
// TODO - this is racy. Instead, have a custom FS that will
wrFs
.
Root
=
"/dev/null"
// switch based on input from a channel
fses
[
0
]
=
pathfs
.
NewLoopbackFileSystem
(
"/dev/null"
)
state
.
ThreadSanitizerSync
()
state
.
ThreadSanitizerSync
()
time
.
Sleep
((
3
*
entryTtl
)
/
2
)
time
.
Sleep
((
3
*
entryTtl
)
/
2
)
...
@@ -1153,7 +1154,7 @@ func TestUnionFsDisappearing(t *testing.T) {
...
@@ -1153,7 +1154,7 @@ func TestUnionFsDisappearing(t *testing.T) {
log
.
Println
(
"expected write failure:"
,
err
)
log
.
Println
(
"expected write failure:"
,
err
)
// Restore, and wait for caches to catch up.
// Restore, and wait for caches to catch up.
wrFs
.
Root
=
oldRoot
fses
[
0
]
=
pathfs
.
NewLoopbackFileSystem
(
wd
+
"/rw"
)
state
.
ThreadSanitizerSync
()
state
.
ThreadSanitizerSync
()
time
.
Sleep
((
3
*
entryTtl
)
/
2
)
time
.
Sleep
((
3
*
entryTtl
)
/
2
)
...
...
zipfs/multizip.go
View file @
3c0c2f7e
...
@@ -35,13 +35,15 @@ type MultiZipFs struct {
...
@@ -35,13 +35,15 @@ type MultiZipFs struct {
dirZipFileMap
map
[
string
]
string
dirZipFileMap
map
[
string
]
string
nodeFs
*
pathfs
.
PathNodeFs
nodeFs
*
pathfs
.
PathNodeFs
pathfs
.
Default
FileSystem
pathfs
.
FileSystem
}
}
func
NewMultiZipFs
()
*
MultiZipFs
{
func
NewMultiZipFs
()
*
MultiZipFs
{
m
:=
new
(
MultiZipFs
)
m
:=
&
MultiZipFs
{
m
.
zips
=
make
(
map
[
string
]
*
MemTreeFs
)
zips
:
make
(
map
[
string
]
*
MemTreeFs
),
m
.
dirZipFileMap
=
make
(
map
[
string
]
string
)
dirZipFileMap
:
make
(
map
[
string
]
string
),
FileSystem
:
pathfs
.
NewDefaultFileSystem
(),
}
return
m
return
m
}
}
...
...
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