Skip to content

Commit

Permalink
Use templates instead of empty implementations
Browse files Browse the repository at this point in the history
Signed-off-by: Chris Koch <[email protected]>
  • Loading branch information
hugelgupf committed Aug 14, 2023
1 parent f45bce6 commit 65d54e1
Showing 1 changed file with 5 additions and 34 deletions.
39 changes: 5 additions & 34 deletions client/cpio9p.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand All @@ -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
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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
Expand All @@ -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.
Expand Down

0 comments on commit 65d54e1

Please sign in to comment.