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
caca93f6
Commit
caca93f6
authored
May 19, 2015
by
Aaron Jacobs
Browse files
Options
Browse Files
Download
Plain Diff
Added ReadSymlinkOp.
parents
589723ca
3086e28f
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
57 additions
and
0 deletions
+57
-0
fuseops/convert.go
fuseops/convert.go
+7
-0
fuseops/ops.go
fuseops/ops.go
+20
-0
fuseutil/file_system.go
fuseutil/file_system.go
+4
-0
fuseutil/not_implemented_file_system.go
fuseutil/not_implemented_file_system.go
+5
-0
samples/memfs/fs.go
samples/memfs/fs.go
+21
-0
No files found.
fuseops/convert.go
View file @
caca93f6
...
...
@@ -226,6 +226,13 @@ func Convert(
io
=
to
co
=
&
to
.
commonOp
case
*
bazilfuse
.
ReadlinkRequest
:
to
:=
&
ReadSymlinkOp
{
Inode
:
InodeID
(
typed
.
Header
.
Node
),
}
io
=
to
co
=
&
to
.
commonOp
default
:
to
:=
&
unknownOp
{}
io
=
to
...
...
fuseops/ops.go
View file @
caca93f6
...
...
@@ -886,3 +886,23 @@ type unknownOp struct {
func
(
o
*
unknownOp
)
toBazilfuseResponse
()
(
bfResp
interface
{})
{
panic
(
fmt
.
Sprintf
(
"Should never get here for unknown op: %s"
,
o
.
ShortDesc
()))
}
////////////////////////////////////////////////////////////////////////
// Reading symlinks
////////////////////////////////////////////////////////////////////////
// Read the target of a symlink inode.
type
ReadSymlinkOp
struct
{
commonOp
// The symlink inode that we are reading.
Inode
InodeID
// Set by the file system: the target of the symlink.
Target
string
}
func
(
o
*
ReadSymlinkOp
)
toBazilfuseResponse
()
(
bfResp
interface
{})
{
bfResp
=
o
.
Target
return
}
fuseutil/file_system.go
View file @
caca93f6
...
...
@@ -57,6 +57,7 @@ type FileSystem interface {
SyncFile
(
*
fuseops
.
SyncFileOp
)
FlushFile
(
*
fuseops
.
FlushFileOp
)
ReleaseFileHandle
(
*
fuseops
.
ReleaseFileHandleOp
)
ReadSymlink
(
*
fuseops
.
ReadSymlinkOp
)
}
// Create a fuse.Server that handles ops by calling the associated FileSystem
...
...
@@ -185,5 +186,8 @@ func (s fileSystemServer) handleOp(op fuseops.Op) {
case
*
fuseops
.
ReleaseFileHandleOp
:
s
.
fs
.
ReleaseFileHandle
(
typed
)
case
*
fuseops
.
ReadSymlinkOp
:
s
.
fs
.
ReadSymlink
(
typed
)
}
}
fuseutil/not_implemented_file_system.go
View file @
caca93f6
...
...
@@ -122,3 +122,8 @@ func (fs *NotImplementedFileSystem) ReleaseFileHandle(
op
*
fuseops
.
ReleaseFileHandleOp
)
{
op
.
Respond
(
fuse
.
ENOSYS
)
}
func
(
fs
*
NotImplementedFileSystem
)
ReadSymlink
(
op
*
fuseops
.
ReadSymlinkOp
)
{
op
.
Respond
(
fuse
.
ENOSYS
)
}
samples/memfs/fs.go
View file @
caca93f6
...
...
@@ -406,6 +406,9 @@ func (fs *memFS) CreateSymlink(
childID
,
child
:=
fs
.
allocateInode
(
childAttrs
)
defer
child
.
mu
.
Unlock
()
// Set up its target.
child
.
target
=
op
.
Target
// Add an entry in the parent.
parent
.
AddChild
(
childID
,
op
.
Name
,
fuseutil
.
DT_Link
)
...
...
@@ -597,3 +600,21 @@ func (fs *memFS) WriteFile(
return
}
func
(
fs
*
memFS
)
ReadSymlink
(
op
*
fuseops
.
ReadSymlinkOp
)
{
var
err
error
defer
fuseutil
.
RespondToOp
(
op
,
&
err
)
fs
.
mu
.
Lock
()
defer
fs
.
mu
.
Unlock
()
// Find the inode in question.
inode
:=
fs
.
getInodeForReadingOrDie
(
op
.
Inode
)
defer
inode
.
mu
.
Unlock
()
// Serve the request.
op
.
Target
=
inode
.
target
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