Skip to content

Commit

Permalink
Add CheckFsFunc type
Browse files Browse the repository at this point in the history
  • Loading branch information
yusuke-koyoshi committed Jun 22, 2024
1 parent dac013b commit 95ceb2d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 12 deletions.
7 changes: 1 addition & 6 deletions disk.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,7 @@ import (
"golang.org/x/xerrors"
)

func NewDriver(
sr *io.SectionReader,
checkFsFuncs ...func(
r io.Reader,
) bool,
) (types.Driver, error) {
func NewDriver(sr *io.SectionReader, checkFsFuncs ...fs.CheckFsFunc) (types.Driver, error) {
m, err := mbr.NewMasterBootRecord(sr)
if err != nil {
if xerrors.Is(mbr.InvalidSignature, err) {
Expand Down
9 changes: 3 additions & 6 deletions fs/fs.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,9 @@ func NewDirectFileSystem(sr *io.SectionReader) (*DirectFileSystem, error) {
}, nil
}

func CheckFileSystems(
r *io.SectionReader,
checkFsFuncs []func(
r io.Reader,
) bool,
) (bool, error) {
type CheckFsFunc func(r io.Reader) bool

func CheckFileSystems(r *io.SectionReader, checkFsFuncs []CheckFsFunc) (bool, error) {
for _, checkFsFunc := range checkFsFuncs {
_, err := r.Seek(0, io.SeekStart)
if err != nil {
Expand Down

0 comments on commit 95ceb2d

Please sign in to comment.