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
f7febb40
Commit
f7febb40
authored
Apr 21, 2011
by
Han-Wen Nienhuys
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Run Gofmt.
parent
20262305
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
21 additions
and
22 deletions
+21
-22
fuse/direntry.go
fuse/direntry.go
+3
-3
fuse/fuse.go
fuse/fuse.go
+1
-2
fuse/loopback_test.go
fuse/loopback_test.go
+1
-1
fuse/misc.go
fuse/misc.go
+1
-1
fuse/pathfilesystem.go
fuse/pathfilesystem.go
+13
-13
fuse/timingrawfs.go
fuse/timingrawfs.go
+1
-1
fuse/types.go
fuse/types.go
+1
-1
No files found.
fuse/direntry.go
View file @
f7febb40
...
@@ -66,8 +66,8 @@ func (me *DirEntryList) Bytes() []byte {
...
@@ -66,8 +66,8 @@ func (me *DirEntryList) Bytes() []byte {
////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////
type
FuseDir
struct
{
type
FuseDir
struct
{
stream
chan
DirEntry
stream
chan
DirEntry
leftOver
DirEntry
leftOver
DirEntry
DefaultRawFuseDir
DefaultRawFuseDir
}
}
...
@@ -116,7 +116,7 @@ func (me *FuseDir) ReadDir(input *ReadIn) (*DirEntryList, Status) {
...
@@ -116,7 +116,7 @@ func (me *FuseDir) ReadDir(input *ReadIn) (*DirEntryList, Status) {
// Read everything so we make goroutines exit.
// Read everything so we make goroutines exit.
func
(
me
*
FuseDir
)
Release
()
{
func
(
me
*
FuseDir
)
Release
()
{
for
ok
:=
true
;
ok
&&
me
.
stream
!=
nil
;
{
for
ok
:=
true
;
ok
&&
me
.
stream
!=
nil
;
{
_
,
ok
=
<-
me
.
stream
_
,
ok
=
<-
me
.
stream
if
!
ok
{
if
!
ok
{
break
break
}
}
...
...
fuse/fuse.go
View file @
f7febb40
...
@@ -529,7 +529,7 @@ func doOpen(state *MountState, header *InHeader, input *OpenIn) (unsafe.Pointer,
...
@@ -529,7 +529,7 @@ func doOpen(state *MountState, header *InHeader, input *OpenIn) (unsafe.Pointer,
if
status
!=
OK
{
if
status
!=
OK
{
return
nil
,
status
return
nil
,
status
}
}
out
:=
new
(
OpenOut
)
out
:=
new
(
OpenOut
)
out
.
Fh
=
handle
out
.
Fh
=
handle
out
.
OpenFlags
=
flags
out
.
OpenFlags
=
flags
...
@@ -609,4 +609,3 @@ func doReadDir(state *MountState, header *InHeader, input *ReadIn) (out []byte,
...
@@ -609,4 +609,3 @@ func doReadDir(state *MountState, header *InHeader, input *ReadIn) (out []byte,
}
}
return
entries
.
Bytes
(),
code
return
entries
.
Bytes
(),
code
}
}
fuse/loopback_test.go
View file @
f7febb40
...
@@ -64,7 +64,7 @@ func (me *testCase) Setup(t *testing.T) {
...
@@ -64,7 +64,7 @@ func (me *testCase) Setup(t *testing.T) {
rfs
=
me
.
connector
rfs
=
me
.
connector
rfs
=
NewTimingRawFilesystem
(
rfs
)
rfs
=
NewTimingRawFilesystem
(
rfs
)
rfs
=
NewLockingRawFilesystem
(
rfs
)
rfs
=
NewLockingRawFilesystem
(
rfs
)
me
.
connector
.
Debug
=
true
me
.
connector
.
Debug
=
true
me
.
state
=
NewMountState
(
rfs
)
me
.
state
=
NewMountState
(
rfs
)
me
.
state
.
Mount
(
me
.
mountPoint
)
me
.
state
.
Mount
(
me
.
mountPoint
)
...
...
fuse/misc.go
View file @
f7febb40
...
@@ -44,7 +44,7 @@ func OsErrorToFuseError(err os.Error) Status {
...
@@ -44,7 +44,7 @@ func OsErrorToFuseError(err os.Error) Status {
}
}
func
replyString
(
opcode
uint32
,
ptr
unsafe
.
Pointer
)
string
{
func
replyString
(
opcode
uint32
,
ptr
unsafe
.
Pointer
)
string
{
var
val
interface
{}
var
val
interface
{}
switch
opcode
{
switch
opcode
{
case
FUSE_LOOKUP
:
case
FUSE_LOOKUP
:
val
=
(
*
EntryOut
)(
ptr
)
val
=
(
*
EntryOut
)(
ptr
)
...
...
fuse/pathfilesystem.go
View file @
f7febb40
...
@@ -36,7 +36,7 @@ type inode struct {
...
@@ -36,7 +36,7 @@ type inode struct {
Name
string
Name
string
LookupCount
int
LookupCount
int
OpenCount
int
OpenCount
int
Type
uint32
// dirent type, used to check if mounts are valid.
Type
uint32
// dirent type, used to check if mounts are valid.
mount
*
mountData
mount
*
mountData
}
}
...
@@ -143,7 +143,7 @@ type PathFileSystemConnector struct {
...
@@ -143,7 +143,7 @@ type PathFileSystemConnector struct {
Debug
bool
Debug
bool
////////////////
////////////////
// Protects the inode hashmap, its contents and the nextFreeInode counter.
// Protects the inode hashmap, its contents and the nextFreeInode counter.
lock
sync
.
RWMutex
lock
sync
.
RWMutex
...
@@ -152,8 +152,8 @@ type PathFileSystemConnector struct {
...
@@ -152,8 +152,8 @@ type PathFileSystemConnector struct {
nextFreeInode
uint64
nextFreeInode
uint64
// Open files/directories.
// Open files/directories.
fileLock
sync
.
RWMutex
fileLock
sync
.
RWMutex
openFiles
map
[
uint64
]
interface
{}
openFiles
map
[
uint64
]
interface
{}
nextFreeHandle
uint64
nextFreeHandle
uint64
}
}
...
@@ -179,7 +179,7 @@ func (me *PathFileSystemConnector) registerFile(node *inode, f interface{}) uint
...
@@ -179,7 +179,7 @@ func (me *PathFileSystemConnector) registerFile(node *inode, f interface{}) uint
if
ok
{
if
ok
{
panic
(
"handle counter wrapped"
)
panic
(
"handle counter wrapped"
)
}
}
node
.
OpenCount
++
node
.
OpenCount
++
me
.
openFiles
[
h
]
=
f
me
.
openFiles
[
h
]
=
f
return
h
return
h
...
@@ -190,7 +190,7 @@ func (me *PathFileSystemConnector) getDir(h uint64) RawFuseDir {
...
@@ -190,7 +190,7 @@ func (me *PathFileSystemConnector) getDir(h uint64) RawFuseDir {
defer
me
.
fileLock
.
RUnlock
()
defer
me
.
fileLock
.
RUnlock
()
return
me
.
openFiles
[
h
]
.
(
RawFuseDir
)
return
me
.
openFiles
[
h
]
.
(
RawFuseDir
)
}
}
func
(
me
*
PathFileSystemConnector
)
getFile
(
h
uint64
)
FuseFile
{
func
(
me
*
PathFileSystemConnector
)
getFile
(
h
uint64
)
FuseFile
{
me
.
fileLock
.
RLock
()
me
.
fileLock
.
RLock
()
defer
me
.
fileLock
.
RUnlock
()
defer
me
.
fileLock
.
RUnlock
()
...
@@ -215,7 +215,7 @@ func (me *PathFileSystemConnector) newInode() *inode {
...
@@ -215,7 +215,7 @@ func (me *PathFileSystemConnector) newInode() *inode {
me
.
nextFreeInode
++
me
.
nextFreeInode
++
me
.
inodeMap
[
data
.
NodeId
]
=
data
me
.
inodeMap
[
data
.
NodeId
]
=
data
return
data
return
data
}
}
...
@@ -325,7 +325,7 @@ func NewPathFileSystemConnector(fs PathFilesystem) (out *PathFileSystemConnector
...
@@ -325,7 +325,7 @@ func NewPathFileSystemConnector(fs PathFilesystem) (out *PathFileSystemConnector
out
=
new
(
PathFileSystemConnector
)
out
=
new
(
PathFileSystemConnector
)
out
.
inodeMap
=
make
(
map
[
uint64
]
*
inode
)
out
.
inodeMap
=
make
(
map
[
uint64
]
*
inode
)
out
.
openFiles
=
make
(
map
[
uint64
]
interface
{})
out
.
openFiles
=
make
(
map
[
uint64
]
interface
{})
out
.
nextFreeInode
=
FUSE_ROOT_ID
out
.
nextFreeInode
=
FUSE_ROOT_ID
rootData
:=
out
.
newInode
()
rootData
:=
out
.
newInode
()
rootData
.
NodeId
=
FUSE_ROOT_ID
rootData
.
NodeId
=
FUSE_ROOT_ID
...
@@ -374,7 +374,7 @@ func (me *PathFileSystemConnector) Mount(mountPoint string, fs PathFilesystem) S
...
@@ -374,7 +374,7 @@ func (me *PathFileSystemConnector) Mount(mountPoint string, fs PathFilesystem) S
if
hasChildren
{
if
hasChildren
{
return
EBUSY
return
EBUSY
}
}
code
:=
fs
.
Mount
(
me
)
code
:=
fs
.
Mount
(
me
)
if
code
!=
OK
{
if
code
!=
OK
{
if
me
.
Debug
{
if
me
.
Debug
{
...
@@ -538,7 +538,7 @@ func (me *PathFileSystemConnector) OpenDir(header *InHeader, input *OpenIn) (fla
...
@@ -538,7 +538,7 @@ func (me *PathFileSystemConnector) OpenDir(header *InHeader, input *OpenIn) (fla
de
.
stream
=
stream
de
.
stream
=
stream
h
:=
me
.
registerFile
(
node
,
de
)
h
:=
me
.
registerFile
(
node
,
de
)
return
0
,
h
,
OK
return
0
,
h
,
OK
}
}
...
@@ -556,14 +556,14 @@ func (me *PathFileSystemConnector) Open(header *InHeader, input *OpenIn) (flags
...
@@ -556,14 +556,14 @@ func (me *PathFileSystemConnector) Open(header *InHeader, input *OpenIn) (flags
if
mount
==
nil
{
if
mount
==
nil
{
return
0
,
0
,
ENOENT
return
0
,
0
,
ENOENT
}
}
// TODO - how to handle return flags, the FUSE open flags?
// TODO - how to handle return flags, the FUSE open flags?
f
,
err
:=
mount
.
fs
.
Open
(
fullPath
,
input
.
Flags
)
f
,
err
:=
mount
.
fs
.
Open
(
fullPath
,
input
.
Flags
)
if
err
!=
OK
{
if
err
!=
OK
{
return
0
,
0
,
err
return
0
,
0
,
err
}
}
h
:=
me
.
registerFile
(
node
,
f
)
h
:=
me
.
registerFile
(
node
,
f
)
return
0
,
h
,
OK
return
0
,
h
,
OK
}
}
...
@@ -741,7 +741,7 @@ func (me *PathFileSystemConnector) Create(header *InHeader, input *CreateIn, nam
...
@@ -741,7 +741,7 @@ func (me *PathFileSystemConnector) Create(header *InHeader, input *CreateIn, nam
if
err
!=
OK
{
if
err
!=
OK
{
return
0
,
0
,
nil
,
err
return
0
,
0
,
nil
,
err
}
}
out
,
code
,
inode
:=
me
.
internalLookupWithNode
(
parent
,
name
,
1
)
out
,
code
,
inode
:=
me
.
internalLookupWithNode
(
parent
,
name
,
1
)
return
0
,
me
.
registerFile
(
inode
,
f
),
out
,
code
return
0
,
me
.
registerFile
(
inode
,
f
),
out
,
code
}
}
...
...
fuse/timingrawfs.go
View file @
f7febb40
...
@@ -207,6 +207,6 @@ func (me *TimingRawFilesystem) ReleaseDir(header *InHeader, input *ReleaseIn) {
...
@@ -207,6 +207,6 @@ func (me *TimingRawFilesystem) ReleaseDir(header *InHeader, input *ReleaseIn) {
}
}
func
(
me
*
TimingRawFilesystem
)
FsyncDir
(
header
*
InHeader
,
input
*
FsyncIn
)
(
code
Status
)
{
func
(
me
*
TimingRawFilesystem
)
FsyncDir
(
header
*
InHeader
,
input
*
FsyncIn
)
(
code
Status
)
{
defer
me
.
startTimer
(
"FsyncDir"
)()
defer
me
.
startTimer
(
"FsyncDir"
)()
return
me
.
Original
.
FsyncDir
(
header
,
input
)
return
me
.
Original
.
FsyncDir
(
header
,
input
)
}
}
fuse/types.go
View file @
f7febb40
...
@@ -541,7 +541,7 @@ type RawFileSystem interface {
...
@@ -541,7 +541,7 @@ type RawFileSystem interface {
OpenDir
(
header
*
InHeader
,
input
*
OpenIn
)
(
flags
uint32
,
handle
uint64
,
status
Status
)
OpenDir
(
header
*
InHeader
,
input
*
OpenIn
)
(
flags
uint32
,
handle
uint64
,
status
Status
)
ReadDir
(
header
*
InHeader
,
input
*
ReadIn
)
(
*
DirEntryList
,
Status
)
ReadDir
(
header
*
InHeader
,
input
*
ReadIn
)
(
*
DirEntryList
,
Status
)
ReleaseDir
(
header
*
InHeader
,
input
*
ReleaseIn
)
ReleaseDir
(
header
*
InHeader
,
input
*
ReleaseIn
)
FsyncDir
(
header
*
InHeader
,
input
*
FsyncIn
)
(
code
Status
)
FsyncDir
(
header
*
InHeader
,
input
*
FsyncIn
)
(
code
Status
)
}
}
type
FuseFile
interface
{
type
FuseFile
interface
{
...
...
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