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
350acb3a
Commit
350acb3a
authored
Sep 01, 2011
by
Han-Wen Nienhuys
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update offset during readdir.
parent
ec443730
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
7 deletions
+8
-7
fuse/direntry.go
fuse/direntry.go
+8
-7
No files found.
fuse/direntry.go
View file @
350acb3a
...
...
@@ -18,12 +18,12 @@ type DirEntry struct {
type
DirEntryList
struct
{
buf
bytes
.
Buffer
offset
uint64
offset
*
uint64
maxSize
int
}
func
NewDirEntryList
(
max
int
)
*
DirEntryList
{
return
&
DirEntryList
{
maxSize
:
max
}
func
NewDirEntryList
(
max
int
,
off
*
uint64
)
*
DirEntryList
{
return
&
DirEntryList
{
maxSize
:
max
,
offset
:
off
}
}
func
(
me
*
DirEntryList
)
AddString
(
name
string
,
inode
uint64
,
mode
uint32
)
bool
{
...
...
@@ -36,10 +36,10 @@ func (me *DirEntryList) AddDirEntry(e DirEntry) bool {
func
(
me
*
DirEntryList
)
Add
(
name
[]
byte
,
inode
uint64
,
mode
uint32
)
bool
{
lastLen
:=
me
.
buf
.
Len
()
me
.
offset
++
(
*
me
.
offset
)
++
dirent
:=
Dirent
{
Off
:
me
.
offset
,
Off
:
*
me
.
offset
,
Ino
:
inode
,
NameLen
:
uint32
(
len
(
name
)),
Typ
:
ModeToType
(
mode
),
...
...
@@ -58,7 +58,7 @@ func (me *DirEntryList) Add(name []byte, inode uint64, mode uint32) bool {
if
me
.
buf
.
Len
()
>
me
.
maxSize
{
me
.
buf
.
Truncate
(
lastLen
)
me
.
offset
--
(
*
me
.
offset
)
--
return
false
}
return
true
...
...
@@ -79,6 +79,7 @@ type connectorDir struct {
extra
[]
DirEntry
stream
chan
DirEntry
leftOver
DirEntry
lastOffset
uint64
}
func
(
me
*
connectorDir
)
ReadDir
(
input
*
ReadIn
)
(
*
DirEntryList
,
Status
)
{
...
...
@@ -86,7 +87,7 @@ func (me *connectorDir) ReadDir(input *ReadIn) (*DirEntryList, Status) {
return
nil
,
OK
}
list
:=
NewDirEntryList
(
int
(
input
.
Size
))
list
:=
NewDirEntryList
(
int
(
input
.
Size
)
,
&
me
.
lastOffset
)
if
me
.
leftOver
.
Name
!=
""
{
success
:=
list
.
AddDirEntry
(
me
.
leftOver
)
if
!
success
{
...
...
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