From 65d54e146c83964fb1f582a83b3af16f6dc32efd Mon Sep 17 00:00:00 2001 From: Chris Koch Date: Sun, 13 Aug 2023 17:47:09 -0700 Subject: [PATCH] Use templates instead of empty implementations Signed-off-by: Chris Koch --- client/cpio9p.go | 39 +++++---------------------------------- 1 file changed, 5 insertions(+), 34 deletions(-) diff --git a/client/cpio9p.go b/client/cpio9p.go index bc6889f7..f1866363 100644 --- a/client/cpio9p.go +++ b/client/cpio9p.go @@ -22,6 +22,7 @@ import ( "path/filepath" "syscall" + "github.com/hugelgupf/p9/fsimpl/templatefs" "github.com/hugelgupf/p9/p9" "github.com/u-root/u-root/pkg/cpio" ) @@ -41,6 +42,10 @@ type CPIO9P struct { // for every FID. Luckily they go away when clunked. type CPIO9PFID struct { p9.DefaultWalkGetAttr + templatefs.XattrUnimplemented + templatefs.NilCloser + templatefs.NilSyncer + templatefs.NoopRenamed fs *CPIO9P path uint64 @@ -180,16 +185,6 @@ func (l *CPIO9PFID) Walk(names []string) ([]p9.QID, p9.File, error) { return qids, last, nil } -// FSync implements p9.File.FSync. -func (l *CPIO9PFID) FSync() error { - return nil -} - -// Close implements p9.File.Close. -func (l *CPIO9PFID) Close() error { - return nil -} - // Open implements p9.File.Open. func (l *CPIO9PFID) Open(mode p9.OpenFlags) (p9.QID, uint32, error) { qid, fi, err := l.info() @@ -349,10 +344,6 @@ func (l *CPIO9PFID) Flush() error { return nil } -// Renamed implements p9.File.Renamed. -func (l *CPIO9PFID) Renamed(parent p9.File, newName string) { -} - // UnlinkAt implements p9.File.UnlinkAt. func (l *CPIO9PFID) UnlinkAt(name string, flags uint32) error { return os.ErrPermission @@ -374,26 +365,6 @@ func (l *CPIO9PFID) RenameAt(oldName string, newDir p9.File, newName string) err return syscall.ENOSYS } -// SetXattr implements p9.File.SetXattr -func (l *CPIO9PFID) SetXattr(attr string, data []byte, flags p9.XattrFlags) error { - return syscall.ENOSYS -} - -// ListXattrs implements p9.File.ListXattrs -func (l *CPIO9PFID) ListXattrs() ([]string, error) { - return nil, syscall.ENOSYS -} - -// GetXattr implements p9.File.GetXattr -func (l *CPIO9PFID) GetXattr(attr string) ([]byte, error) { - return nil, syscall.ENOSYS -} - -// RemoveXattr implements p9.File.RemoveXattr -func (l *CPIO9PFID) RemoveXattr(attr string) error { - return syscall.ENOSYS -} - // StatFS implements p9.File.StatFS. // // Not implemented.