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
ddde0e88
Commit
ddde0e88
authored
Jan 27, 2011
by
Han-Wen Nienhuys
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Run gofmt.
parent
eb2b2511
Changes
11
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
61 additions
and
64 deletions
+61
-64
example/main.go
example/main.go
+1
-1
examplelib/dummyfuse.go
examplelib/dummyfuse.go
+1
-2
examplelib/passthrough.go
examplelib/passthrough.go
+3
-3
examplelib/passthrough_test.go
examplelib/passthrough_test.go
+7
-7
examplelib/stackfs.go
examplelib/stackfs.go
+0
-2
examplelib/stackfs_test.go
examplelib/stackfs_test.go
+1
-1
fuse/bufferpool.go
fuse/bufferpool.go
+5
-6
fuse/bufferpool_test.go
fuse/bufferpool_test.go
+9
-9
fuse/direntry.go
fuse/direntry.go
+3
-2
fuse/fuse.go
fuse/fuse.go
+4
-4
fuse/pathfilesystem.go
fuse/pathfilesystem.go
+27
-27
No files found.
example/main.go
View file @
ddde0e88
...
...
@@ -39,7 +39,7 @@ func main() {
state
.
Loop
(
*
threaded
)
fmt
.
Println
(
"Finished"
,
state
.
Stats
())
for
v
:=
range
(
expvar
.
Iter
()
)
{
for
v
:=
range
expvar
.
Iter
(
)
{
if
strings
.
HasPrefix
(
v
.
Key
,
"mount"
)
{
fmt
.
Printf
(
"%v: %v
\n
"
,
v
.
Key
,
v
.
Value
)
}
...
...
examplelib/dummyfuse.go
View file @
ddde0e88
...
...
@@ -201,7 +201,7 @@ func (self *DummyPathFuse) OpenDir(name string) (stream chan fuse.DirEntry, stat
return
nil
,
fuse
.
ENOSYS
}
func
(
self
*
DummyPathFuse
)
Mount
(
conn
*
fuse
.
PathFileSystemConnector
)
(
fuse
.
Status
)
{
func
(
self
*
DummyPathFuse
)
Mount
(
conn
*
fuse
.
PathFileSystemConnector
)
fuse
.
Status
{
return
fuse
.
OK
}
...
...
@@ -219,4 +219,3 @@ func (self *DummyPathFuse) Create(name string, flags uint32, mode uint32) (file
func
(
self
*
DummyPathFuse
)
Utimens
(
name
string
,
AtimeNs
uint64
,
CtimeNs
uint64
)
(
code
fuse
.
Status
)
{
return
fuse
.
ENOSYS
}
examplelib/passthrough.go
View file @
ddde0e88
...
...
@@ -25,7 +25,7 @@ func NewPassThroughFuse(root string) (out *PassThroughFuse) {
return
out
}
func
(
self
*
PassThroughFuse
)
Mount
(
conn
*
fuse
.
PathFileSystemConnector
)
(
fuse
.
Status
)
{
func
(
self
*
PassThroughFuse
)
Mount
(
conn
*
fuse
.
PathFileSystemConnector
)
fuse
.
Status
{
return
fuse
.
OK
}
...
...
examplelib/passthrough_test.go
View file @
ddde0e88
examplelib/stackfs.go
View file @
ddde0e88
...
...
@@ -601,7 +601,6 @@ func (self *SubmountFileSystem) ReleaseDir(header *fuse.InHeader, f fuse.RawFuse
}
////////////////////////////////////////////////////////////////
type
SubmountFileSystemTopDir
struct
{
...
...
@@ -638,4 +637,3 @@ func (self *SubmountFileSystemTopDir) ReleaseDir() {
func
(
self
*
SubmountFileSystemTopDir
)
FsyncDir
(
input
*
fuse
.
FsyncIn
)
(
code
fuse
.
Status
)
{
return
fuse
.
ENOENT
}
examplelib/stackfs_test.go
View file @
ddde0e88
fuse/bufferpool.go
View file @
ddde0e88
...
...
@@ -25,7 +25,7 @@ func IntToExponent(z int) uint {
}
if
z
>
(
1
<<
exp
)
{
exp
++
exp
++
}
return
exp
}
...
...
@@ -38,7 +38,7 @@ func NewBufferPool() *BufferPool {
func
(
self
*
BufferPool
)
String
()
string
{
s
:=
""
for
exp
,
bufs
:=
range
(
self
.
buffersByExponent
)
{
for
exp
,
bufs
:=
range
self
.
buffersByExponent
{
s
=
s
+
fmt
.
Sprintf
(
"%d = %d
\n
"
,
exp
,
len
(
bufs
))
}
return
s
...
...
@@ -50,11 +50,11 @@ func (self *BufferPool) getBuffer(sz int) []byte {
self
.
lock
.
Lock
()
defer
self
.
lock
.
Unlock
()
if
(
len
(
self
.
buffersByExponent
)
<=
int
(
exponent
)
)
{
if
len
(
self
.
buffersByExponent
)
<=
int
(
exponent
)
{
return
nil
}
bufferList
:=
self
.
buffersByExponent
[
exponent
]
if
(
len
(
bufferList
)
==
0
)
{
if
len
(
bufferList
)
==
0
{
return
nil
}
...
...
@@ -69,7 +69,7 @@ func (self *BufferPool) getBuffer(sz int) []byte {
}
func
(
self
*
BufferPool
)
addBuffer
(
slice
[]
byte
)
{
if
cap
(
slice
)
&
(
PAGESIZE
-
1
)
!=
0
{
if
cap
(
slice
)
&
(
PAGESIZE
-
1
)
!=
0
{
return
}
...
...
@@ -106,4 +106,3 @@ func (self *BufferPool) GetBuffer(size uint32) []byte {
return
make
([]
byte
,
size
,
rounded
)
}
fuse/bufferpool_test.go
View file @
ddde0e88
...
...
@@ -27,7 +27,7 @@ func TestIntToExponent(t *testing.T) {
func
TestBufferPool
(
t
*
testing
.
T
)
{
bp
:=
NewBufferPool
()
b
:=
bp
.
getBuffer
(
PAGESIZE
-
1
)
b
:=
bp
.
getBuffer
(
PAGESIZE
-
1
)
if
b
!=
nil
{
t
.
Error
(
"bp 0"
)
}
...
...
@@ -36,10 +36,10 @@ func TestBufferPool(t *testing.T) {
t
.
Error
(
"bp 1"
)
}
s
:=
make
([]
byte
,
PAGESIZE
-
1
)
s
:=
make
([]
byte
,
PAGESIZE
-
1
)
bp
.
addBuffer
(
s
)
b
=
bp
.
getBuffer
(
PAGESIZE
-
1
)
b
=
bp
.
getBuffer
(
PAGESIZE
-
1
)
if
b
!=
nil
{
t
.
Error
(
"bp 3"
)
}
...
...
@@ -57,21 +57,21 @@ func TestBufferPool(t *testing.T) {
}
bp
.
addBuffer
(
make
([]
byte
,
3
*
PAGESIZE
))
b
=
bp
.
getBuffer
(
2
*
PAGESIZE
)
b
=
bp
.
getBuffer
(
2
*
PAGESIZE
)
if
b
!=
nil
{
t
.
Error
(
"should fail."
)
}
b
=
bp
.
getBuffer
(
4
*
PAGESIZE
)
b
=
bp
.
getBuffer
(
4
*
PAGESIZE
)
if
b
!=
nil
{
t
.
Error
(
"should fail."
)
}
bp
.
addBuffer
(
make
([]
byte
,
4
*
PAGESIZE
))
fmt
.
Println
(
bp
)
b
=
bp
.
getBuffer
(
2
*
PAGESIZE
)
b
=
bp
.
getBuffer
(
2
*
PAGESIZE
)
if
b
!=
nil
{
t
.
Error
(
"should fail."
)
}
b
=
bp
.
getBuffer
(
4
*
PAGESIZE
)
b
=
bp
.
getBuffer
(
4
*
PAGESIZE
)
if
b
==
nil
{
t
.
Error
(
"4*ps should succeed."
)
}
...
...
fuse/direntry.go
View file @
ddde0e88
...
...
@@ -7,6 +7,7 @@ import (
"fmt"
"bytes"
)
var
_
=
fmt
.
Print
// For PathFileSystemConnector. The connector determines inodes.
type
DirEntry
struct
{
...
...
fuse/fuse.go
View file @
ddde0e88
...
...
@@ -199,7 +199,7 @@ func (self *MountState) Stats() string {
lines
=
append
(
lines
,
fmt
.
Sprintf
(
"buffers: %v"
,
self
.
buffers
.
String
()))
for
v
:=
range
(
expvar
.
Iter
()
)
{
for
v
:=
range
expvar
.
Iter
(
)
{
if
strings
.
HasPrefix
(
v
.
Key
,
"mount"
)
{
lines
=
append
(
lines
,
fmt
.
Sprintf
(
"%v: %v
\n
"
,
v
.
Key
,
v
.
Value
))
}
...
...
@@ -221,7 +221,7 @@ func (self *MountState) syncWrite(packet [][]byte) {
if
err
!=
nil
{
self
.
Error
(
os
.
NewError
(
fmt
.
Sprintf
(
"writer: Writev %v failed, err: %v"
,
packet
,
err
)))
}
for
_
,
v
:=
range
(
packet
)
{
for
_
,
v
:=
range
packet
{
self
.
buffers
.
addBuffer
(
v
)
}
}
...
...
fuse/pathfilesystem.go
View file @
ddde0e88
...
...
@@ -264,7 +264,7 @@ func (self *PathFileSystemConnector) findInode(fullPath string) *inodeData {
defer
self
.
lock
.
RUnlock
()
node
:=
self
.
inodePathMapByInode
[
FUSE_ROOT_ID
]
for
i
,
component
:=
range
(
comps
)
{
for
i
,
component
:=
range
comps
{
if
len
(
component
)
==
0
{
continue
}
...
...
@@ -318,7 +318,7 @@ func (self *PathFileSystemConnector) Mount(path string, fs PathFilesystem) Statu
return
EBUSY
}
if
node
.
Type
&
ModeToType
(
S_IFDIR
)
==
0
{
if
node
.
Type
&
ModeToType
(
S_IFDIR
)
==
0
{
return
EINVAL
}
...
...
@@ -355,7 +355,7 @@ func (self *PathFileSystemConnector) Unmount(path string) Status {
panic
(
path
)
}
if
mount
.
openFiles
+
mount
.
openDirs
+
mount
.
subMounts
>
0
{
if
mount
.
openFiles
+
mount
.
openDirs
+
mount
.
subMounts
>
0
{
log
.
Println
(
"busy: "
,
mount
)
return
EBUSY
}
...
...
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