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
1b4a34cc
Commit
1b4a34cc
authored
Nov 24, 2017
by
Srdjan Rilak
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add CreateLink implementation
parent
88e3bc5f
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
62 additions
and
0 deletions
+62
-0
conversions.go
conversions.go
+31
-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
+7
-0
No files found.
conversions.go
View file @
1b4a34cc
...
...
@@ -420,6 +420,32 @@ func convertInMessage(
Flags
:
fusekernel
.
InitFlags
(
in
.
Flags
),
}
case
fusekernel
.
OpLink
:
type
input
fusekernel
.
LinkIn
in
:=
(
*
input
)(
inMsg
.
Consume
(
unsafe
.
Sizeof
(
input
{})))
if
in
==
nil
{
err
=
errors
.
New
(
"Corrupt OpLink"
)
return
}
name
:=
inMsg
.
ConsumeBytes
(
inMsg
.
Len
())
i
:=
bytes
.
IndexByte
(
name
,
'\x00'
)
if
i
<
0
{
err
=
errors
.
New
(
"Corrupt OpLink"
)
return
}
name
=
name
[
:
i
]
if
len
(
name
)
==
0
{
err
=
errors
.
New
(
"Corrupt OpLink (Name not read)"
)
return
}
o
=
&
fuseops
.
CreateLinkOp
{
Parent
:
fuseops
.
InodeID
(
inMsg
.
Header
()
.
Nodeid
),
Name
:
string
(
name
),
Target
:
fuseops
.
InodeID
(
in
.
Oldnodeid
),
}
case
fusekernel
.
OpRemovexattr
:
buf
:=
inMsg
.
ConsumeBytes
(
inMsg
.
Len
())
n
:=
len
(
buf
)
...
...
@@ -647,6 +673,11 @@ func (c *Connection) kernelResponseForOp(
out
:=
(
*
fusekernel
.
EntryOut
)(
m
.
Grow
(
size
))
convertChildInodeEntry
(
&
o
.
Entry
,
out
)
case
*
fuseops
.
CreateLinkOp
:
size
:=
int
(
fusekernel
.
EntryOutSize
(
c
.
protocol
))
out
:=
(
*
fusekernel
.
EntryOut
)(
m
.
Grow
(
size
))
convertChildInodeEntry
(
&
o
.
Entry
,
out
)
case
*
fuseops
.
RenameOp
:
// Empty response
...
...
fuseops/ops.go
View file @
1b4a34cc
...
...
@@ -317,6 +317,26 @@ type CreateSymlinkOp struct {
Entry
ChildInodeEntry
}
// Create a hard link to an inode. If the name already exists, the file system
// should return EEXIST (cf. the notes on CreateFileOp and MkDirOp).
type
CreateLinkOp
struct
{
// The ID of parent directory inode within which to create the child hard
// link.
Parent
InodeID
// The name of the new inode.
Name
string
// The ID of the target inode.
Target
InodeID
// Set by the file system: information about the inode that was created.
//
// The lookup count for the inode is implicitly incremented. See notes on
// ForgetInodeOp for more information.
Entry
ChildInodeEntry
}
////////////////////////////////////////////////////////////////////////
// Unlinking
////////////////////////////////////////////////////////////////////////
...
...
fuseutil/file_system.go
View file @
1b4a34cc
...
...
@@ -43,6 +43,7 @@ type FileSystem interface {
MkDir
(
context
.
Context
,
*
fuseops
.
MkDirOp
)
error
MkNode
(
context
.
Context
,
*
fuseops
.
MkNodeOp
)
error
CreateFile
(
context
.
Context
,
*
fuseops
.
CreateFileOp
)
error
CreateLink
(
context
.
Context
,
*
fuseops
.
CreateLinkOp
)
error
CreateSymlink
(
context
.
Context
,
*
fuseops
.
CreateSymlinkOp
)
error
Rename
(
context
.
Context
,
*
fuseops
.
RenameOp
)
error
RmDir
(
context
.
Context
,
*
fuseops
.
RmDirOp
)
error
...
...
@@ -159,6 +160,9 @@ func (s *fileSystemServer) handleOp(
case
*
fuseops
.
CreateFileOp
:
err
=
s
.
fs
.
CreateFile
(
ctx
,
typed
)
case
*
fuseops
.
CreateLinkOp
:
err
=
s
.
fs
.
CreateLink
(
ctx
,
typed
)
case
*
fuseops
.
CreateSymlinkOp
:
err
=
s
.
fs
.
CreateSymlink
(
ctx
,
typed
)
...
...
fuseutil/not_implemented_file_system.go
View file @
1b4a34cc
...
...
@@ -92,6 +92,13 @@ func (fs *NotImplementedFileSystem) CreateSymlink(
return
}
func
(
fs
*
NotImplementedFileSystem
)
CreateLink
(
ctx
context
.
Context
,
op
*
fuseops
.
CreateLinkOp
)
(
err
error
)
{
err
=
fuse
.
ENOSYS
return
}
func
(
fs
*
NotImplementedFileSystem
)
Rename
(
ctx
context
.
Context
,
op
*
fuseops
.
RenameOp
)
(
err
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