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
9fe49c6f
Commit
9fe49c6f
authored
Apr 29, 2011
by
Han-Wen Nienhuys
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Run Gofmt.
parent
e4dc4c71
Changes
14
Show whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
66 additions
and
63 deletions
+66
-63
example/autounionfs/main.go
example/autounionfs/main.go
+2
-2
example/bulkstat/bulkstat.go
example/bulkstat/bulkstat.go
+1
-1
example/loopback/loopback.go
example/loopback/loopback.go
+3
-3
example/zipfs/main.go
example/zipfs/main.go
+3
-3
fuse/fuse.go
fuse/fuse.go
+6
-6
fuse/opcode.go
fuse/opcode.go
+19
-19
fuse/pathfilesystem.go
fuse/pathfilesystem.go
+2
-2
fuse/pathops.go
fuse/pathops.go
+2
-1
fuse/types.go
fuse/types.go
+3
-3
unionfs/cachingfs.go
unionfs/cachingfs.go
+2
-0
unionfs/dircache.go
unionfs/dircache.go
+1
-1
unionfs/timedcache.go
unionfs/timedcache.go
+1
-1
unionfs/unionfs.go
unionfs/unionfs.go
+2
-2
unionfs/unionfs_test.go
unionfs/unionfs_test.go
+19
-19
No files found.
example/autounionfs/main.go
View file @
9fe49c6f
example/bulkstat/bulkstat.go
View file @
9fe49c6f
...
@@ -39,7 +39,7 @@ func main() {
...
@@ -39,7 +39,7 @@ func main() {
tot
:=
0.0
tot
:=
0.0
totalRuns
:=
*
runs
+
1
totalRuns
:=
*
runs
+
1
for
j
:=
0
;
j
<
totalRuns
;
j
++
{
for
j
:=
0
;
j
<
totalRuns
;
j
++
{
result
:=
BulkStat
(
*
threads
,
files
)
result
:=
BulkStat
(
*
threads
,
files
)
if
j
>
0
{
if
j
>
0
{
tot
+=
result
tot
+=
result
...
...
example/loopback/loopback.go
View file @
9fe49c6f
example/zipfs/main.go
View file @
9fe49c6f
fuse/fuse.go
View file @
9fe49c6f
fuse/opcode.go
View file @
9fe49c6f
...
@@ -430,7 +430,7 @@ func init() {
...
@@ -430,7 +430,7 @@ func init() {
operationHandlers
[
op
]
.
DecodeOut
=
f
operationHandlers
[
op
]
.
DecodeOut
=
f
}
}
for
op
,
count
:=
range
map
[
opcode
]
int
{
for
op
,
count
:=
range
map
[
opcode
]
int
{
FUSE_LOOKUP
:
1
,
FUSE_LOOKUP
:
1
,
FUSE_RENAME
:
2
,
FUSE_RENAME
:
2
,
FUSE_SYMLINK
:
2
,
FUSE_SYMLINK
:
2
,
...
...
fuse/pathfilesystem.go
View file @
9fe49c6f
fuse/pathops.go
View file @
9fe49c6f
...
@@ -8,6 +8,7 @@ import (
...
@@ -8,6 +8,7 @@ import (
"path/filepath"
"path/filepath"
"time"
"time"
)
)
var
_
=
fmt
.
Println
var
_
=
fmt
.
Println
func
NewFileSystemConnector
(
fs
FileSystem
,
opts
*
MountOptions
)
(
out
*
FileSystemConnector
)
{
func
NewFileSystemConnector
(
fs
FileSystem
,
opts
*
MountOptions
)
(
out
*
FileSystemConnector
)
{
...
@@ -147,7 +148,7 @@ func (me *FileSystemConnector) SetAttr(header *InHeader, input *SetAttrIn) (out
...
@@ -147,7 +148,7 @@ func (me *FileSystemConnector) SetAttr(header *InHeader, input *SetAttrIn) (out
if
input
.
Valid
&
FATTR_MODE
!=
0
{
if
input
.
Valid
&
FATTR_MODE
!=
0
{
permissionMask
:=
uint32
(
07777
)
permissionMask
:=
uint32
(
07777
)
err
=
mount
.
fs
.
Chmod
(
fullPath
,
input
.
Mode
&
permissionMask
)
err
=
mount
.
fs
.
Chmod
(
fullPath
,
input
.
Mode
&
permissionMask
)
}
}
if
err
==
OK
&&
(
input
.
Valid
&
FATTR_UID
!=
0
||
input
.
Valid
&
FATTR_GID
!=
0
)
{
if
err
==
OK
&&
(
input
.
Valid
&
FATTR_UID
!=
0
||
input
.
Valid
&
FATTR_GID
!=
0
)
{
// TODO - can we get just FATTR_GID but not FATTR_UID ?
// TODO - can we get just FATTR_GID but not FATTR_UID ?
...
...
fuse/types.go
View file @
9fe49c6f
unionfs/cachingfs.go
View file @
9fe49c6f
...
@@ -4,7 +4,9 @@ import (
...
@@ -4,7 +4,9 @@ import (
"fmt"
"fmt"
"github.com/hanwen/go-fuse/fuse"
"github.com/hanwen/go-fuse/fuse"
)
)
var
_
=
fmt
.
Println
var
_
=
fmt
.
Println
type
attrResponse
struct
{
type
attrResponse
struct
{
*
fuse
.
Attr
*
fuse
.
Attr
fuse
.
Status
fuse
.
Status
...
...
unionfs/dircache.go
View file @
9fe49c6f
unionfs/timedcache.go
View file @
9fe49c6f
unionfs/unionfs.go
View file @
9fe49c6f
...
@@ -154,7 +154,7 @@ func (me *UnionFs) getBranchAttrNoCache(name string) getBranchResult {
...
@@ -154,7 +154,7 @@ func (me *UnionFs) getBranchAttrNoCache(name string) getBranchResult {
a
,
s
:=
fs
.
GetAttr
(
name
)
a
,
s
:=
fs
.
GetAttr
(
name
)
if
s
==
fuse
.
OK
{
if
s
==
fuse
.
OK
{
if
a
.
Mode
&
fuse
.
S_IFDIR
!=
0
{
if
a
.
Mode
&
fuse
.
S_IFDIR
!=
0
{
// Make all directories appear writable
// Make all directories appear writable
a
.
Mode
|=
0200
a
.
Mode
|=
0200
}
}
...
@@ -383,7 +383,7 @@ func (me *UnionFs) Readlink(name string) (out string, code fuse.Status) {
...
@@ -383,7 +383,7 @@ func (me *UnionFs) Readlink(name string) (out string, code fuse.Status) {
func
IsDir
(
fs
fuse
.
FileSystem
,
name
string
)
bool
{
func
IsDir
(
fs
fuse
.
FileSystem
,
name
string
)
bool
{
a
,
code
:=
fs
.
GetAttr
(
name
)
a
,
code
:=
fs
.
GetAttr
(
name
)
return
code
==
fuse
.
OK
&&
a
.
Mode
&
fuse
.
S_IFDIR
!=
0
return
code
==
fuse
.
OK
&&
a
.
Mode
&
fuse
.
S_IFDIR
!=
0
}
}
func
(
me
*
UnionFs
)
makeDirTo
(
name
string
)
fuse
.
Status
{
func
(
me
*
UnionFs
)
makeDirTo
(
name
string
)
fuse
.
Status
{
...
...
unionfs/unionfs_test.go
View file @
9fe49c6f
...
@@ -138,18 +138,18 @@ func TestChmod(t *testing.T) {
...
@@ -138,18 +138,18 @@ func TestChmod(t *testing.T) {
wd
,
state
:=
setup
(
t
)
wd
,
state
:=
setup
(
t
)
defer
state
.
Unmount
()
defer
state
.
Unmount
()
ro_fn
:=
wd
+
"/ro/file"
ro_fn
:=
wd
+
"/ro/file"
m_fn
:=
wd
+
"/mount/file"
m_fn
:=
wd
+
"/mount/file"
writeToFile
(
ro_fn
,
"a"
)
writeToFile
(
ro_fn
,
"a"
)
err
:=
os
.
Chmod
(
m_fn
,
07070
)
err
:=
os
.
Chmod
(
m_fn
,
07070
)
CheckSuccess
(
err
)
CheckSuccess
(
err
)
fi
,
err
:=
os
.
Lstat
(
m_fn
)
fi
,
err
:=
os
.
Lstat
(
m_fn
)
CheckSuccess
(
err
)
CheckSuccess
(
err
)
if
fi
.
Mode
&
07777
!=
07070
{
if
fi
.
Mode
&
07777
!=
07070
{
t
.
Errorf
(
"Unexpected mode found: %v"
,
fi
.
Mode
)
t
.
Errorf
(
"Unexpected mode found: %v"
,
fi
.
Mode
)
}
}
_
,
err
=
os
.
Lstat
(
wd
+
"/rw/file"
)
_
,
err
=
os
.
Lstat
(
wd
+
"/rw/file"
)
if
err
!=
nil
{
if
err
!=
nil
{
t
.
Errorf
(
"File not promoted"
)
t
.
Errorf
(
"File not promoted"
)
}
}
...
@@ -220,19 +220,19 @@ func TestPromote(t *testing.T) {
...
@@ -220,19 +220,19 @@ func TestPromote(t *testing.T) {
wd
,
state
:=
setup
(
t
)
wd
,
state
:=
setup
(
t
)
defer
state
.
Unmount
()
defer
state
.
Unmount
()
err
:=
os
.
Mkdir
(
wd
+
"/ro/subdir"
,
0755
)
err
:=
os
.
Mkdir
(
wd
+
"/ro/subdir"
,
0755
)
CheckSuccess
(
err
)
CheckSuccess
(
err
)
writeToFile
(
wd
+
"/ro/subdir/file"
,
"content"
)
writeToFile
(
wd
+
"/ro/subdir/file"
,
"content"
)
writeToFile
(
wd
+
"/mount/subdir/file"
,
"other-content"
)
writeToFile
(
wd
+
"/mount/subdir/file"
,
"other-content"
)
}
}
func
TestCreate
(
t
*
testing
.
T
)
{
func
TestCreate
(
t
*
testing
.
T
)
{
wd
,
state
:=
setup
(
t
)
wd
,
state
:=
setup
(
t
)
defer
state
.
Unmount
()
defer
state
.
Unmount
()
err
:=
os
.
MkdirAll
(
wd
+
"/ro/subdir/sub2"
,
0755
)
err
:=
os
.
MkdirAll
(
wd
+
"/ro/subdir/sub2"
,
0755
)
CheckSuccess
(
err
)
CheckSuccess
(
err
)
writeToFile
(
wd
+
"/mount/subdir/sub2/file"
,
"other-content"
)
writeToFile
(
wd
+
"/mount/subdir/sub2/file"
,
"other-content"
)
_
,
err
=
os
.
Lstat
(
wd
+
"/mount/subdir/sub2/file"
)
_
,
err
=
os
.
Lstat
(
wd
+
"/mount/subdir/sub2/file"
)
CheckSuccess
(
err
)
CheckSuccess
(
err
)
}
}
...
@@ -241,10 +241,10 @@ func TestOpenUndeletes(t *testing.T) {
...
@@ -241,10 +241,10 @@ func TestOpenUndeletes(t *testing.T) {
wd
,
state
:=
setup
(
t
)
wd
,
state
:=
setup
(
t
)
defer
state
.
Unmount
()
defer
state
.
Unmount
()
writeToFile
(
wd
+
"/ro/file"
,
"X"
)
writeToFile
(
wd
+
"/ro/file"
,
"X"
)
err
:=
os
.
Remove
(
wd
+
"/mount/file"
)
err
:=
os
.
Remove
(
wd
+
"/mount/file"
)
CheckSuccess
(
err
)
CheckSuccess
(
err
)
writeToFile
(
wd
+
"/mount/file"
,
"X"
)
writeToFile
(
wd
+
"/mount/file"
,
"X"
)
_
,
err
=
os
.
Lstat
(
wd
+
"/mount/file"
)
_
,
err
=
os
.
Lstat
(
wd
+
"/mount/file"
)
CheckSuccess
(
err
)
CheckSuccess
(
err
)
}
}
...
@@ -282,19 +282,19 @@ func TestRename(t *testing.T) {
...
@@ -282,19 +282,19 @@ func TestRename(t *testing.T) {
t
.
Log
(
"Config"
,
i
,
c
)
t
.
Log
(
"Config"
,
i
,
c
)
wd
,
state
:=
setup
(
t
)
wd
,
state
:=
setup
(
t
)
if
c
.
f1_ro
{
if
c
.
f1_ro
{
writeToFile
(
wd
+
"/ro/file1"
,
"c1"
)
writeToFile
(
wd
+
"/ro/file1"
,
"c1"
)
}
}
if
c
.
f1_rw
{
if
c
.
f1_rw
{
writeToFile
(
wd
+
"/rw/file1"
,
"c2"
)
writeToFile
(
wd
+
"/rw/file1"
,
"c2"
)
}
}
if
c
.
f2_ro
{
if
c
.
f2_ro
{
writeToFile
(
wd
+
"/ro/file2"
,
"c3"
)
writeToFile
(
wd
+
"/ro/file2"
,
"c3"
)
}
}
if
c
.
f2_rw
{
if
c
.
f2_rw
{
writeToFile
(
wd
+
"/rw/file2"
,
"c4"
)
writeToFile
(
wd
+
"/rw/file2"
,
"c4"
)
}
}
err
:=
os
.
Rename
(
wd
+
"/mount/file1"
,
wd
+
"/mount/file2"
)
err
:=
os
.
Rename
(
wd
+
"/mount/file1"
,
wd
+
"/mount/file2"
)
CheckSuccess
(
err
)
CheckSuccess
(
err
)
_
,
err
=
os
.
Lstat
(
wd
+
"/mount/file1"
)
_
,
err
=
os
.
Lstat
(
wd
+
"/mount/file1"
)
...
@@ -304,7 +304,7 @@ func TestRename(t *testing.T) {
...
@@ -304,7 +304,7 @@ func TestRename(t *testing.T) {
_
,
err
=
os
.
Lstat
(
wd
+
"/mount/file2"
)
_
,
err
=
os
.
Lstat
(
wd
+
"/mount/file2"
)
CheckSuccess
(
err
)
CheckSuccess
(
err
)
err
=
os
.
Rename
(
wd
+
"/mount/file2"
,
wd
+
"/mount/file1"
)
err
=
os
.
Rename
(
wd
+
"/mount/file2"
,
wd
+
"/mount/file1"
)
CheckSuccess
(
err
)
CheckSuccess
(
err
)
_
,
err
=
os
.
Lstat
(
wd
+
"/mount/file2"
)
_
,
err
=
os
.
Lstat
(
wd
+
"/mount/file2"
)
...
@@ -327,9 +327,9 @@ func TestWritableDir(t *testing.T) {
...
@@ -327,9 +327,9 @@ func TestWritableDir(t *testing.T) {
err
:=
os
.
Mkdir
(
dirname
,
0555
)
err
:=
os
.
Mkdir
(
dirname
,
0555
)
CheckSuccess
(
err
)
CheckSuccess
(
err
)
fi
,
err
:=
os
.
Lstat
(
wd
+
"/mount/subdir"
)
fi
,
err
:=
os
.
Lstat
(
wd
+
"/mount/subdir"
)
CheckSuccess
(
err
)
CheckSuccess
(
err
)
if
fi
.
Permission
()
&
0222
==
0
{
if
fi
.
Permission
()
&
0222
==
0
{
t
.
Errorf
(
"unexpected permission %o"
,
fi
.
Permission
())
t
.
Errorf
(
"unexpected permission %o"
,
fi
.
Permission
())
}
}
}
}
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