diff --git a/cmd/lotus-miner/storage.go b/cmd/lotus-miner/storage.go index 7823f484d..035af80c6 100644 --- a/cmd/lotus-miner/storage.go +++ b/cmd/lotus-miner/storage.go @@ -5,6 +5,7 @@ import ( "encoding/json" "fmt" "io/ioutil" + "math/bits" "os" "path/filepath" "sort" @@ -345,6 +346,20 @@ var storageListCmd = &cli.Command{ fmt.Printf("\tAllowTo: %s\n", strings.Join(si.AllowTo, ", ")) } + if len(si.AllowTypes) > 0 || len(si.DenyTypes) > 0 { + denied := storiface.FTAll.SubAllowed(si.AllowTypes, si.DenyTypes) + allowed := storiface.FTAll ^ denied + + switch { + case bits.OnesCount64(uint64(allowed)) == 0: + fmt.Printf("\tAllow Types: %s\n", color.RedString("None")) + case bits.OnesCount64(uint64(allowed)) < bits.OnesCount64(uint64(denied)): + fmt.Printf("\tAllow Types: %s\n", color.GreenString(strings.Join(allowed.Strings(), " "))) + default: + fmt.Printf("\tDeny Types: %s\n", color.RedString(strings.Join(denied.Strings(), " "))) + } + } + if localPath, ok := local[s.ID]; ok { fmt.Printf("\tLocal: %s\n", color.GreenString(localPath)) } diff --git a/storage/sealer/storiface/filetype.go b/storage/sealer/storiface/filetype.go index 807c3f853..5aca9f4db 100644 --- a/storage/sealer/storiface/filetype.go +++ b/storage/sealer/storiface/filetype.go @@ -24,6 +24,13 @@ const ( FTNone SectorFileType = 0 ) +var FTAll = func() (out SectorFileType) { + for _, pathType := range PathTypes { + out |= pathType + } + return out +}() + const FSOverheadDen = 10 var FSOverheadSeal = map[SectorFileType]int{ // 10x overheads