Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
W
wendelin.core
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
Joshua
wendelin.core
Commits
b6e23e54
Commit
b6e23e54
authored
Feb 06, 2019
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
5a5aa765
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
6 deletions
+21
-6
wcfs/misc.go
wcfs/misc.go
+21
-5
wcfs/wcfs.go
wcfs/wcfs.go
+0
-1
No files found.
wcfs/misc.go
View file @
b6e23e54
...
...
@@ -118,7 +118,6 @@ type defaultNode struct{
}
func
(
n
*
defaultNode
)
Open
(
flags
uint32
,
fctx
*
fuse
.
Context
)
(
nodefs
.
File
,
fuse
.
Status
)
{
// XXX return something else for directory?
return
&
nodefs
.
WithFlags
{
File
:
nil
,
FuseFlags
:
fuse
.
FOPEN_KEEP_CACHE
,
...
...
@@ -134,21 +133,38 @@ func newDefaultNode() nodefs.Node {
// NewStaticFile creates nodefs.Node for file with static data.
func
NewStaticFile
(
data
[]
byte
)
*
SmallFile
{
return
N
ewSmallFile
(
func
()
[]
byte
{
return
n
ewSmallFile
(
func
()
[]
byte
{
return
data
})
}
,
fuse
.
FOPEN_KEEP_CACHE
/*see ^^^*/
)
}
// SmallFile is a nodefs.Node for file with dynamic, but always small, data.
// SmallFile is a nodefs.Node for file with
potentially
dynamic, but always small, data.
type
SmallFile
struct
{
nodefs
.
Node
fuseFlags
uint32
// fuse.FOPEN_*
// readData gives whole file data
readData
func
()
[]
byte
}
func
newSmallFile
(
readData
func
()
[]
byte
,
fuseFlags
uint32
)
*
SmallFile
{
return
&
SmallFile
{
Node
:
newDefaultNode
(),
fuseFlags
:
fuseFlags
,
readData
:
readData
,
}
}
// NewSmallFile creates nodefs.Node for file with dynamic, but always small, data.
func
NewSmallFile
(
readData
func
()
[]
byte
)
*
SmallFile
{
return
&
SmallFile
{
Node
:
newDefaultNode
(),
readData
:
readData
}
return
newSmallFile
(
readData
,
fuse
.
FOPEN_DIRECT_IO
)
}
func
(
f
*
SmallFile
)
Open
(
flags
uint32
,
fctx
*
fuse
.
Context
)
(
nodefs
.
File
,
fuse
.
Status
)
{
return
&
nodefs
.
WithFlags
{
File
:
nil
,
FuseFlags
:
f
.
fuseFlags
,
},
fuse
.
OK
}
func
(
f
*
SmallFile
)
GetAttr
(
out
*
fuse
.
Attr
,
_
nodefs
.
File
,
_
*
fuse
.
Context
)
fuse
.
Status
{
...
...
wcfs/wcfs.go
View file @
b6e23e54
...
...
@@ -1418,7 +1418,6 @@ func main() {
mkdir
(
root
,
"head"
,
head
)
mkdir
(
head
,
"bigfile"
,
bfdir
)
mkfile
(
head
,
"at"
,
NewSmallFile
(
head
.
readAt
))
// TODO mtime(at) = tidtime(at)
// XXX ^^^ invalidate cache or direct io XXX no FOPEN_KEEP_CACHE -> direct io
// for debugging/testing
_wcfs
:=
newDefaultNode
()
...
...
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