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
9c33490a
Commit
9c33490a
authored
Aug 11, 2015
by
Aaron Jacobs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Removed clocks from memfs.go.
parent
de030d4a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
20 deletions
+11
-20
samples/memfs/memfs.go
samples/memfs/memfs.go
+11
-20
No files found.
samples/memfs/memfs.go
View file @
9c33490a
...
...
@@ -26,7 +26,6 @@ import (
"github.com/jacobsa/fuse/fuseops"
"github.com/jacobsa/fuse/fuseutil"
"github.com/jacobsa/syncutil"
"github.com/jacobsa/timeutil"
)
type
memFS
struct
{
...
...
@@ -36,12 +35,6 @@ type memFS struct {
uid
uint32
gid
uint32
/////////////////////////
// Dependencies
/////////////////////////
clock
timeutil
.
Clock
/////////////////////////
// Mutable state
/////////////////////////
...
...
@@ -74,11 +67,9 @@ type memFS struct {
// default_permissions option.
func
NewMemFS
(
uid
uint32
,
gid
uint32
,
clock
timeutil
.
Clock
)
fuse
.
Server
{
gid
uint32
)
fuse
.
Server
{
// Set up the basic struct.
fs
:=
&
memFS
{
clock
:
clock
,
inodes
:
make
([]
*
inode
,
fuseops
.
RootInodeID
+
1
),
uid
:
uid
,
gid
:
gid
,
...
...
@@ -91,7 +82,7 @@ func NewMemFS(
Gid
:
gid
,
}
fs
.
inodes
[
fuseops
.
RootInodeID
]
=
newInode
(
clock
,
rootAttrs
)
fs
.
inodes
[
fuseops
.
RootInodeID
]
=
newInode
(
rootAttrs
)
// Set up invariant checking.
fs
.
mu
=
syncutil
.
NewInvariantMutex
(
fs
.
checkInvariants
)
...
...
@@ -165,7 +156,7 @@ func (fs *memFS) getInodeOrDie(id fuseops.InodeID) (inode *inode) {
func
(
fs
*
memFS
)
allocateInode
(
attrs
fuseops
.
InodeAttributes
)
(
id
fuseops
.
InodeID
,
inode
*
inode
)
{
// Create the inode.
inode
=
newInode
(
fs
.
clock
,
attrs
)
inode
=
newInode
(
attrs
)
// Re-use a free ID if possible. Otherwise mint a new one.
numFree
:=
len
(
fs
.
freeInodes
)
...
...
@@ -216,7 +207,7 @@ func (fs *memFS) LookUpInode(
// We don't spontaneously mutate, so the kernel can cache as long as it wants
// (since it also handles invalidation).
op
.
Entry
.
AttributesExpiration
=
fs
.
clock
.
Now
()
.
Add
(
365
*
24
*
time
.
Hour
)
op
.
Entry
.
AttributesExpiration
=
time
.
Now
()
.
Add
(
365
*
24
*
time
.
Hour
)
op
.
Entry
.
EntryExpiration
=
op
.
Entry
.
EntryExpiration
return
...
...
@@ -236,7 +227,7 @@ func (fs *memFS) GetInodeAttributes(
// We don't spontaneously mutate, so the kernel can cache as long as it wants
// (since it also handles invalidation).
op
.
AttributesExpiration
=
fs
.
clock
.
Now
()
.
Add
(
365
*
24
*
time
.
Hour
)
op
.
AttributesExpiration
=
time
.
Now
()
.
Add
(
365
*
24
*
time
.
Hour
)
return
}
...
...
@@ -258,7 +249,7 @@ func (fs *memFS) SetInodeAttributes(
// We don't spontaneously mutate, so the kernel can cache as long as it wants
// (since it also handles invalidation).
op
.
AttributesExpiration
=
fs
.
clock
.
Now
()
.
Add
(
365
*
24
*
time
.
Hour
)
op
.
AttributesExpiration
=
time
.
Now
()
.
Add
(
365
*
24
*
time
.
Hour
)
return
}
...
...
@@ -300,7 +291,7 @@ func (fs *memFS) MkDir(
// We don't spontaneously mutate, so the kernel can cache as long as it wants
// (since it also handles invalidation).
op
.
Entry
.
AttributesExpiration
=
fs
.
clock
.
Now
()
.
Add
(
365
*
24
*
time
.
Hour
)
op
.
Entry
.
AttributesExpiration
=
time
.
Now
()
.
Add
(
365
*
24
*
time
.
Hour
)
op
.
Entry
.
EntryExpiration
=
op
.
Entry
.
EntryExpiration
return
...
...
@@ -324,7 +315,7 @@ func (fs *memFS) CreateFile(
}
// Set up attributes from the child.
now
:=
fs
.
clock
.
Now
()
now
:=
time
.
Now
()
childAttrs
:=
fuseops
.
InodeAttributes
{
Nlink
:
1
,
Mode
:
op
.
Mode
,
...
...
@@ -348,7 +339,7 @@ func (fs *memFS) CreateFile(
// We don't spontaneously mutate, so the kernel can cache as long as it wants
// (since it also handles invalidation).
op
.
Entry
.
AttributesExpiration
=
fs
.
clock
.
Now
()
.
Add
(
365
*
24
*
time
.
Hour
)
op
.
Entry
.
AttributesExpiration
=
time
.
Now
()
.
Add
(
365
*
24
*
time
.
Hour
)
op
.
Entry
.
EntryExpiration
=
op
.
Entry
.
EntryExpiration
// We have nothing interesting to put in the Handle field.
...
...
@@ -374,7 +365,7 @@ func (fs *memFS) CreateSymlink(
}
// Set up attributes from the child.
now
:=
fs
.
clock
.
Now
()
now
:=
time
.
Now
()
childAttrs
:=
fuseops
.
InodeAttributes
{
Nlink
:
1
,
Mode
:
0444
|
os
.
ModeSymlink
,
...
...
@@ -401,7 +392,7 @@ func (fs *memFS) CreateSymlink(
// We don't spontaneously mutate, so the kernel can cache as long as it wants
// (since it also handles invalidation).
op
.
Entry
.
AttributesExpiration
=
fs
.
clock
.
Now
()
.
Add
(
365
*
24
*
time
.
Hour
)
op
.
Entry
.
AttributesExpiration
=
time
.
Now
()
.
Add
(
365
*
24
*
time
.
Hour
)
op
.
Entry
.
EntryExpiration
=
op
.
Entry
.
EntryExpiration
return
...
...
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