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
a787be87
Commit
a787be87
authored
Mar 30, 2015
by
Aaron Jacobs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fsImpl.checkInvariants
parent
b2b1b6a4
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
2 deletions
+16
-2
samples/forgetfs/forget_fs.go
samples/forgetfs/forget_fs.go
+16
-2
No files found.
samples/forgetfs/forget_fs.go
View file @
a787be87
...
...
@@ -97,7 +97,7 @@ type fsImpl struct {
// An index of inode by ID, for all IDs we have issued.
//
// INVARIANT: For each v, v.lookupCount >= 0
// INVARIANT: For each v
in inodes
, v.lookupCount >= 0
//
// GUARDED_BY(mu)
inodes
map
[
fuseops
.
InodeID
]
*
inode
...
...
@@ -116,7 +116,21 @@ type inode struct {
}
// LOCKS_REQUIRED(fs.mu)
func
(
fs
*
fsImpl
)
checkInvariants
()
func
(
fs
*
fsImpl
)
checkInvariants
()
{
// INVARIANT: For each v in inodes, v.lookupCount >= 0
for
_
,
v
:=
range
fs
.
inodes
{
if
!
(
v
.
lookupCount
>=
0
)
{
panic
(
"Negative lookup count"
)
}
}
// INVARIANT: For each k in inodes, k < nextInodeID
for
k
,
_
:=
range
fs
.
inodes
{
if
!
(
k
<
fs
.
nextInodeID
)
{
panic
(
"Unexpectedly large inode ID"
)
}
}
}
func
(
fs
*
fsImpl
)
Init
(
op
*
fuseops
.
InitOp
)
{
...
...
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