default: t.Errorf("unexpected error: %v", err) } } // Test custom error. type customErrNode struct { dir } type myCustomError struct { fuse.ErrorNumber } var _ = fuse.ErrorNumber(myCustomError{}) func (myCustomError) Error() string { return "bork" } func (f customErrNode) Lookup(name string, intr fs.Intr) (fs.Node, fuse.Error) { return nil, myCustomError{ ErrorNumber: fuse.Errno(syscall.ENAMETOOLONG), } } func TestCustomErrno(t *testing.T) { t.Parallel() mnt, err := fstestutil.MountedT(t, simpleFS{customErrNode{}}) if err != nil {
"bazil.org/fuse" "github.com/boltdb/bolt" ) func inodeToBytes(inode uint64, buf []byte) { binary.BigEndian.PutUint64(buf, inode) } func bytesToInode(buf []byte) uint64 { return binary.BigEndian.Uint64(buf) } type outOfInodesError struct{} var _ = error(outOfInodesError{}) var _ = fuse.ErrorNumber(outOfInodesError{}) func (outOfInodesError) Error() string { return "out of inodes" } func (outOfInodesError) Errno() fuse.Errno { return fuse.Errno(syscall.ENOSPC) } var OutOfInodes = outOfInodesError{} // Allocate returns the next available inode number, and marks it // used. // // Returns OutOfInodes if there are no free inodes.