~rbn/neinp

ref: b441da6dea2e963387a86b9d1d57802b77f21b83 neinp/nopfs.go -rw-r--r-- 1.9 KiB
b441da6dRuben Schuller initial commit 2 years ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
package neinp

import (
	"github.com/rbns/neinp/message"
	"context"
	"errors"
)

// NopP2000 is a dummy impementation of interface P2000, returning error for every call.
// It can be embedded into own implementations if some functions aren't required.
// For a working mount (with p9p 9pfuse or linux kernel module), at least Version, Attach,
// Stat, Walk, Open, Read, and Clunk need to be implemented.
type NopP2000 struct{}

var errNop = errors.New("not implemented")

func (f *NopP2000) Version(context.Context, message.TVersion) (message.RVersion, error) {
	return message.RVersion{}, errNop
}

func (f *NopP2000) Auth(context.Context, message.TAuth) (message.RAuth, error) {
	return message.RAuth{}, errNop
}

func (f *NopP2000) Attach(context.Context, message.TAttach) (message.RAttach, error) {
	return message.RAttach{}, errNop
}

func (f *NopP2000) Walk(context.Context, message.TWalk) (message.RWalk, error) {
	return message.RWalk{}, errNop
}

func (f *NopP2000) Open(context.Context, message.TOpen) (message.ROpen, error) {
	return message.ROpen{}, errNop
}

func (f *NopP2000) Create(context.Context, message.TCreate) (message.RCreate, error) {
	return message.RCreate{}, errNop
}

func (f *NopP2000) Read(context.Context, message.TRead) (message.RRead, error) {
	return message.RRead{}, errNop
}

func (f *NopP2000) Write(context.Context, message.TWrite) (message.RWrite, error) {
	return message.RWrite{}, errNop
}

func (f *NopP2000) Clunk(context.Context, message.TClunk) (message.RClunk, error) {
	return message.RClunk{}, errNop
}

func (f *NopP2000) Remove(context.Context, message.TRemove) (message.RRemove, error) {
	return message.RRemove{}, errNop
}

func (f *NopP2000) Stat(context.Context, message.TStat) (message.RStat, error) {
	return message.RStat{}, errNop
}

func (f *NopP2000) Wstat(context.Context, message.TWstat) (message.RWstat, error) {
	return message.RWstat{}, errNop
}

func (f *NopP2000) Close() error {
	return nil
}