Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
go-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
Levin Zimmermann
go-fuse
Commits
5e70a522
Commit
5e70a522
authored
May 04, 2011
by
Han-Wen Nienhuys
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ioctl wip.
parent
3585c6cf
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
48 additions
and
4 deletions
+48
-4
fuse/api.go
fuse/api.go
+4
-0
fuse/default.go
fuse/default.go
+8
-4
fuse/loopback_test.go
fuse/loopback_test.go
+15
-0
fuse/misc.go
fuse/misc.go
+8
-0
fuse/opcode.go
fuse/opcode.go
+7
-0
fuse/pathops.go
fuse/pathops.go
+6
-0
No files found.
fuse/api.go
View file @
5e70a522
...
...
@@ -74,6 +74,7 @@ type File interface {
Chmod
(
perms
uint32
)
Status
Utimens
(
atimeNs
uint64
,
mtimeNs
uint64
)
Status
Truncate
(
size
uint64
)
Status
Ioctl
(
input
*
IoctlIn
)
(
output
*
IoctlOut
,
data
[]
byte
,
code
Status
)
}
// MountOptions contains time out options for a FileSystem. The
...
...
@@ -142,6 +143,9 @@ type RawFileSystem interface {
ReadDir
(
header
*
InHeader
,
input
*
ReadIn
)
(
*
DirEntryList
,
Status
)
ReleaseDir
(
header
*
InHeader
,
input
*
ReleaseIn
)
FsyncDir
(
header
*
InHeader
,
input
*
FsyncIn
)
(
code
Status
)
//
Ioctl
(
header
*
InHeader
,
input
*
IoctlIn
)
(
output
*
IoctlOut
,
data
[]
byte
,
code
Status
)
}
// DefaultRawFileSystem returns ENOSYS for every operation.
...
...
fuse/default.go
View file @
5e70a522
...
...
@@ -91,10 +91,6 @@ func (me *DefaultRawFileSystem) Bmap(header *InHeader, input *BmapIn) (out *Bmap
return
nil
,
ENOSYS
}
func
(
me
*
DefaultRawFileSystem
)
Ioctl
(
header
*
InHeader
,
input
*
IoctlIn
)
(
out
*
IoctlOut
,
code
Status
)
{
return
nil
,
ENOSYS
}
func
(
me
*
DefaultRawFileSystem
)
Poll
(
header
*
InHeader
,
input
*
PollIn
)
(
out
*
PollOut
,
code
Status
)
{
return
nil
,
ENOSYS
}
...
...
@@ -133,6 +129,10 @@ func (me *DefaultRawFileSystem) FsyncDir(header *InHeader, input *FsyncIn) (code
return
ENOSYS
}
func
(
me
*
DefaultRawFileSystem
)
Ioctl
(
header
*
InHeader
,
input
*
IoctlIn
)
(
output
*
IoctlOut
,
data
[]
byte
,
code
Status
)
{
return
nil
,
nil
,
ENOSYS
}
////////////////////////////////////////////////////////////////
// DefaultFile
...
...
@@ -176,6 +176,10 @@ func (me *DefaultFile) Chmod(perms uint32) Status {
return
ENOSYS
}
func
(
me
*
DefaultFile
)
Ioctl
(
input
*
IoctlIn
)
(
output
*
IoctlOut
,
data
[]
byte
,
code
Status
)
{
return
nil
,
nil
,
ENOSYS
}
////////////////////////////////////////////////////////////////
// DefaultFileSystem
...
...
fuse/loopback_test.go
View file @
5e70a522
...
...
@@ -601,6 +601,20 @@ func TestReadOnly(t *testing.T) {
ts
.
testReaddir
()
}
func
TestIoctl
(
t
*
testing
.
T
)
{
ts
:=
new
(
testCase
)
ts
.
Setup
(
t
)
defer
ts
.
Cleanup
()
f
,
err
:=
os
.
OpenFile
(
filepath
.
Join
(
ts
.
mountPoint
,
"hello.txt"
),
os
.
O_WRONLY
|
os
.
O_CREATE
,
0777
)
defer
f
.
Close
()
CheckSuccess
(
err
)
v
,
e
:=
ioctl
(
f
.
Fd
(),
0x5401
,
42
)
fmt
.
Println
(
"ioctl"
,
v
,
e
)
}
func
TestRecursiveMount
(
t
*
testing
.
T
)
{
ts
:=
new
(
testCase
)
ts
.
Setup
(
t
)
...
...
@@ -650,3 +664,4 @@ func TestRecursiveMount(t *testing.T) {
ts
.
Cleanup
()
}
fuse/misc.go
View file @
5e70a522
...
...
@@ -158,3 +158,11 @@ func asSlice(ptr unsafe.Pointer, byteCount int) []byte {
h
:=
&
reflect
.
SliceHeader
{
uintptr
(
ptr
),
byteCount
,
byteCount
}
return
*
(
*
[]
byte
)(
unsafe
.
Pointer
(
h
))
}
func
ioctl
(
fd
int
,
cmd
int
,
arg
uintptr
)
(
int
,
int
)
{
r0
,
_
,
e1
:=
syscall
.
Syscall
(
syscall
.
SYS_IOCTL
,
uintptr
(
fd
),
uintptr
(
cmd
),
uintptr
(
arg
))
val
:=
int
(
r0
)
errno
:=
int
(
e1
)
return
val
,
errno
}
fuse/opcode.go
View file @
5e70a522
...
...
@@ -283,6 +283,13 @@ func doRename(state *MountState, req *request) {
req
.
status
=
state
.
fileSystem
.
Rename
(
req
.
inHeader
,
(
*
RenameIn
)(
req
.
inData
),
req
.
filenames
[
0
],
req
.
filenames
[
1
])
}
func
doIoctl
(
state
*
MountState
,
req
*
request
)
{
out
,
data
,
stat
:=
state
.
fileSystem
.
Ioctl
(
req
.
inHeader
,
(
*
IoctlIn
)(
req
.
inData
))
req
.
outData
=
unsafe
.
Pointer
(
out
)
req
.
flatData
=
data
req
.
status
=
stat
}
////////////////////////////////////////////////////////////////
type
operationFunc
func
(
*
MountState
,
*
request
)
...
...
fuse/pathops.go
View file @
5e70a522
...
...
@@ -464,3 +464,9 @@ func (me *FileSystemConnector) Read(input *ReadIn, bp *BufferPool) ([]byte, Stat
f
,
_
:=
me
.
getFile
(
input
.
Fh
)
return
f
.
Read
(
input
,
bp
)
}
func
(
me
*
FileSystemConnector
)
Ioctl
(
header
*
InHeader
,
input
*
IoctlIn
)
(
out
*
IoctlOut
,
data
[]
byte
,
code
Status
)
{
f
,
_
:=
me
.
getFile
(
input
.
Fh
)
return
f
.
Ioctl
(
input
)
}
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