Formatted interface checks
This commit is contained in:
parent
a54ca7afdf
commit
2396623c73
@ -88,7 +88,7 @@ func BuildProperties(dev *infinitime.Device) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
var _ = (fs.NodeReaddirer)((*ITNode)(nil))
|
var _ fs.NodeReaddirer = (*ITNode)(nil)
|
||||||
|
|
||||||
// Readdir is part of the NodeReaddirer interface
|
// Readdir is part of the NodeReaddirer interface
|
||||||
func (n *ITNode) Readdir(ctx context.Context) (fs.DirStream, syscall.Errno) {
|
func (n *ITNode) Readdir(ctx context.Context) (fs.DirStream, syscall.Errno) {
|
||||||
@ -174,7 +174,7 @@ func (n *ITNode) Readdir(ctx context.Context) (fs.DirStream, syscall.Errno) {
|
|||||||
return fs.NewListDirStream(r), 0
|
return fs.NewListDirStream(r), 0
|
||||||
}
|
}
|
||||||
|
|
||||||
var _ = (fs.NodeLookuper)((*ITNode)(nil))
|
var _ fs.NodeLookuper = (*ITNode)(nil)
|
||||||
func (n *ITNode) Lookup(ctx context.Context, name string, out *fuse.EntryOut) (*fs.Inode, syscall.Errno) {
|
func (n *ITNode) Lookup(ctx context.Context, name string, out *fuse.EntryOut) (*fs.Inode, syscall.Errno) {
|
||||||
switch n.kind {
|
switch n.kind {
|
||||||
case 0:
|
case 0:
|
||||||
@ -253,8 +253,8 @@ func (n *ITNode) Lookup(ctx context.Context, name string, out *fuse.EntryOut) (*
|
|||||||
type bytesFileReadHandle struct {
|
type bytesFileReadHandle struct {
|
||||||
content []byte
|
content []byte
|
||||||
}
|
}
|
||||||
var _ = (fs.FileReader)((*bytesFileReadHandle)(nil))
|
|
||||||
|
|
||||||
|
var _ fs.FileReader = (*bytesFileReadHandle)(nil)
|
||||||
func (fh *bytesFileReadHandle) Read(ctx context.Context, dest []byte, off int64) (fuse.ReadResult, syscall.Errno) {
|
func (fh *bytesFileReadHandle) Read(ctx context.Context, dest []byte, off int64) (fuse.ReadResult, syscall.Errno) {
|
||||||
log.Info("Executing Read").Int("size", len(fh.content)).Send()
|
log.Info("Executing Read").Int("size", len(fh.content)).Send()
|
||||||
end := off + int64(len(dest))
|
end := off + int64(len(dest))
|
||||||
@ -268,13 +268,13 @@ type sensorFileReadHandle struct {
|
|||||||
ch <-chan []byte
|
ch <-chan []byte
|
||||||
cancel context.CancelFunc
|
cancel context.CancelFunc
|
||||||
}
|
}
|
||||||
var _ = (fs.FileReader)((*sensorFileReadHandle)(nil))
|
var _ fs.FileReader = (*sensorFileReadHandle)(nil)
|
||||||
func (fh *sensorFileReadHandle) Read(ctx context.Context, dest []byte, off int64) (fuse.ReadResult, syscall.Errno) {
|
func (fh *sensorFileReadHandle) Read(ctx context.Context, dest []byte, off int64) (fuse.ReadResult, syscall.Errno) {
|
||||||
content := <-fh.ch
|
content := <-fh.ch
|
||||||
return fuse.ReadResultData(content), 0
|
return fuse.ReadResultData(content), 0
|
||||||
}
|
}
|
||||||
|
|
||||||
var _ = (fs.FileFlusher)((*sensorFileReadHandle)(nil))
|
var _ fs.FileFlusher = (*sensorFileReadHandle)(nil)
|
||||||
func (fh *sensorFileReadHandle) Flush(ctx context.Context) (errno syscall.Errno) {
|
func (fh *sensorFileReadHandle) Flush(ctx context.Context) (errno syscall.Errno) {
|
||||||
fh.cancel()
|
fh.cancel()
|
||||||
return 0
|
return 0
|
||||||
@ -286,7 +286,7 @@ type bytesFileWriteHandle struct {
|
|||||||
path string
|
path string
|
||||||
}
|
}
|
||||||
|
|
||||||
var _ = (fs.FileWriter)((*bytesFileWriteHandle)(nil))
|
var _ fs.FileWriter = (*bytesFileWriteHandle)(nil)
|
||||||
func (fh *bytesFileWriteHandle) Write(ctx context.Context, data []byte, off int64) (written uint32, errno syscall.Errno) {
|
func (fh *bytesFileWriteHandle) Write(ctx context.Context, data []byte, off int64) (written uint32, errno syscall.Errno) {
|
||||||
log.Info("Executing Write").Str("path", fh.path).Int("prev_size", len(fh.content)).Int("next_size", len(data)).Send()
|
log.Info("Executing Write").Str("path", fh.path).Int("prev_size", len(fh.content)).Int("next_size", len(data)).Send()
|
||||||
if off != int64(len(fh.content)) {
|
if off != int64(len(fh.content)) {
|
||||||
@ -295,7 +295,7 @@ func (fh *bytesFileWriteHandle) Write(ctx context.Context, data []byte, off int6
|
|||||||
return uint32(len(data)), 0
|
return uint32(len(data)), 0
|
||||||
}
|
}
|
||||||
|
|
||||||
var _ = (fs.FileFlusher)((*bytesFileWriteHandle)(nil))
|
var _ fs.FileFlusher = (*bytesFileWriteHandle)(nil)
|
||||||
func (fh *bytesFileWriteHandle) Flush(ctx context.Context) (errno syscall.Errno) {
|
func (fh *bytesFileWriteHandle) Flush(ctx context.Context) (errno syscall.Errno) {
|
||||||
if len(fh.content) == 0 {
|
if len(fh.content) == 0 {
|
||||||
return 0
|
return 0
|
||||||
@ -336,12 +336,12 @@ func (fh *bytesFileWriteHandle) Flush(ctx context.Context) (errno syscall.Errno)
|
|||||||
|
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
var _ = (fs.FileFsyncer)((*bytesFileWriteHandle)(nil))
|
var _ fs.FileFsyncer = (*bytesFileWriteHandle)(nil)
|
||||||
func (fh *bytesFileWriteHandle) Fsync(ctx context.Context, flags uint32) (errno syscall.Errno) {
|
func (fh *bytesFileWriteHandle) Fsync(ctx context.Context, flags uint32) (errno syscall.Errno) {
|
||||||
return fh.Flush(ctx)
|
return fh.Flush(ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
var _ = (fs.NodeGetattrer)((*ITNode)(nil))
|
var _ fs.NodeGetattrer = (*ITNode)(nil)
|
||||||
func (bn *ITNode) Getattr(ctx context.Context, f fs.FileHandle, out *fuse.AttrOut) syscall.Errno {
|
func (bn *ITNode) Getattr(ctx context.Context, f fs.FileHandle, out *fuse.AttrOut) syscall.Errno {
|
||||||
log.Info("getattr").Str("path", bn.path).Send()
|
log.Info("getattr").Str("path", bn.path).Send()
|
||||||
out.Ino = bn.Ino
|
out.Ino = bn.Ino
|
||||||
@ -352,7 +352,7 @@ func (bn *ITNode) Getattr(ctx context.Context, f fs.FileHandle, out *fuse.AttrOu
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
var _ = (fs.NodeSetattrer)((*ITNode)(nil))
|
var _ fs.NodeSetattrer = (*ITNode)(nil)
|
||||||
func (bn *ITNode) Setattr(ctx context.Context, fh fs.FileHandle, in *fuse.SetAttrIn, out *fuse.AttrOut) syscall.Errno {
|
func (bn *ITNode) Setattr(ctx context.Context, fh fs.FileHandle, in *fuse.SetAttrIn, out *fuse.AttrOut) syscall.Errno {
|
||||||
log.Info("setattr").Str("path", bn.path).Send()
|
log.Info("setattr").Str("path", bn.path).Send()
|
||||||
out.Size = 0
|
out.Size = 0
|
||||||
@ -360,7 +360,7 @@ func (bn *ITNode) Setattr(ctx context.Context, fh fs.FileHandle, in *fuse.SetAtt
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
var _ = (fs.NodeOpener)((*ITNode)(nil))
|
var _ fs.NodeOpener = (*ITNode)(nil)
|
||||||
func (f *ITNode) Open(ctx context.Context, openFlags uint32) (fh fs.FileHandle, fuseFlags uint32, errno syscall.Errno) {
|
func (f *ITNode) Open(ctx context.Context, openFlags uint32) (fh fs.FileHandle, fuseFlags uint32, errno syscall.Errno) {
|
||||||
switch f.kind {
|
switch f.kind {
|
||||||
case 2:
|
case 2:
|
||||||
@ -436,7 +436,7 @@ func (f *ITNode) Open(ctx context.Context, openFlags uint32) (fh fs.FileHandle,
|
|||||||
return nil, 0, syscall.EROFS
|
return nil, 0, syscall.EROFS
|
||||||
}
|
}
|
||||||
|
|
||||||
var _ = (fs.NodeCreater)((*ITNode)(nil))
|
var _ fs.NodeCreater = (*ITNode)(nil)
|
||||||
func (f *ITNode) Create(ctx context.Context, name string, flags uint32, mode uint32, out *fuse.EntryOut) (node *fs.Inode, fh fs.FileHandle, fuseFlags uint32, errno syscall.Errno) {
|
func (f *ITNode) Create(ctx context.Context, name string, flags uint32, mode uint32, out *fuse.EntryOut) (node *fs.Inode, fh fs.FileHandle, fuseFlags uint32, errno syscall.Errno) {
|
||||||
if f.kind != 2 {
|
if f.kind != 2 {
|
||||||
return nil, nil, 0, syscall.EROFS
|
return nil, nil, 0, syscall.EROFS
|
||||||
@ -467,7 +467,7 @@ func (f *ITNode) Create(ctx context.Context, name string, flags uint32, mode uin
|
|||||||
return node, fh, fuseFlags, 0
|
return node, fh, fuseFlags, 0
|
||||||
}
|
}
|
||||||
|
|
||||||
var _ = (fs.NodeMkdirer)((*ITNode)(nil))
|
var _ fs.NodeMkdirer = (*ITNode)(nil)
|
||||||
func (f *ITNode) Mkdir(ctx context.Context, name string, mode uint32, out *fuse.EntryOut) (*fs.Inode, syscall.Errno) {
|
func (f *ITNode) Mkdir(ctx context.Context, name string, mode uint32, out *fuse.EntryOut) (*fs.Inode, syscall.Errno) {
|
||||||
if f.kind != 2 {
|
if f.kind != 2 {
|
||||||
return nil, syscall.EROFS
|
return nil, syscall.EROFS
|
||||||
@ -503,7 +503,7 @@ func (f *ITNode) Mkdir(ctx context.Context, name string, mode uint32, out *fuse.
|
|||||||
return node, 0
|
return node, 0
|
||||||
}
|
}
|
||||||
|
|
||||||
var _ = (fs.NodeRenamer)((*ITNode)(nil))
|
var _ fs.NodeRenamer = (*ITNode)(nil)
|
||||||
func (f *ITNode) Rename(ctx context.Context, name string, newParent fs.InodeEmbedder, newName string, flags uint32) syscall.Errno {
|
func (f *ITNode) Rename(ctx context.Context, name string, newParent fs.InodeEmbedder, newName string, flags uint32) syscall.Errno {
|
||||||
p1 := f.path + "/" + name
|
p1 := f.path + "/" + name
|
||||||
p2 := newParent.EmbeddedInode().Path(nil)[2:] + "/" + newName
|
p2 := newParent.EmbeddedInode().Path(nil)[2:] + "/" + newName
|
||||||
@ -530,7 +530,7 @@ func (f *ITNode) Rename(ctx context.Context, name string, newParent fs.InodeEmbe
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
var _ = (fs.NodeUnlinker)((*ITNode)(nil))
|
var _ fs.NodeUnlinker = (*ITNode)(nil)
|
||||||
func (f *ITNode) Unlink(ctx context.Context, name string) syscall.Errno {
|
func (f *ITNode) Unlink(ctx context.Context, name string) syscall.Errno {
|
||||||
delete(inodemap, f.path + "/" + name)
|
delete(inodemap, f.path + "/" + name)
|
||||||
err := myfs.Remove(f.path + "/" + name)
|
err := myfs.Remove(f.path + "/" + name)
|
||||||
@ -549,7 +549,7 @@ func (f *ITNode) Unlink(ctx context.Context, name string) syscall.Errno {
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
var _ = (fs.NodeRmdirer)((*ITNode)(nil))
|
var _ fs.NodeRmdirer = (*ITNode)(nil)
|
||||||
func (f *ITNode) Rmdir(ctx context.Context, name string) syscall.Errno {
|
func (f *ITNode) Rmdir(ctx context.Context, name string) syscall.Errno {
|
||||||
return f.Unlink(ctx, name)
|
return f.Unlink(ctx, name)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user