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
3881211d
Commit
3881211d
authored
Nov 01, 2011
by
Han-Wen Nienhuys
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Run gofmt.
parent
305708cc
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
23 deletions
+23
-23
fuse/typeprint.go
fuse/typeprint.go
+6
-5
unionfs/memunionfs.go
unionfs/memunionfs.go
+5
-5
unionfs/memunionfs_test.go
unionfs/memunionfs_test.go
+12
-13
No files found.
fuse/typeprint.go
View file @
3881211d
...
...
@@ -92,6 +92,7 @@ func (me *OpenIn) String() string {
}
type
OsFileInfo
os
.
FileInfo
func
(
me
OsFileInfo
)
String
()
string
{
return
fmt
.
Sprintf
(
"{%s M0%o S=%d L=%d "
+
...
...
@@ -106,11 +107,11 @@ func (me OsFileInfo) String() string {
me
.
Blocks
,
me
.
Blksize
,
me
.
Rdev
,
me
.
Ino
,
me
.
Ctime_ns
/
1e9
,
me
.
Ctime_ns
%
1e9
,
me
.
Mtime_ns
/
1e9
,
me
.
Mtime_ns
%
1e9
,
me
.
Atime_ns
/
1e9
,
me
.
Atime_ns
%
1e9
)
me
.
Ctime_ns
%
1e9
,
me
.
Mtime_ns
/
1e9
,
me
.
Mtime_ns
%
1e9
,
me
.
Atime_ns
/
1e9
,
me
.
Atime_ns
%
1e9
)
}
type
OsFileInfos
[]
*
os
.
FileInfo
...
...
unionfs/memunionfs.go
View file @
3881211d
...
...
@@ -17,7 +17,7 @@ var _ = log.Println
// A unionfs that only uses on-disk backing store for file contents.
type
MemUnionFs
struct
{
fuse
.
DefaultNodeFileSystem
readonly
fuse
.
FileSystem
readonly
fuse
.
FileSystem
backingStore
string
connector
*
fuse
.
FileSystemConnector
...
...
@@ -73,12 +73,12 @@ func (me *MemUnionFs) Reset() {
parent
,
base
:=
filepath
.
Split
(
path
)
parent
=
stripSlash
(
parent
)
last
,
rest
:=
me
.
connector
.
Node
(
me
.
root
.
Inode
(),
parent
)
last
,
rest
:=
me
.
connector
.
Node
(
me
.
root
.
Inode
(),
parent
)
if
len
(
rest
)
==
0
{
me
.
connector
.
EntryNotify
(
last
,
base
)
}
}
}
me
.
deleted
=
make
(
map
[
string
]
bool
,
len
(
me
.
deleted
))
me
.
clearBackingStore
()
}
...
...
@@ -634,7 +634,7 @@ func (me *memNode) reset(path string) (entryNotify bool) {
if
me
.
backing
!=
""
||
me
.
original
!=
path
{
return
true
}
if
me
.
changed
{
info
,
code
:=
me
.
fs
.
readonly
.
GetAttr
(
me
.
original
,
nil
)
if
!
code
.
Ok
()
{
...
...
unionfs/memunionfs_test.go
View file @
3881211d
...
...
@@ -41,7 +41,7 @@ func setupMemUfs(t *testing.T) (workdir string, ufs *MemUnionFs, cleanup func())
EntryTimeout
:
.5
*
entryTtl
,
AttrTimeout
:
.5
*
entryTtl
,
NegativeTimeout
:
.5
*
entryTtl
,
PortableInodes
:
true
,
PortableInodes
:
true
,
}
state
,
conn
,
err
:=
fuse
.
MountNodeFileSystem
(
wd
+
"/mnt"
,
memFs
,
opts
)
...
...
@@ -823,9 +823,9 @@ func TestMemUnionResetAttr(t *testing.T) {
wd
,
ufs
,
clean
:=
setupMemUfs
(
t
)
defer
clean
()
ioutil
.
WriteFile
(
wd
+
"/ro/fileattr"
,
[]
byte
{
42
},
0644
)
ioutil
.
WriteFile
(
wd
+
"/ro/fileattr"
,
[]
byte
{
42
},
0644
)
before
,
_
:=
os
.
Lstat
(
wd
+
"/mnt/fileattr"
)
err
:=
os
.
Chmod
(
wd
+
"/mnt/fileattr"
,
0606
)
err
:=
os
.
Chmod
(
wd
+
"/mnt/fileattr"
,
0606
)
CheckSuccess
(
err
)
after
,
_
:=
os
.
Lstat
(
wd
+
"/mnt/fileattr"
)
testEq
(
t
,
after
,
before
,
false
)
...
...
@@ -837,9 +837,9 @@ func TestMemUnionResetAttr(t *testing.T) {
func
TestMemUnionResetContent
(
t
*
testing
.
T
)
{
wd
,
ufs
,
clean
:=
setupMemUfs
(
t
)
defer
clean
()
ioutil
.
WriteFile
(
wd
+
"/ro/filecontents"
,
[]
byte
{
42
},
0644
)
ioutil
.
WriteFile
(
wd
+
"/ro/filecontents"
,
[]
byte
{
42
},
0644
)
before
,
_
:=
ioutil
.
ReadFile
(
wd
+
"/mnt/filecontents"
)
ioutil
.
WriteFile
(
wd
+
"/mnt/filecontents"
,
[]
byte
{
43
},
0644
)
ioutil
.
WriteFile
(
wd
+
"/mnt/filecontents"
,
[]
byte
{
43
},
0644
)
after
,
_
:=
ioutil
.
ReadFile
(
wd
+
"/mnt/filecontents"
)
testEq
(
t
,
after
,
before
,
false
)
ufs
.
Reset
()
...
...
@@ -848,11 +848,10 @@ func TestMemUnionResetContent(t *testing.T) {
testEq
(
t
,
afterReset
,
before
,
true
)
}
func
TestMemUnionResetDelete
(
t
*
testing
.
T
)
{
wd
,
ufs
,
clean
:=
setupMemUfs
(
t
)
defer
clean
()
ioutil
.
WriteFile
(
wd
+
"/ro/todelete"
,
[]
byte
{
42
},
0644
)
ioutil
.
WriteFile
(
wd
+
"/ro/todelete"
,
[]
byte
{
42
},
0644
)
before
,
_
:=
os
.
Lstat
(
wd
+
"/mnt/todelete"
)
before
.
Ino
=
0
os
.
Remove
(
wd
+
"/mnt/todelete"
)
...
...
@@ -873,11 +872,11 @@ func clearInodes(infos []*os.FileInfo) {
func
TestMemUnionResetDirEntry
(
t
*
testing
.
T
)
{
wd
,
ufs
,
clean
:=
setupMemUfs
(
t
)
defer
clean
()
os
.
Mkdir
(
wd
+
"/ro/dir"
,
0755
)
ioutil
.
WriteFile
(
wd
+
"/ro/dir/todelete"
,
[]
byte
{
42
},
0644
)
os
.
Mkdir
(
wd
+
"/ro/dir"
,
0755
)
ioutil
.
WriteFile
(
wd
+
"/ro/dir/todelete"
,
[]
byte
{
42
},
0644
)
before
,
_
:=
ioutil
.
ReadDir
(
wd
+
"/mnt/dir"
)
clearInodes
(
before
)
ioutil
.
WriteFile
(
wd
+
"/mnt/dir/newfile"
,
[]
byte
{
42
},
0644
)
ioutil
.
WriteFile
(
wd
+
"/mnt/dir/newfile"
,
[]
byte
{
42
},
0644
)
os
.
Remove
(
wd
+
"/mnt/dir/todelete"
)
after
,
_
:=
ioutil
.
ReadDir
(
wd
+
"/mnt/dir"
)
clearInodes
(
after
)
...
...
@@ -891,11 +890,11 @@ func TestMemUnionResetDirEntry(t *testing.T) {
func
TestMemUnionResetRename
(
t
*
testing
.
T
)
{
wd
,
ufs
,
clean
:=
setupMemUfs
(
t
)
defer
clean
()
os
.
Mkdir
(
wd
+
"/ro/dir"
,
0755
)
ioutil
.
WriteFile
(
wd
+
"/ro/dir/movesrc"
,
[]
byte
{
42
},
0644
)
os
.
Mkdir
(
wd
+
"/ro/dir"
,
0755
)
ioutil
.
WriteFile
(
wd
+
"/ro/dir/movesrc"
,
[]
byte
{
42
},
0644
)
before
,
_
:=
ioutil
.
ReadDir
(
wd
+
"/mnt/dir"
)
clearInodes
(
before
)
os
.
Rename
(
wd
+
"/mnt/dir/movesrc"
,
wd
+
"/mnt/dir/dest"
)
os
.
Rename
(
wd
+
"/mnt/dir/movesrc"
,
wd
+
"/mnt/dir/dest"
)
after
,
_
:=
ioutil
.
ReadDir
(
wd
+
"/mnt/dir"
)
clearInodes
(
after
)
testEq
(
t
,
fuse
.
OsFileInfos
(
after
),
fuse
.
OsFileInfos
(
before
),
false
)
...
...
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