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
a9652704
Commit
a9652704
authored
Jun 30, 2011
by
Han-Wen Nienhuys
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Small polish in direntry.go
parent
3e687784
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
18 deletions
+17
-18
fuse/direntry.go
fuse/direntry.go
+16
-13
fuse/pathfilesystem.go
fuse/pathfilesystem.go
+0
-4
fuse/pathops.go
fuse/pathops.go
+1
-1
No files found.
fuse/direntry.go
View file @
a9652704
...
...
@@ -9,6 +9,7 @@ import (
)
var
_
=
fmt
.
Print
// For FileSystemConnector. The connector determines inodes.
type
DirEntry
struct
{
Mode
uint32
...
...
@@ -29,6 +30,10 @@ func (me *DirEntryList) AddString(name string, inode uint64, mode uint32) bool {
return
me
.
Add
([]
byte
(
name
),
inode
,
mode
)
}
func
(
me
*
DirEntryList
)
AddDirEntry
(
e
DirEntry
)
bool
{
return
me
.
Add
([]
byte
(
e
.
Name
),
uint64
(
FUSE_UNKNOWN_INO
),
e
.
Mode
)
}
func
(
me
*
DirEntryList
)
Add
(
name
[]
byte
,
inode
uint64
,
mode
uint32
)
bool
{
lastLen
:=
me
.
buf
.
Len
()
me
.
offset
++
...
...
@@ -65,27 +70,25 @@ func (me *DirEntryList) Bytes() []byte {
////////////////////////////////////////////////////////////////
type
Dir
struct
{
type
rawDir
interface
{
ReadDir
(
input
*
ReadIn
)
(
*
DirEntryList
,
Status
)
Release
()
}
type
connectorDir
struct
{
extra
[]
DirEntry
stream
chan
DirEntry
leftOver
DirEntry
}
func
(
me
*
Dir
)
ReadDir
(
input
*
ReadIn
)
(
*
DirEntryList
,
Status
)
{
func
(
me
*
connector
Dir
)
ReadDir
(
input
*
ReadIn
)
(
*
DirEntryList
,
Status
)
{
if
me
.
stream
==
nil
&&
len
(
me
.
extra
)
==
0
{
return
nil
,
OK
}
// We could also return
// me.connector.lookupUpdate(me.parentIno, name).NodeId but it
// appears FUSE will issue a LOOKUP afterwards for the entry
// anyway, so we skip hash table update here.
inode
:=
uint64
(
FUSE_UNKNOWN_INO
)
list
:=
NewDirEntryList
(
int
(
input
.
Size
))
if
me
.
leftOver
.
Name
!=
""
{
n
:=
me
.
leftOver
.
Name
success
:=
list
.
AddString
(
n
,
inode
,
me
.
leftOver
.
Mode
)
success
:=
list
.
AddDirEntry
(
me
.
leftOver
)
if
!
success
{
panic
(
"No space for single entry."
)
}
...
...
@@ -94,7 +97,7 @@ func (me *Dir) ReadDir(input *ReadIn) (*DirEntryList, Status) {
for
len
(
me
.
extra
)
>
0
{
e
:=
me
.
extra
[
len
(
me
.
extra
)
-
1
]
me
.
extra
=
me
.
extra
[
:
len
(
me
.
extra
)
-
1
]
success
:=
list
.
Add
String
(
e
.
Name
,
inode
,
e
.
Mod
e
)
success
:=
list
.
Add
DirEntry
(
e
)
if
!
success
{
me
.
leftOver
=
e
return
list
,
OK
...
...
@@ -106,7 +109,7 @@ func (me *Dir) ReadDir(input *ReadIn) (*DirEntryList, Status) {
me
.
stream
=
nil
break
}
if
!
list
.
Add
String
(
d
.
Name
,
inode
,
d
.
Mode
)
{
if
!
list
.
Add
DirEntry
(
d
)
{
me
.
leftOver
=
d
break
}
...
...
@@ -115,7 +118,7 @@ func (me *Dir) ReadDir(input *ReadIn) (*DirEntryList, Status) {
}
// Read everything so we make goroutines exit.
func
(
me
*
Dir
)
Release
()
{
func
(
me
*
connector
Dir
)
Release
()
{
for
ok
:=
true
;
ok
&&
me
.
stream
!=
nil
;
{
_
,
ok
=
<-
me
.
stream
if
!
ok
{
...
...
fuse/pathfilesystem.go
View file @
a9652704
...
...
@@ -317,10 +317,6 @@ func (me *FileSystemConnector) getOpenedFile(h uint64) *openedFile {
return
b
}
type
rawDir
interface
{
ReadDir
(
input
*
ReadIn
)
(
*
DirEntryList
,
Status
)
Release
()
}
func
(
me
*
FileSystemConnector
)
verify
()
{
if
!
paranoia
{
...
...
fuse/pathops.go
View file @
a9652704
...
...
@@ -140,7 +140,7 @@ func (me *FileSystemConnector) OpenDir(header *InHeader, input *OpenIn) (flags u
return
0
,
0
,
err
}
de
:=
&
Dir
{
de
:=
&
connector
Dir
{
extra
:
node
.
GetMountDirEntries
(),
stream
:
stream
,
}
...
...
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