Commit c749c652 authored by Han-Wen Nienhuys's avatar Han-Wen Nienhuys

Add DevNull file.

parent dd0c60b7
......@@ -18,7 +18,8 @@ GOFILES=misc.go\
wrappedfs.go \
timingfs.go \
timingrawfs.go \
xattr.go
xattr.go \
devnull.go \
include $(GOROOT)/src/Make.pkg
......@@ -35,3 +35,4 @@ func TestDummyFile(t *testing.T) {
_ = fileDir
_ = filePtr
}
package fuse
// A FUSE file that accepts any write, and always returns EOF.
type DevNullFile struct {
DefaultRawFuseFile
}
func NewDevNullFile() *DevNullFile {
return new(DevNullFile)
}
func (me *DevNullFile) Read(input *ReadIn, bp *BufferPool) ([]byte, Status) {
return []byte{}, OK
}
func (me *DevNullFile) Write(input *WriteIn, content []byte) (uint32, Status) {
return uint32(len(content)), OK
}
func (me *DevNullFile) Flush() Status {
return OK
}
func (me *DevNullFile) Fsync(*FsyncIn) (code Status) {
return OK
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment