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
94244f10
Commit
94244f10
authored
Dec 30, 2010
by
Han-Wen Nienhuys
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Run Gofmt.
parent
736b11e3
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
52 additions
and
56 deletions
+52
-56
example/main.go
example/main.go
+2
-3
examplelib/dummyfuse.go
examplelib/dummyfuse.go
+3
-2
examplelib/passthrough.go
examplelib/passthrough.go
+6
-7
examplelib/passthrough_test.go
examplelib/passthrough_test.go
+12
-14
fuse/fuse.go
fuse/fuse.go
+3
-4
fuse/misc.go
fuse/misc.go
+1
-1
fuse/pathfilesystem.go
fuse/pathfilesystem.go
+25
-25
No files found.
example/main.go
View file @
94244f10
...
@@ -31,4 +31,3 @@ func main() {
...
@@ -31,4 +31,3 @@ func main() {
fmt
.
Printf
(
"Mounted %s on %s (threaded=%v, debug=%v)
\n
"
,
orig
,
mountPoint
,
*
threaded
,
*
debug
)
fmt
.
Printf
(
"Mounted %s on %s (threaded=%v, debug=%v)
\n
"
,
orig
,
mountPoint
,
*
threaded
,
*
debug
)
state
.
Loop
(
*
threaded
)
state
.
Loop
(
*
threaded
)
}
}
examplelib/dummyfuse.go
View file @
94244f10
package
examplelib
package
examplelib
import
(
import
(
"github.com/hanwen/go-fuse/fuse"
"github.com/hanwen/go-fuse/fuse"
)
)
// Declare dummy methods, for cut & paste convenience.
// Declare dummy methods, for cut & paste convenience.
type
DummyFuse
struct
{}
type
DummyFuse
struct
{}
...
...
examplelib/passthrough.go
View file @
94244f10
...
@@ -235,4 +235,3 @@ func (self *PassThroughDir) ReleaseDir() {
...
@@ -235,4 +235,3 @@ func (self *PassThroughDir) ReleaseDir() {
func
(
self
*
PassThroughDir
)
FsyncDir
(
input
*
fuse
.
FsyncIn
)
(
code
fuse
.
Status
)
{
func
(
self
*
PassThroughDir
)
FsyncDir
(
input
*
fuse
.
FsyncIn
)
(
code
fuse
.
Status
)
{
return
fuse
.
ENOSYS
return
fuse
.
ENOSYS
}
}
examplelib/passthrough_test.go
View file @
94244f10
...
@@ -396,7 +396,7 @@ func (self *testCase) testReaddir() {
...
@@ -396,7 +396,7 @@ func (self *testCase) testReaddir() {
self
.
tester
.
Errorf
(
"readdir err %v"
,
err
)
self
.
tester
.
Errorf
(
"readdir err %v"
,
err
)
}
}
wanted
:=
map
[
string
]
bool
{
wanted
:=
map
[
string
]
bool
{
"hello.txt"
:
true
,
"hello.txt"
:
true
,
"subdir"
:
true
,
"subdir"
:
true
,
}
}
...
@@ -437,7 +437,7 @@ func (self *testCase) testFSync() {
...
@@ -437,7 +437,7 @@ func (self *testCase) testFSync() {
func
(
self
*
testCase
)
testLargeRead
()
{
func
(
self
*
testCase
)
testLargeRead
()
{
name
:=
path
.
Join
(
self
.
origDir
,
"large"
)
name
:=
path
.
Join
(
self
.
origDir
,
"large"
)
f
,
err
:=
os
.
Open
(
name
,
os
.
O_WRONLY
|
os
.
O_CREATE
,
0777
)
f
,
err
:=
os
.
Open
(
name
,
os
.
O_WRONLY
|
os
.
O_CREATE
,
0777
)
if
err
!=
nil
{
if
err
!=
nil
{
self
.
tester
.
Errorf
(
"open write err %v"
,
err
)
self
.
tester
.
Errorf
(
"open write err %v"
,
err
)
}
}
...
@@ -469,10 +469,10 @@ func (self *testCase) testLargeRead() {
...
@@ -469,10 +469,10 @@ func (self *testCase) testLargeRead() {
readSlice
:=
make
([]
byte
,
len
(
slice
))
readSlice
:=
make
([]
byte
,
len
(
slice
))
m
,
err
:=
g
.
Read
(
readSlice
)
m
,
err
:=
g
.
Read
(
readSlice
)
if
m
!=
n
{
if
m
!=
n
{
self
.
tester
.
Errorf
(
"read mismatch %v %v"
,
m
,
n
)
self
.
tester
.
Errorf
(
"read mismatch %v %v"
,
m
,
n
)
}
}
for
i
,
v
:=
range
(
readSlice
)
{
for
i
,
v
:=
range
readSlice
{
if
(
slice
[
i
]
!=
v
)
{
if
slice
[
i
]
!=
v
{
self
.
tester
.
Errorf
(
"char mismatch %v %v %v"
,
i
,
slice
[
i
],
v
)
self
.
tester
.
Errorf
(
"char mismatch %v %v %v"
,
i
,
slice
[
i
],
v
)
break
break
}
}
...
@@ -506,7 +506,6 @@ func (self *testCase) testLargeRead() {
...
@@ -506,7 +506,6 @@ func (self *testCase) testLargeRead() {
}
}
g
.
Close
()
g
.
Close
()
os
.
Remove
(
name
)
os
.
Remove
(
name
)
}
}
...
@@ -541,7 +540,7 @@ func (self *testCase) testLargeDirRead() {
...
@@ -541,7 +540,7 @@ func (self *testCase) testLargeDirRead() {
nameSet
[
base
]
=
true
nameSet
[
base
]
=
true
f
,
err
:=
os
.
Open
(
name
,
os
.
O_WRONLY
|
os
.
O_CREATE
,
0777
)
f
,
err
:=
os
.
Open
(
name
,
os
.
O_WRONLY
|
os
.
O_CREATE
,
0777
)
if
err
!=
nil
{
if
err
!=
nil
{
self
.
tester
.
Errorf
(
"open write err %v"
,
err
)
self
.
tester
.
Errorf
(
"open write err %v"
,
err
)
break
break
...
@@ -558,7 +557,7 @@ func (self *testCase) testLargeDirRead() {
...
@@ -558,7 +557,7 @@ func (self *testCase) testLargeDirRead() {
}
}
// Chunked read.
// Chunked read.
total
:=
0
total
:=
0
readSet
:=
make
(
map
[
string
]
bool
)
readSet
:=
make
(
map
[
string
]
bool
)
for
{
for
{
namesRead
,
err
:=
dir
.
Readdirnames
(
200
)
namesRead
,
err
:=
dir
.
Readdirnames
(
200
)
if
err
!=
nil
{
if
err
!=
nil
{
...
@@ -568,7 +567,7 @@ func (self *testCase) testLargeDirRead() {
...
@@ -568,7 +567,7 @@ func (self *testCase) testLargeDirRead() {
if
len
(
namesRead
)
==
0
{
if
len
(
namesRead
)
==
0
{
break
break
}
}
for
_
,
v
:=
range
(
namesRead
)
{
for
_
,
v
:=
range
namesRead
{
readSet
[
v
]
=
true
readSet
[
v
]
=
true
}
}
total
+=
len
(
namesRead
)
total
+=
len
(
namesRead
)
...
@@ -577,7 +576,7 @@ func (self *testCase) testLargeDirRead() {
...
@@ -577,7 +576,7 @@ func (self *testCase) testLargeDirRead() {
if
total
!=
created
{
if
total
!=
created
{
self
.
tester
.
Errorf
(
"readdir mismatch got %v wanted %v"
,
total
,
created
)
self
.
tester
.
Errorf
(
"readdir mismatch got %v wanted %v"
,
total
,
created
)
}
}
for
k
,
_
:=
range
(
nameSet
)
{
for
k
,
_
:=
range
nameSet
{
_
,
ok
:=
readSet
[
k
]
_
,
ok
:=
readSet
[
k
]
if
!
ok
{
if
!
ok
{
self
.
tester
.
Errorf
(
"Name %v not found in output"
,
k
)
self
.
tester
.
Errorf
(
"Name %v not found in output"
,
k
)
...
@@ -590,7 +589,6 @@ func (self *testCase) testLargeDirRead() {
...
@@ -590,7 +589,6 @@ func (self *testCase) testLargeDirRead() {
}
}
// Test driver.
// Test driver.
func
TestMount
(
t
*
testing
.
T
)
{
func
TestMount
(
t
*
testing
.
T
)
{
ts
:=
new
(
testCase
)
ts
:=
new
(
testCase
)
...
...
fuse/fuse.go
View file @
94244f10
...
@@ -263,7 +263,6 @@ func dispatch(state *MountState, h *InHeader, arg *bytes.Buffer) (outBytes [][]b
...
@@ -263,7 +263,6 @@ func dispatch(state *MountState, h *InHeader, arg *bytes.Buffer) (outBytes [][]b
status
=
OK
status
=
OK
fs
:=
state
.
fileSystem
fs
:=
state
.
fileSystem
filename
:=
""
filename
:=
""
// Perhaps a map is faster?
// Perhaps a map is faster?
if
h
.
Opcode
==
FUSE_UNLINK
||
h
.
Opcode
==
FUSE_RMDIR
||
if
h
.
Opcode
==
FUSE_UNLINK
||
h
.
Opcode
==
FUSE_RMDIR
||
...
@@ -380,7 +379,7 @@ func dispatch(state *MountState, h *InHeader, arg *bytes.Buffer) (outBytes [][]b
...
@@ -380,7 +379,7 @@ func dispatch(state *MountState, h *InHeader, arg *bytes.Buffer) (outBytes [][]b
return
serialize
(
h
,
status
,
out
,
flatData
,
state
.
Debug
)
return
serialize
(
h
,
status
,
out
,
flatData
,
state
.
Debug
)
}
}
func
serialize
(
h
*
InHeader
,
res
Status
,
out
interface
{},
flatData
[]
byte
,
debug
bool
)
([][]
byte
)
{
func
serialize
(
h
*
InHeader
,
res
Status
,
out
interface
{},
flatData
[]
byte
,
debug
bool
)
[][]
byte
{
out_data
:=
make
([]
byte
,
0
)
out_data
:=
make
([]
byte
,
0
)
b
:=
new
(
bytes
.
Buffer
)
b
:=
new
(
bytes
.
Buffer
)
if
out
!=
nil
&&
res
==
OK
{
if
out
!=
nil
&&
res
==
OK
{
...
...
fuse/misc.go
View file @
94244f10
fuse/pathfilesystem.go
View file @
94244f10
...
@@ -100,7 +100,7 @@ func (self *PathFileSystemConnector) setParent(data *inodeData, parentId uint64)
...
@@ -100,7 +100,7 @@ func (self *PathFileSystemConnector) setParent(data *inodeData, parentId uint64)
// Must be called with lock held.
// Must be called with lock held.
func
(
self
*
PathFileSystemConnector
)
unrefNode
(
data
*
inodeData
)
{
func
(
self
*
PathFileSystemConnector
)
unrefNode
(
data
*
inodeData
)
{
data
.
RefCount
--
data
.
RefCount
--
if
data
.
RefCount
<=
0
&&
data
.
LookupCount
<=
0
{
if
data
.
RefCount
<=
0
&&
data
.
LookupCount
<=
0
{
self
.
inodePathMapByInode
[
data
.
NodeId
]
=
nil
,
false
self
.
inodePathMapByInode
[
data
.
NodeId
]
=
nil
,
false
}
}
}
}
...
@@ -182,7 +182,7 @@ func (self *PathFileSystemConnector) renameUpdate(oldParent uint64, oldName stri
...
@@ -182,7 +182,7 @@ func (self *PathFileSystemConnector) renameUpdate(oldParent uint64, oldName stri
self
.
setParent
(
target
,
FUSE_ROOT_ID
)
self
.
setParent
(
target
,
FUSE_ROOT_ID
)
target
.
Name
=
fmt
.
Sprintf
(
"overwrittenByRename%d"
,
self
.
nextFreeInode
)
target
.
Name
=
fmt
.
Sprintf
(
"overwrittenByRename%d"
,
self
.
nextFreeInode
)
self
.
nextFreeInode
++
;
self
.
nextFreeInode
++
self
.
inodePathMap
[
target
.
Key
()]
=
target
self
.
inodePathMap
[
target
.
Key
()]
=
target
}
}
...
...
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