Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
J
jacobsa-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
jacobsa-fuse
Commits
3076da56
Commit
3076da56
authored
Mar 03, 2015
by
Aaron Jacobs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed an inode invariants bug.
parent
27731334
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
7 deletions
+15
-7
samples/memfs/inode.go
samples/memfs/inode.go
+15
-7
No files found.
samples/memfs/inode.go
View file @
3076da56
...
...
@@ -179,23 +179,31 @@ func (inode *inode) AddChild(
id
fuse
.
InodeID
,
name
string
,
dt
fuseutil
.
DirentType
)
{
var
index
int
// No matter where we place the entry, make sure it has the correct Offset
// field.
defer
func
()
{
inode
.
entries
[
index
]
.
Offset
=
fuse
.
DirOffset
(
index
+
1
)
}()
// Set up the entry.
e
:=
fuseutil
.
Dirent
{
Offset
:
fuse
.
DirOffset
(
len
(
inode
.
entries
)
+
1
),
Inode
:
id
,
Name
:
name
,
Type
:
dt
,
}
// Look for a gap in which we can insert it.
for
i
:
=
range
inode
.
entries
{
if
inode
.
entries
[
i
]
.
Type
==
fuseutil
.
DT_Unknown
{
inode
.
entries
[
i
]
=
e
for
i
ndex
=
range
inode
.
entries
{
if
inode
.
entries
[
i
ndex
]
.
Type
==
fuseutil
.
DT_Unknown
{
inode
.
entries
[
i
ndex
]
=
e
return
}
}
// Append it to the end.
index
=
len
(
inode
.
entries
)
inode
.
entries
=
append
(
inode
.
entries
,
e
)
}
...
...
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