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
cbeaa550
Commit
cbeaa550
authored
Mar 05, 2017
by
Ka-Hing Cheung
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SetXattr support
parent
d20c4665
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
61 additions
and
0 deletions
+61
-0
conversions.go
conversions.go
+32
-0
debug.go
debug.go
+3
-0
fuseops/ops.go
fuseops/ops.go
+15
-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 @
cbeaa550
...
...
@@ -487,6 +487,35 @@ func convertInMessage(
return
}
}
case
fusekernel
.
OpSetxattr
:
type
input
fusekernel
.
SetxattrIn
in
:=
(
*
input
)(
inMsg
.
Consume
(
unsafe
.
Sizeof
(
input
{})))
if
in
==
nil
{
err
=
errors
.
New
(
"Corrupt OpSetxattr"
)
return
}
payload
:=
inMsg
.
ConsumeBytes
(
inMsg
.
Len
())
// payload should be "name\x00value"
if
len
(
payload
)
<
3
{
err
=
errors
.
New
(
"Corrupt OpSetxattr"
)
return
}
i
:=
bytes
.
IndexByte
(
payload
,
'\x00'
)
if
i
<
0
{
err
=
errors
.
New
(
"Corrupt OpSetxattr"
)
return
}
name
,
value
:=
payload
[
:
i
],
payload
[
i
+
1
:
len
(
payload
)]
fmt
.
Printf
(
"Setting %v to %v
\n
"
,
name
,
value
)
o
=
&
fuseops
.
SetXattrOp
{
Inode
:
fuseops
.
InodeID
(
inMsg
.
Header
()
.
Nodeid
),
Name
:
string
(
name
),
Data
:
value
,
Flags
:
in
.
Flags
,
}
default
:
o
=
&
unknownOp
{
...
...
@@ -726,6 +755,9 @@ func (c *Connection) kernelResponseForOp(
m
.
ShrinkTo
(
buffer
.
OutMessageHeaderSize
+
o
.
BytesRead
)
}
case
*
fuseops
.
SetXattrOp
:
// Empty response
case
*
initOp
:
out
:=
(
*
fusekernel
.
InitOut
)(
m
.
Grow
(
int
(
unsafe
.
Sizeof
(
fusekernel
.
InitOut
{}))))
...
...
debug.go
View file @
cbeaa550
...
...
@@ -95,6 +95,9 @@ func describeRequest(op interface{}) (s string) {
case
*
fuseops
.
GetXattrOp
:
addComponent
(
"name %s"
,
typed
.
Name
)
case
*
fuseops
.
SetXattrOp
:
addComponent
(
"name %s"
,
typed
.
Name
)
}
// Use just the name if there is no extra info.
...
...
fuseops/ops.go
View file @
cbeaa550
...
...
@@ -815,3 +815,18 @@ type ListXattrOp struct {
// big enough
BytesRead
int
}
type
SetXattrOp
struct
{
// The inode that we are changing
Inode
InodeID
// The name of the extended attribute
Name
string
// The data to for the extened attribute.
Data
[]
byte
// If Flags is 0x1, and the attribute exists already, EEXIST should be returned.
// If Flags is 0x2, and the attribute does not exist, ENOATTR should be returned.
Flags
uint32
}
fuseutil/file_system.go
View file @
cbeaa550
...
...
@@ -60,6 +60,7 @@ type FileSystem interface {
RemoveXattr
(
context
.
Context
,
*
fuseops
.
RemoveXattrOp
)
error
GetXattr
(
context
.
Context
,
*
fuseops
.
GetXattrOp
)
error
ListXattr
(
context
.
Context
,
*
fuseops
.
ListXattrOp
)
error
SetXattr
(
context
.
Context
,
*
fuseops
.
SetXattrOp
)
error
// Regard all inodes (including the root inode) as having their lookup counts
// decremented to zero, and clean up any resources associated with the file
...
...
@@ -198,6 +199,9 @@ func (s *fileSystemServer) handleOp(
case
*
fuseops
.
ListXattrOp
:
err
=
s
.
fs
.
ListXattr
(
ctx
,
typed
)
case
*
fuseops
.
SetXattrOp
:
err
=
s
.
fs
.
SetXattr
(
ctx
,
typed
)
}
c
.
Reply
(
ctx
,
err
)
...
...
fuseutil/not_implemented_file_system.go
View file @
cbeaa550
...
...
@@ -204,5 +204,12 @@ func (fs *NotImplementedFileSystem) ListXattr(
return
}
func
(
fs
*
NotImplementedFileSystem
)
SetXattr
(
ctx
context
.
Context
,
op
*
fuseops
.
SetXattrOp
)
(
err
error
)
{
err
=
fuse
.
ENOSYS
return
}
func
(
fs
*
NotImplementedFileSystem
)
Destroy
()
{
}
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