Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
neo
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
Kirill Smelkov
neo
Commits
1df9b3eb
Commit
1df9b3eb
authored
Jun 24, 2018
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
d282295e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
76 additions
and
0 deletions
+76
-0
go/wcsrv/t/t.go
go/wcsrv/t/t.go
+76
-0
No files found.
go/wcsrv/t/t.go
0 → 100644
View file @
1df9b3eb
package
main
import
(
"flag"
"log"
"os"
"github.com/hanwen/go-fuse/fuse"
"github.com/hanwen/go-fuse/fuse/nodefs"
)
// dir represents a directory in the filesystem.
type
dir
struct
{
nodefs
.
Node
}
// file represents a file in the filesystem.
type
file
struct
{
nodefs
.
Node
}
// fileHandle represents opened file.
type
fileHandle
struct
{
}
func
(
d
*
dir
)
Lookup
(
out
*
fuse
.
Attr
,
name
string
,
ctx
*
fuse
.
Context
)
(
*
nodefs
.
Inode
,
fuse
.
Status
)
{
ientry
:=
d
.
Inode
()
.
GetChild
(
name
)
if
ientry
==
nil
{
return
nil
,
fuse
.
ENOENT
}
// XXX fill out
return
ientry
,
fuse
.
OK
}
func
(
d
*
dir
)
mkdir
(
name
string
)
*
dir
{
child
:=
&
dir
{
Node
:
nodefs
.
NewDefaultNode
()}
d
.
Inode
()
.
NewChild
(
name
,
true
,
child
)
return
child
}
func
(
d
*
dir
)
mkfile
(
name
string
)
*
file
{
child
:=
&
file
{
Node
:
nodefs
.
NewDefaultNode
()}
d
.
Inode
()
.
NewChild
(
name
,
false
,
child
)
return
child
}
func
main
()
{
debug
:=
flag
.
Bool
(
"d"
,
true
,
"debug"
)
flag
.
Parse
()
if
len
(
flag
.
Args
())
!=
1
{
log
.
Fatalf
(
"Usage: %s mntpt"
,
os
.
Args
[
0
])
}
mntpt
:=
flag
.
Args
()[
0
]
root
:=
&
dir
{
Node
:
nodefs
.
NewDefaultNode
()}
//nodefs.NewInode(true, root)
//println(root.Inode())
opts
:=
nodefs
.
NewOptions
()
if
*
debug
{
opts
.
Debug
=
true
}
server
,
_
,
err
:=
nodefs
.
MountRoot
(
mntpt
,
root
,
opts
)
if
err
!=
nil
{
log
.
Fatal
(
err
)
// XXX err ctx?
}
root
.
mkdir
(
"aaa"
)
root
.
mkfile
(
"hello.txt"
)
server
.
Serve
()
// XXX error?
}
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