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
9c3ac0b4
Commit
9c3ac0b4
authored
Apr 21, 2011
by
Han-Wen Nienhuys
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Drop Fuse from all identifier names.
parent
6dbddc38
Changes
20
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
97 additions
and
97 deletions
+97
-97
example/autounionfs/main.go
example/autounionfs/main.go
+1
-1
example/loopback/loopback.go
example/loopback/loopback.go
+1
-1
example/unionfs/main.go
example/unionfs/main.go
+1
-1
fuse/datafile.go
fuse/datafile.go
+1
-1
fuse/default.go
fuse/default.go
+41
-41
fuse/default_test.go
fuse/default_test.go
+3
-3
fuse/devnull.go
fuse/devnull.go
+1
-1
fuse/direntry.go
fuse/direntry.go
+4
-4
fuse/fuse.go
fuse/fuse.go
+8
-8
fuse/lockingfs.go
fuse/lockingfs.go
+2
-2
fuse/loopback.go
fuse/loopback.go
+3
-3
fuse/loopback_test.go
fuse/loopback_test.go
+3
-3
fuse/pathdebug.go
fuse/pathdebug.go
+1
-1
fuse/pathfilesystem.go
fuse/pathfilesystem.go
+9
-9
fuse/timingfs.go
fuse/timingfs.go
+2
-2
fuse/types.go
fuse/types.go
+6
-6
fuse/wrappedfs.go
fuse/wrappedfs.go
+2
-2
unionfs/unionfs.go
unionfs/unionfs.go
+2
-2
zipfs/multizip.go
zipfs/multizip.go
+3
-3
zipfs/zipfs.go
zipfs/zipfs.go
+3
-3
No files found.
example/autounionfs/main.go
View file @
9c3ac0b4
...
...
@@ -39,7 +39,7 @@ func main() {
fmt
.
Printf
(
"Mounting...
\n
"
)
err
:=
mountState
.
Mount
(
mountpoint
)
if
err
!=
nil
{
fmt
.
Printf
(
"Mount
Fuse
fail: %v
\n
"
,
err
)
fmt
.
Printf
(
"Mount fail: %v
\n
"
,
err
)
os
.
Exit
(
1
)
}
fmt
.
Printf
(
"Mounted!
\n
"
)
...
...
example/loopback/loopback.go
View file @
9c3ac0b4
...
...
@@ -62,7 +62,7 @@ func main() {
mountPoint
:=
flag
.
Arg
(
0
)
err
:=
state
.
Mount
(
mountPoint
)
if
err
!=
nil
{
fmt
.
Printf
(
"Mount
Fuse
fail: %v
\n
"
,
err
)
fmt
.
Printf
(
"Mount fail: %v
\n
"
,
err
)
os
.
Exit
(
1
)
}
...
...
example/unionfs/main.go
View file @
9c3ac0b4
...
...
@@ -36,7 +36,7 @@ func main() {
fmt
.
Printf
(
"Mounting...
\n
"
)
err
:=
mountState
.
Mount
(
mountpoint
)
if
err
!=
nil
{
fmt
.
Printf
(
"Mount
Fuse
fail: %v
\n
"
,
err
)
fmt
.
Printf
(
"Mount fail: %v
\n
"
,
err
)
os
.
Exit
(
1
)
}
fmt
.
Printf
(
"Mounted!
\n
"
)
...
...
fuse/datafile.go
View file @
9c3ac0b4
...
...
@@ -5,7 +5,7 @@ package fuse
type
ReadOnlyFile
struct
{
data
[]
byte
DefaultF
useF
ile
DefaultFile
}
func
NewReadOnlyFile
(
data
[]
byte
)
*
ReadOnlyFile
{
...
...
fuse/default.go
View file @
9c3ac0b4
...
...
@@ -6,155 +6,155 @@ import (
var
_
=
log
.
Println
func
(
me
*
DefaultRawF
useF
ileSystem
)
Init
(
h
*
InHeader
,
input
*
InitIn
)
(
*
InitOut
,
Status
)
{
func
(
me
*
DefaultRawFileSystem
)
Init
(
h
*
InHeader
,
input
*
InitIn
)
(
*
InitOut
,
Status
)
{
return
new
(
InitOut
),
OK
}
func
(
me
*
DefaultRawF
useF
ileSystem
)
Destroy
(
h
*
InHeader
,
input
*
InitIn
)
{
func
(
me
*
DefaultRawFileSystem
)
Destroy
(
h
*
InHeader
,
input
*
InitIn
)
{
}
func
(
me
*
DefaultRawF
useF
ileSystem
)
Lookup
(
h
*
InHeader
,
name
string
)
(
out
*
EntryOut
,
code
Status
)
{
func
(
me
*
DefaultRawFileSystem
)
Lookup
(
h
*
InHeader
,
name
string
)
(
out
*
EntryOut
,
code
Status
)
{
return
nil
,
ENOSYS
}
func
(
me
*
DefaultRawF
useF
ileSystem
)
Forget
(
h
*
InHeader
,
input
*
ForgetIn
)
{
func
(
me
*
DefaultRawFileSystem
)
Forget
(
h
*
InHeader
,
input
*
ForgetIn
)
{
}
func
(
me
*
DefaultRawF
useF
ileSystem
)
GetAttr
(
header
*
InHeader
,
input
*
GetAttrIn
)
(
out
*
AttrOut
,
code
Status
)
{
func
(
me
*
DefaultRawFileSystem
)
GetAttr
(
header
*
InHeader
,
input
*
GetAttrIn
)
(
out
*
AttrOut
,
code
Status
)
{
return
nil
,
ENOSYS
}
func
(
me
*
DefaultRawF
useF
ileSystem
)
Open
(
header
*
InHeader
,
input
*
OpenIn
)
(
flags
uint32
,
handle
uint64
,
status
Status
)
{
func
(
me
*
DefaultRawFileSystem
)
Open
(
header
*
InHeader
,
input
*
OpenIn
)
(
flags
uint32
,
handle
uint64
,
status
Status
)
{
return
0
,
0
,
OK
}
func
(
me
*
DefaultRawF
useF
ileSystem
)
SetAttr
(
header
*
InHeader
,
input
*
SetAttrIn
)
(
out
*
AttrOut
,
code
Status
)
{
func
(
me
*
DefaultRawFileSystem
)
SetAttr
(
header
*
InHeader
,
input
*
SetAttrIn
)
(
out
*
AttrOut
,
code
Status
)
{
return
nil
,
ENOSYS
}
func
(
me
*
DefaultRawF
useF
ileSystem
)
Readlink
(
header
*
InHeader
)
(
out
[]
byte
,
code
Status
)
{
func
(
me
*
DefaultRawFileSystem
)
Readlink
(
header
*
InHeader
)
(
out
[]
byte
,
code
Status
)
{
return
nil
,
ENOSYS
}
func
(
me
*
DefaultRawF
useF
ileSystem
)
Mknod
(
header
*
InHeader
,
input
*
MknodIn
,
name
string
)
(
out
*
EntryOut
,
code
Status
)
{
func
(
me
*
DefaultRawFileSystem
)
Mknod
(
header
*
InHeader
,
input
*
MknodIn
,
name
string
)
(
out
*
EntryOut
,
code
Status
)
{
return
new
(
EntryOut
),
ENOSYS
}
func
(
me
*
DefaultRawF
useF
ileSystem
)
Mkdir
(
header
*
InHeader
,
input
*
MkdirIn
,
name
string
)
(
out
*
EntryOut
,
code
Status
)
{
func
(
me
*
DefaultRawFileSystem
)
Mkdir
(
header
*
InHeader
,
input
*
MkdirIn
,
name
string
)
(
out
*
EntryOut
,
code
Status
)
{
return
nil
,
ENOSYS
}
func
(
me
*
DefaultRawF
useF
ileSystem
)
Unlink
(
header
*
InHeader
,
name
string
)
(
code
Status
)
{
func
(
me
*
DefaultRawFileSystem
)
Unlink
(
header
*
InHeader
,
name
string
)
(
code
Status
)
{
return
ENOSYS
}
func
(
me
*
DefaultRawF
useF
ileSystem
)
Rmdir
(
header
*
InHeader
,
name
string
)
(
code
Status
)
{
func
(
me
*
DefaultRawFileSystem
)
Rmdir
(
header
*
InHeader
,
name
string
)
(
code
Status
)
{
return
ENOSYS
}
func
(
me
*
DefaultRawF
useF
ileSystem
)
Symlink
(
header
*
InHeader
,
pointedTo
string
,
linkName
string
)
(
out
*
EntryOut
,
code
Status
)
{
func
(
me
*
DefaultRawFileSystem
)
Symlink
(
header
*
InHeader
,
pointedTo
string
,
linkName
string
)
(
out
*
EntryOut
,
code
Status
)
{
return
nil
,
ENOSYS
}
func
(
me
*
DefaultRawF
useF
ileSystem
)
Rename
(
header
*
InHeader
,
input
*
RenameIn
,
oldName
string
,
newName
string
)
(
code
Status
)
{
func
(
me
*
DefaultRawFileSystem
)
Rename
(
header
*
InHeader
,
input
*
RenameIn
,
oldName
string
,
newName
string
)
(
code
Status
)
{
return
ENOSYS
}
func
(
me
*
DefaultRawF
useF
ileSystem
)
Link
(
header
*
InHeader
,
input
*
LinkIn
,
name
string
)
(
out
*
EntryOut
,
code
Status
)
{
func
(
me
*
DefaultRawFileSystem
)
Link
(
header
*
InHeader
,
input
*
LinkIn
,
name
string
)
(
out
*
EntryOut
,
code
Status
)
{
return
nil
,
ENOSYS
}
func
(
me
*
DefaultRawF
useF
ileSystem
)
GetXAttr
(
header
*
InHeader
,
attr
string
)
(
data
[]
byte
,
code
Status
)
{
func
(
me
*
DefaultRawFileSystem
)
GetXAttr
(
header
*
InHeader
,
attr
string
)
(
data
[]
byte
,
code
Status
)
{
return
nil
,
ENOSYS
}
func
(
me
*
DefaultRawF
useF
ileSystem
)
SetXAttr
(
header
*
InHeader
,
input
*
SetXAttrIn
,
attr
string
,
data
[]
byte
)
Status
{
func
(
me
*
DefaultRawFileSystem
)
SetXAttr
(
header
*
InHeader
,
input
*
SetXAttrIn
,
attr
string
,
data
[]
byte
)
Status
{
return
ENOSYS
}
func
(
me
*
DefaultRawF
useF
ileSystem
)
ListXAttr
(
header
*
InHeader
)
(
data
[]
byte
,
code
Status
)
{
func
(
me
*
DefaultRawFileSystem
)
ListXAttr
(
header
*
InHeader
)
(
data
[]
byte
,
code
Status
)
{
return
nil
,
ENOSYS
}
func
(
me
*
DefaultRawF
useF
ileSystem
)
RemoveXAttr
(
header
*
InHeader
,
attr
string
)
Status
{
func
(
me
*
DefaultRawFileSystem
)
RemoveXAttr
(
header
*
InHeader
,
attr
string
)
Status
{
return
ENOSYS
}
func
(
me
*
DefaultRawF
useF
ileSystem
)
Access
(
header
*
InHeader
,
input
*
AccessIn
)
(
code
Status
)
{
func
(
me
*
DefaultRawFileSystem
)
Access
(
header
*
InHeader
,
input
*
AccessIn
)
(
code
Status
)
{
return
ENOSYS
}
func
(
me
*
DefaultRawF
useF
ileSystem
)
Create
(
header
*
InHeader
,
input
*
CreateIn
,
name
string
)
(
flags
uint32
,
handle
uint64
,
out
*
EntryOut
,
code
Status
)
{
func
(
me
*
DefaultRawFileSystem
)
Create
(
header
*
InHeader
,
input
*
CreateIn
,
name
string
)
(
flags
uint32
,
handle
uint64
,
out
*
EntryOut
,
code
Status
)
{
return
0
,
0
,
nil
,
ENOSYS
}
func
(
me
*
DefaultRawF
useF
ileSystem
)
Bmap
(
header
*
InHeader
,
input
*
BmapIn
)
(
out
*
BmapOut
,
code
Status
)
{
func
(
me
*
DefaultRawFileSystem
)
Bmap
(
header
*
InHeader
,
input
*
BmapIn
)
(
out
*
BmapOut
,
code
Status
)
{
return
nil
,
ENOSYS
}
func
(
me
*
DefaultRawF
useF
ileSystem
)
Ioctl
(
header
*
InHeader
,
input
*
IoctlIn
)
(
out
*
IoctlOut
,
code
Status
)
{
func
(
me
*
DefaultRawFileSystem
)
Ioctl
(
header
*
InHeader
,
input
*
IoctlIn
)
(
out
*
IoctlOut
,
code
Status
)
{
return
nil
,
ENOSYS
}
func
(
me
*
DefaultRawF
useF
ileSystem
)
Poll
(
header
*
InHeader
,
input
*
PollIn
)
(
out
*
PollOut
,
code
Status
)
{
func
(
me
*
DefaultRawFileSystem
)
Poll
(
header
*
InHeader
,
input
*
PollIn
)
(
out
*
PollOut
,
code
Status
)
{
return
nil
,
ENOSYS
}
func
(
me
*
DefaultRawF
useF
ileSystem
)
OpenDir
(
header
*
InHeader
,
input
*
OpenIn
)
(
flags
uint32
,
handle
uint64
,
status
Status
)
{
func
(
me
*
DefaultRawFileSystem
)
OpenDir
(
header
*
InHeader
,
input
*
OpenIn
)
(
flags
uint32
,
handle
uint64
,
status
Status
)
{
return
0
,
0
,
ENOSYS
}
func
(
me
*
DefaultRawF
useF
ileSystem
)
Read
(
*
ReadIn
,
*
BufferPool
)
([]
byte
,
Status
)
{
func
(
me
*
DefaultRawFileSystem
)
Read
(
*
ReadIn
,
*
BufferPool
)
([]
byte
,
Status
)
{
return
nil
,
ENOSYS
}
func
(
me
*
DefaultRawF
useF
ileSystem
)
Release
(
header
*
InHeader
,
input
*
ReleaseIn
)
{
func
(
me
*
DefaultRawFileSystem
)
Release
(
header
*
InHeader
,
input
*
ReleaseIn
)
{
}
func
(
me
*
DefaultRawF
useF
ileSystem
)
Write
(
input
*
WriteIn
,
data
[]
byte
)
(
written
uint32
,
code
Status
)
{
func
(
me
*
DefaultRawFileSystem
)
Write
(
input
*
WriteIn
,
data
[]
byte
)
(
written
uint32
,
code
Status
)
{
return
0
,
ENOSYS
}
func
(
me
*
DefaultRawF
useF
ileSystem
)
Flush
(
input
*
FlushIn
)
Status
{
func
(
me
*
DefaultRawFileSystem
)
Flush
(
input
*
FlushIn
)
Status
{
return
OK
}
func
(
me
*
DefaultRawF
useF
ileSystem
)
Fsync
(
input
*
FsyncIn
)
(
code
Status
)
{
func
(
me
*
DefaultRawFileSystem
)
Fsync
(
input
*
FsyncIn
)
(
code
Status
)
{
return
ENOSYS
}
func
(
me
*
DefaultRawF
useF
ileSystem
)
ReadDir
(
header
*
InHeader
,
input
*
ReadIn
)
(
*
DirEntryList
,
Status
)
{
func
(
me
*
DefaultRawFileSystem
)
ReadDir
(
header
*
InHeader
,
input
*
ReadIn
)
(
*
DirEntryList
,
Status
)
{
return
nil
,
ENOSYS
}
func
(
me
*
DefaultRawF
useF
ileSystem
)
ReleaseDir
(
header
*
InHeader
,
input
*
ReleaseIn
)
{
func
(
me
*
DefaultRawFileSystem
)
ReleaseDir
(
header
*
InHeader
,
input
*
ReleaseIn
)
{
}
func
(
me
*
DefaultRawF
useF
ileSystem
)
FsyncDir
(
header
*
InHeader
,
input
*
FsyncIn
)
(
code
Status
)
{
func
(
me
*
DefaultRawFileSystem
)
FsyncDir
(
header
*
InHeader
,
input
*
FsyncIn
)
(
code
Status
)
{
return
ENOSYS
}
////////////////////////////////////////////////////////////////
// DefaultF
useF
ile
// DefaultFile
func
(
me
*
DefaultF
useF
ile
)
Read
(
*
ReadIn
,
*
BufferPool
)
([]
byte
,
Status
)
{
func
(
me
*
DefaultFile
)
Read
(
*
ReadIn
,
*
BufferPool
)
([]
byte
,
Status
)
{
return
[]
byte
(
""
),
ENOSYS
}
func
(
me
*
DefaultF
useF
ile
)
Write
(
*
WriteIn
,
[]
byte
)
(
uint32
,
Status
)
{
func
(
me
*
DefaultFile
)
Write
(
*
WriteIn
,
[]
byte
)
(
uint32
,
Status
)
{
return
0
,
ENOSYS
}
func
(
me
*
DefaultF
useF
ile
)
Flush
()
Status
{
func
(
me
*
DefaultFile
)
Flush
()
Status
{
return
ENOSYS
}
func
(
me
*
DefaultF
useF
ile
)
Release
()
{
func
(
me
*
DefaultFile
)
Release
()
{
}
func
(
me
*
DefaultF
useF
ile
)
Fsync
(
*
FsyncIn
)
(
code
Status
)
{
func
(
me
*
DefaultFile
)
Fsync
(
*
FsyncIn
)
(
code
Status
)
{
return
ENOSYS
}
...
...
@@ -225,7 +225,7 @@ func (me *DefaultPathFileSystem) Truncate(name string, offset uint64) (code Stat
return
ENOSYS
}
func
(
me
*
DefaultPathFileSystem
)
Open
(
name
string
,
flags
uint32
)
(
file
F
useF
ile
,
code
Status
)
{
func
(
me
*
DefaultPathFileSystem
)
Open
(
name
string
,
flags
uint32
)
(
file
File
,
code
Status
)
{
return
nil
,
ENOSYS
}
...
...
@@ -244,7 +244,7 @@ func (me *DefaultPathFileSystem) Access(name string, mode uint32) (code Status)
return
ENOSYS
}
func
(
me
*
DefaultPathFileSystem
)
Create
(
name
string
,
flags
uint32
,
mode
uint32
)
(
file
F
useF
ile
,
code
Status
)
{
func
(
me
*
DefaultPathFileSystem
)
Create
(
name
string
,
flags
uint32
,
mode
uint32
)
(
file
File
,
code
Status
)
{
return
nil
,
ENOSYS
}
...
...
fuse/default_test.go
View file @
9c3ac0b4
...
...
@@ -10,7 +10,7 @@ import (
func
TestRawFs
(
t
*
testing
.
T
)
{
var
iface
RawFileSystem
iface
=
new
(
DefaultRawF
useF
ileSystem
)
iface
=
new
(
DefaultRawFileSystem
)
iface
=
new
(
WrappingRawFileSystem
)
iface
=
new
(
TimingRawFileSystem
)
...
...
@@ -27,7 +27,7 @@ func TestPathFs(t *testing.T) {
}
func
TestDummyFile
(
t
*
testing
.
T
)
{
d
:=
new
(
DefaultF
useF
ile
)
var
filePtr
F
useF
ile
=
d
d
:=
new
(
DefaultFile
)
var
filePtr
File
=
d
_
=
filePtr
}
fuse/devnull.go
View file @
9c3ac0b4
...
...
@@ -2,7 +2,7 @@ package fuse
// A FUSE file that accepts any write, and always returns EOF.
type
DevNullFile
struct
{
DefaultF
useF
ile
DefaultFile
}
func
NewDevNullFile
()
*
DevNullFile
{
...
...
fuse/direntry.go
View file @
9c3ac0b4
...
...
@@ -65,12 +65,12 @@ func (me *DirEntryList) Bytes() []byte {
////////////////////////////////////////////////////////////////
type
Fuse
Dir
struct
{
type
Dir
struct
{
stream
chan
DirEntry
leftOver
DirEntry
}
func
(
me
*
Fuse
Dir
)
inode
(
name
string
)
uint64
{
func
(
me
*
Dir
)
inode
(
name
string
)
uint64
{
// We could also return
// me.connector.lookupUpdate(me.parentIno, name).NodeId but it
// appears FUSE will issue a LOOKUP afterwards for the entry
...
...
@@ -78,7 +78,7 @@ func (me *FuseDir) inode(name string) uint64 {
return
FUSE_UNKNOWN_INO
}
func
(
me
*
Fuse
Dir
)
ReadDir
(
input
*
ReadIn
)
(
*
DirEntryList
,
Status
)
{
func
(
me
*
Dir
)
ReadDir
(
input
*
ReadIn
)
(
*
DirEntryList
,
Status
)
{
if
me
.
stream
==
nil
{
return
nil
,
OK
}
...
...
@@ -112,7 +112,7 @@ func (me *FuseDir) ReadDir(input *ReadIn) (*DirEntryList, Status) {
}
// Read everything so we make goroutines exit.
func
(
me
*
Fuse
Dir
)
Release
()
{
func
(
me
*
Dir
)
Release
()
{
for
ok
:=
true
;
ok
&&
me
.
stream
!=
nil
;
{
_
,
ok
=
<-
me
.
stream
if
!
ok
{
...
...
fuse/fuse.go
View file @
9c3ac0b4
...
...
@@ -193,7 +193,7 @@ func (me *MountState) Stats() string {
////////////////////////////////////////////////////////////////
// Logic for the control loop.
func
(
me
*
MountState
)
new
Fuse
Request
()
*
fuseRequest
{
func
(
me
*
MountState
)
newRequest
()
*
fuseRequest
{
req
:=
new
(
fuseRequest
)
req
.
status
=
OK
req
.
inputBuf
=
me
.
buffers
.
AllocBuffer
(
bufSize
)
...
...
@@ -209,7 +209,7 @@ func (me *MountState) readRequest(req *fuseRequest) os.Error {
return
err
}
func
(
me
*
MountState
)
discard
Fuse
Request
(
req
*
fuseRequest
)
{
func
(
me
*
MountState
)
discardRequest
(
req
*
fuseRequest
)
{
endNs
:=
time
.
Nanoseconds
()
dt
:=
endNs
-
req
.
startNs
...
...
@@ -236,7 +236,7 @@ func (me *MountState) discardFuseRequest(req *fuseRequest) {
func
(
me
*
MountState
)
loop
()
{
// See fuse_kern_chan_receive()
for
{
req
:=
me
.
new
Fuse
Request
()
req
:=
me
.
newRequest
()
err
:=
me
.
readRequest
(
req
)
if
err
!=
nil
{
...
...
@@ -244,7 +244,7 @@ func (me *MountState) loop() {
// Retry.
if
errNo
==
syscall
.
ENOENT
{
me
.
discard
Fuse
Request
(
req
)
me
.
discardRequest
(
req
)
continue
}
...
...
@@ -273,7 +273,7 @@ func (me *MountState) loop() {
}
func
(
me
*
MountState
)
handle
(
req
*
fuseRequest
)
{
defer
me
.
discard
Fuse
Request
(
req
)
defer
me
.
discardRequest
(
req
)
req
.
dispatchNs
=
time
.
Nanoseconds
()
inHSize
:=
unsafe
.
Sizeof
(
InHeader
{})
...
...
@@ -339,7 +339,7 @@ func (me *MountState) dispatch(req *fuseRequest) {
// Follow ordering of fuse_lowlevel.h.
switch
h
.
Opcode
{
case
FUSE_INIT
:
req
.
data
,
status
=
initFuse
(
me
,
h
,
(
*
InitIn
)(
inData
))
req
.
data
,
status
=
me
.
init
(
h
,
(
*
InitIn
)(
inData
))
case
FUSE_DESTROY
:
fs
.
Destroy
(
h
,
(
*
InitIn
)(
inData
))
case
FUSE_LOOKUP
:
...
...
@@ -496,8 +496,8 @@ func serialize(req *fuseRequest, debug bool) {
}
}
func
initFuse
(
state
*
MountState
,
h
*
InHeader
,
input
*
InitIn
)
(
unsafe
.
Pointer
,
Status
)
{
out
,
initStatus
:=
stat
e
.
fileSystem
.
Init
(
h
,
input
)
func
(
me
*
MountState
)
init
(
h
*
InHeader
,
input
*
InitIn
)
(
unsafe
.
Pointer
,
Status
)
{
out
,
initStatus
:=
m
e
.
fileSystem
.
Init
(
h
,
input
)
if
initStatus
!=
OK
{
return
nil
,
initStatus
}
...
...
fuse/lockingfs.go
View file @
9c3ac0b4
...
...
@@ -92,7 +92,7 @@ func (me *LockingPathFileSystem) Truncate(name string, offset uint64) (code Stat
return
me
.
Original
.
Truncate
(
name
,
offset
)
}
func
(
me
*
LockingPathFileSystem
)
Open
(
name
string
,
flags
uint32
)
(
file
F
useF
ile
,
code
Status
)
{
func
(
me
*
LockingPathFileSystem
)
Open
(
name
string
,
flags
uint32
)
(
file
File
,
code
Status
)
{
return
me
.
Original
.
Open
(
name
,
flags
)
}
...
...
@@ -120,7 +120,7 @@ func (me *LockingPathFileSystem) Access(name string, mode uint32) (code Status)
return
me
.
Original
.
Access
(
name
,
mode
)
}
func
(
me
*
LockingPathFileSystem
)
Create
(
name
string
,
flags
uint32
,
mode
uint32
)
(
file
F
useF
ile
,
code
Status
)
{
func
(
me
*
LockingPathFileSystem
)
Create
(
name
string
,
flags
uint32
,
mode
uint32
)
(
file
File
,
code
Status
)
{
me
.
lock
.
Lock
()
defer
me
.
lock
.
Unlock
()
return
me
.
Original
.
Create
(
name
,
flags
,
mode
)
...
...
fuse/loopback.go
View file @
9c3ac0b4
...
...
@@ -77,7 +77,7 @@ func (me *LoopbackFileSystem) OpenDir(name string) (stream chan DirEntry, status
return
output
,
OK
}
func
(
me
*
LoopbackFileSystem
)
Open
(
name
string
,
flags
uint32
)
(
fuseFile
F
useF
ile
,
status
Status
)
{
func
(
me
*
LoopbackFileSystem
)
Open
(
name
string
,
flags
uint32
)
(
fuseFile
File
,
status
Status
)
{
f
,
err
:=
os
.
OpenFile
(
me
.
GetPath
(
name
),
int
(
flags
),
0
)
if
err
!=
nil
{
return
nil
,
OsErrorToErrno
(
err
)
...
...
@@ -141,7 +141,7 @@ func (me *LoopbackFileSystem) Access(name string, mode uint32) (code Status) {
return
Status
(
syscall
.
Access
(
me
.
GetPath
(
name
),
mode
))
}
func
(
me
*
LoopbackFileSystem
)
Create
(
path
string
,
flags
uint32
,
mode
uint32
)
(
fuseFile
F
useF
ile
,
code
Status
)
{
func
(
me
*
LoopbackFileSystem
)
Create
(
path
string
,
flags
uint32
,
mode
uint32
)
(
fuseFile
File
,
code
Status
)
{
f
,
err
:=
os
.
OpenFile
(
me
.
GetPath
(
path
),
int
(
flags
)
|
os
.
O_CREATE
,
mode
)
return
&
LoopbackFile
{
file
:
f
},
OsErrorToErrno
(
err
)
}
...
...
@@ -175,7 +175,7 @@ func (me *LoopbackFileSystem) FillOptions(options *PathFileSystemConnectorOption
type
LoopbackFile
struct
{
file
*
os
.
File
DefaultF
useF
ile
DefaultFile
}
func
(
me
*
LoopbackFile
)
Read
(
input
*
ReadIn
,
buffers
*
BufferPool
)
([]
byte
,
Status
)
{
...
...
fuse/loopback_test.go
View file @
9c3ac0b4
...
...
@@ -122,7 +122,7 @@ func (me *testCase) testOpenUnreadable() {
}
}
func
(
me
*
testCase
)
testReadThrough
Fuse
()
{
func
(
me
*
testCase
)
testReadThrough
()
{
me
.
writeOrigFile
()
fmt
.
Println
(
"Testing chmod."
)
...
...
@@ -167,7 +167,7 @@ func (me *testCase) testRemove() {
}
}
func
(
me
*
testCase
)
testWriteThrough
Fuse
()
{
func
(
me
*
testCase
)
testWriteThrough
()
{
// Create (for write), write.
me
.
tester
.
Log
(
"Testing create."
)
f
,
err
:=
os
.
OpenFile
(
me
.
mountFile
,
os
.
O_WRONLY
|
os
.
O_CREATE
,
0644
)
...
...
@@ -562,7 +562,7 @@ func TestMount(t *testing.T) {
ts
.
testOverwriteRename
()
ts
.
testDelRename
()
ts
.
testOpenUnreadable
()
ts
.
testReadThrough
Fuse
()
ts
.
testReadThrough
()
ts
.
testRemove
()
ts
.
testMkdirRmdir
()
ts
.
testLink
()
...
...
fuse/pathdebug.go
View file @
9c3ac0b4
...
...
@@ -12,7 +12,7 @@ type PathFileSystemDebug struct {
WrappingPathFileSystem
}
func
(
me
*
PathFileSystemDebug
)
Open
(
path
string
,
flags
uint32
)
(
fuseFile
F
useF
ile
,
status
Status
)
{
func
(
me
*
PathFileSystemDebug
)
Open
(
path
string
,
flags
uint32
)
(
fuseFile
File
,
status
Status
)
{
if
path
==
".debug"
&&
me
.
Connector
!=
nil
{
return
NewReadOnlyFile
([]
byte
(
me
.
Connector
.
DebugString
())),
OK
}
...
...
fuse/pathfilesystem.go
View file @
9c3ac0b4
...
...
@@ -146,7 +146,7 @@ type PathFileSystemConnectorOptions struct {
}
type
PathFileSystemConnector
struct
{
DefaultRawF
useF
ileSystem
DefaultRawFileSystem
options
PathFileSystemConnectorOptions
Debug
bool
...
...
@@ -207,16 +207,16 @@ func (me *PathFileSystemConnector) registerFile(node *inode, f interface{}) uint
return
h
}
func
(
me
*
PathFileSystemConnector
)
getDir
(
h
uint64
)
Raw
Fuse
Dir
{
func
(
me
*
PathFileSystemConnector
)
getDir
(
h
uint64
)
RawDir
{
me
.
fileLock
.
RLock
()
defer
me
.
fileLock
.
RUnlock
()
return
me
.
openFiles
[
h
]
.
(
Raw
Fuse
Dir
)
return
me
.
openFiles
[
h
]
.
(
RawDir
)
}
func
(
me
*
PathFileSystemConnector
)
getFile
(
h
uint64
)
F
useF
ile
{
func
(
me
*
PathFileSystemConnector
)
getFile
(
h
uint64
)
File
{
me
.
fileLock
.
RLock
()
defer
me
.
fileLock
.
RUnlock
()
return
me
.
openFiles
[
h
]
.
(
F
useF
ile
)
return
me
.
openFiles
[
h
]
.
(
File
)
}
func
(
me
*
PathFileSystemConnector
)
verify
()
{
...
...
@@ -583,7 +583,7 @@ func (me *PathFileSystemConnector) OpenDir(header *InHeader, input *OpenIn) (fla
return
0
,
0
,
err
}
de
:=
new
(
Fuse
Dir
)
de
:=
new
(
Dir
)
de
.
stream
=
stream
h
:=
me
.
registerFile
(
node
,
de
)
...
...
@@ -797,14 +797,14 @@ func (me *PathFileSystemConnector) Create(header *InHeader, input *CreateIn, nam
func
(
me
*
PathFileSystemConnector
)
Release
(
header
*
InHeader
,
input
*
ReleaseIn
)
{
node
:=
me
.
getInodeData
(
header
.
NodeId
)
f
:=
me
.
unregisterFile
(
node
,
input
.
Fh
)
.
(
F
useF
ile
)
f
:=
me
.
unregisterFile
(
node
,
input
.
Fh
)
.
(
File
)
f
.
Release
()
me
.
considerDropInode
(
node
)
}
func
(
me
*
PathFileSystemConnector
)
ReleaseDir
(
header
*
InHeader
,
input
*
ReleaseIn
)
{
node
:=
me
.
getInodeData
(
header
.
NodeId
)
d
:=
me
.
unregisterFile
(
node
,
input
.
Fh
)
.
(
Raw
Fuse
Dir
)
d
:=
me
.
unregisterFile
(
node
,
input
.
Fh
)
.
(
RawDir
)
d
.
Release
()
me
.
considerDropInode
(
node
)
}
...
...
@@ -863,7 +863,7 @@ func (me *PathFileSystemConnector) ListXAttr(header *InHeader) (data []byte, cod
}
func
(
me
*
PathFileSystemConnector
)
Write
(
input
*
WriteIn
,
data
[]
byte
)
(
written
uint32
,
code
Status
)
{
f
:=
me
.
getFile
(
input
.
Fh
)
.
(
F
useF
ile
)
f
:=
me
.
getFile
(
input
.
Fh
)
.
(
File
)
return
f
.
Write
(
input
,
data
)
}
...
...
fuse/timingfs.go
View file @
9c3ac0b4
...
...
@@ -166,7 +166,7 @@ func (me *TimingPathFileSystem) Truncate(name string, offset uint64) (code Statu
return
me
.
Original
.
Truncate
(
name
,
offset
)
}
func
(
me
*
TimingPathFileSystem
)
Open
(
name
string
,
flags
uint32
)
(
file
F
useF
ile
,
code
Status
)
{
func
(
me
*
TimingPathFileSystem
)
Open
(
name
string
,
flags
uint32
)
(
file
File
,
code
Status
)
{
defer
me
.
startTimer
(
"Open"
,
name
)()
return
me
.
Original
.
Open
(
name
,
flags
)
}
...
...
@@ -191,7 +191,7 @@ func (me *TimingPathFileSystem) Access(name string, mode uint32) (code Status) {
return
me
.
Original
.
Access
(
name
,
mode
)
}
func
(
me
*
TimingPathFileSystem
)
Create
(
name
string
,
flags
uint32
,
mode
uint32
)
(
file
F
useF
ile
,
code
Status
)
{
func
(
me
*
TimingPathFileSystem
)
Create
(
name
string
,
flags
uint32
,
mode
uint32
)
(
file
File
,
code
Status
)
{
defer
me
.
startTimer
(
"Create"
,
name
)()
return
me
.
Original
.
Create
(
name
,
flags
,
mode
)
}
...
...
fuse/types.go
View file @
9c3ac0b4
...
...
@@ -547,7 +547,7 @@ type RawFileSystem interface {
FsyncDir
(
header
*
InHeader
,
input
*
FsyncIn
)
(
code
Status
)
}
type
F
useF
ile
interface
{
type
File
interface
{
Read
(
*
ReadIn
,
*
BufferPool
)
([]
byte
,
Status
)
// u32 <-> u64 ?
Write
(
*
WriteIn
,
[]
byte
)
(
written
uint32
,
code
Status
)
...
...
@@ -556,7 +556,7 @@ type FuseFile interface {
Fsync
(
*
FsyncIn
)
(
code
Status
)
}
type
Raw
Fuse
Dir
interface
{
type
RawDir
interface
{
ReadDir
(
input
*
ReadIn
)
(
*
DirEntryList
,
Status
)
Release
()
}
...
...
@@ -574,7 +574,7 @@ type PathFileSystem interface {
Chmod
(
name
string
,
mode
uint32
)
(
code
Status
)
Chown
(
name
string
,
uid
uint32
,
gid
uint32
)
(
code
Status
)
Truncate
(
name
string
,
offset
uint64
)
(
code
Status
)
Open
(
name
string
,
flags
uint32
)
(
file
F
useF
ile
,
code
Status
)
Open
(
name
string
,
flags
uint32
)
(
file
File
,
code
Status
)
GetXAttr
(
name
string
,
attribute
string
)
(
data
[]
byte
,
code
Status
)
SetXAttr
(
name
string
,
attr
string
,
data
[]
byte
,
flags
int
)
Status
...
...
@@ -590,7 +590,7 @@ type PathFileSystem interface {
Unmount
()
Access
(
name
string
,
mode
uint32
)
(
code
Status
)
Create
(
name
string
,
flags
uint32
,
mode
uint32
)
(
file
F
useF
ile
,
code
Status
)
Create
(
name
string
,
flags
uint32
,
mode
uint32
)
(
file
File
,
code
Status
)
Utimens
(
name
string
,
AtimeNs
uint64
,
CtimeNs
uint64
)
(
code
Status
)
// unimplemented: poll, ioctl, bmap.
...
...
@@ -600,5 +600,5 @@ type PathFileSystem interface {
// implementations.
type
DefaultPathFileSystem
struct
{}
type
DefaultF
useF
ile
struct
{}
type
DefaultRawF
useF
ileSystem
struct
{}
type
DefaultFile
struct
{}
type
DefaultRawFileSystem
struct
{}
fuse/wrappedfs.go
View file @
9c3ac0b4
...
...
@@ -54,7 +54,7 @@ func (me *WrappingPathFileSystem) Truncate(name string, offset uint64) (code Sta
return
me
.
Original
.
Truncate
(
name
,
offset
)
}
func
(
me
*
WrappingPathFileSystem
)
Open
(
name
string
,
flags
uint32
)
(
file
F
useF
ile
,
code
Status
)
{
func
(
me
*
WrappingPathFileSystem
)
Open
(
name
string
,
flags
uint32
)
(
file
File
,
code
Status
)
{
return
me
.
Original
.
Open
(
name
,
flags
)
}
...
...
@@ -74,7 +74,7 @@ func (me *WrappingPathFileSystem) Access(name string, mode uint32) (code Status)
return
me
.
Original
.
Access
(
name
,
mode
)
}
func
(
me
*
WrappingPathFileSystem
)
Create
(
name
string
,
flags
uint32
,
mode
uint32
)
(
file
F
useF
ile
,
code
Status
)
{
func
(
me
*
WrappingPathFileSystem
)
Create
(
name
string
,
flags
uint32
,
mode
uint32
)
(
file
File
,
code
Status
)
{
return
me
.
Original
.
Create
(
name
,
flags
,
mode
)
}
...
...
unionfs/unionfs.go
View file @
9c3ac0b4
...
...
@@ -287,7 +287,7 @@ func (me *UnionFs) Readlink(name string) (out string, code fuse.Status) {
return
""
,
fuse
.
ENOENT
}
func
(
me
*
UnionFs
)
Create
(
name
string
,
flags
uint32
,
mode
uint32
)
(
fuseFile
fuse
.
F
useF
ile
,
code
fuse
.
Status
)
{
func
(
me
*
UnionFs
)
Create
(
name
string
,
flags
uint32
,
mode
uint32
)
(
fuseFile
fuse
.
File
,
code
fuse
.
Status
)
{
// TODO(hanwen) - we should check that the name is not a
// directory in another branch.
writable
:=
me
.
fileSystems
[
0
]
...
...
@@ -406,7 +406,7 @@ func (me *UnionFs) OpenDir(directory string) (stream chan fuse.DirEntry, status
return
stream
,
fuse
.
OK
}
func
(
me
*
UnionFs
)
Open
(
name
string
,
flags
uint32
)
(
fuseFile
fuse
.
F
useF
ile
,
status
fuse
.
Status
)
{
func
(
me
*
UnionFs
)
Open
(
name
string
,
flags
uint32
)
(
fuseFile
fuse
.
File
,
status
fuse
.
Status
)
{
branch
:=
me
.
getBranch
(
name
)
if
flags
&
fuse
.
O_ANYWRITE
!=
0
&&
branch
>
0
{
err
:=
me
.
Promote
(
name
,
me
.
branches
[
branch
])
...
...
zipfs/multizip.go
View file @
9c3ac0b4
...
...
@@ -31,7 +31,7 @@ type zipCreateFile struct {
Basename
string
zfs
*
MultiZipFs
fuse
.
DefaultF
useF
ile
fuse
.
DefaultFile
}
func
(
me
*
zipCreateFile
)
Write
(
input
*
fuse
.
WriteIn
,
nameBytes
[]
byte
)
(
uint32
,
fuse
.
Status
)
{
...
...
@@ -184,7 +184,7 @@ func (me *MultiZipFs) Unlink(name string) (code fuse.Status) {
return
fuse
.
EPERM
}
func
(
me
*
MultiZipFs
)
Open
(
name
string
,
flags
uint32
)
(
file
fuse
.
F
useF
ile
,
code
fuse
.
Status
)
{
func
(
me
*
MultiZipFs
)
Open
(
name
string
,
flags
uint32
)
(
file
fuse
.
File
,
code
fuse
.
Status
)
{
if
0
!=
flags
&
uint32
(
fuse
.
O_ANYWRITE
)
{
return
nil
,
fuse
.
EPERM
}
...
...
@@ -205,7 +205,7 @@ func (me *MultiZipFs) Open(name string, flags uint32) (file fuse.FuseFile, code
return
nil
,
fuse
.
ENOENT
}
func
(
me
*
MultiZipFs
)
Create
(
name
string
,
flags
uint32
,
mode
uint32
)
(
file
fuse
.
F
useF
ile
,
code
fuse
.
Status
)
{
func
(
me
*
MultiZipFs
)
Create
(
name
string
,
flags
uint32
,
mode
uint32
)
(
file
fuse
.
File
,
code
fuse
.
Status
)
{
dir
,
base
:=
filepath
.
Split
(
name
)
if
dir
!=
CONFIG_PREFIX
{
return
nil
,
fuse
.
EPERM
...
...
zipfs/zipfs.go
View file @
9c3ac0b4
...
...
@@ -135,7 +135,7 @@ func (me *ZipArchiveFileSystem) GetAttr(name string) (*fuse.Attr, fuse.Status) {
return
a
,
fuse
.
OK
}
func
(
me
*
ZipArchiveFileSystem
)
Open
(
name
string
,
flags
uint32
)
(
file
fuse
.
F
useF
ile
,
code
fuse
.
Status
)
{
func
(
me
*
ZipArchiveFileSystem
)
Open
(
name
string
,
flags
uint32
)
(
file
fuse
.
File
,
code
fuse
.
Status
)
{
if
flags
&
fuse
.
O_ANYWRITE
!=
0
{
return
nil
,
fuse
.
EPERM
}
...
...
@@ -180,10 +180,10 @@ func (me *ZipArchiveFileSystem) OpenDir(name string) (stream chan fuse.DirEntry,
type
ZipFile
struct
{
data
[]
byte
fuse
.
DefaultF
useF
ile
fuse
.
DefaultFile
}
func
NewZipFile
(
f
*
zip
.
File
)
fuse
.
F
useF
ile
{
func
NewZipFile
(
f
*
zip
.
File
)
fuse
.
File
{
data
:=
make
([]
byte
,
f
.
UncompressedSize
)
rc
,
err
:=
f
.
Open
()
if
err
!=
nil
{
...
...
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