diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/binstruct/binint/builtins.go | 117 | ||||
-rw-r--r-- | lib/binstruct/size.go | 15 | ||||
-rw-r--r-- | lib/btrfs/btrfsitem/statmode.go | 4 | ||||
-rw-r--r-- | lib/btrfs/btrfsprim/objid.go | 3 | ||||
-rw-r--r-- | lib/btrfs/btrfsprim/uuid.go | 3 | ||||
-rw-r--r-- | lib/btrfs/btrfssum/csum.go | 3 | ||||
-rw-r--r-- | lib/btrfs/btrfssum/shortsum.go | 5 | ||||
-rw-r--r-- | lib/btrfs/btrfstree/types_node.go | 10 | ||||
-rw-r--r-- | lib/btrfsprogs/btrfsinspect/mount.go | 2 | ||||
-rw-r--r-- | lib/btrfsprogs/btrfsinspect/rebuildmappings/fuzzymatchsums.go | 4 | ||||
-rw-r--r-- | lib/btrfsprogs/btrfsinspect/rebuildmappings/matchsums.go | 7 | ||||
-rw-r--r-- | lib/btrfsprogs/btrfsinspect/rebuildmappings/rebuildmappings.go | 9 | ||||
-rw-r--r-- | lib/btrfsprogs/btrfsutil/open.go | 7 |
13 files changed, 106 insertions, 83 deletions
diff --git a/lib/binstruct/binint/builtins.go b/lib/binstruct/binint/builtins.go index e4be2a6..cfd0fc2 100644 --- a/lib/binstruct/binint/builtins.go +++ b/lib/binstruct/binint/builtins.go @@ -1,4 +1,4 @@ -// Copyright (C) 2022 Luke Shumaker <lukeshu@lukeshu.com> +// Copyright (C) 2022-2023 Luke Shumaker <lukeshu@lukeshu.com> // // SPDX-License-Identifier: GPL-2.0-or-later @@ -10,242 +10,249 @@ import ( "git.lukeshu.com/btrfs-progs-ng/lib/binstruct/binutil" ) +const ( + sizeof8 = 1 + sizeof16 = 2 + sizeof32 = 4 + sizeof64 = 8 +) + // unsigned type U8 uint8 -func (U8) BinaryStaticSize() int { return 1 } +func (U8) BinaryStaticSize() int { return sizeof8 } func (x U8) MarshalBinary() ([]byte, error) { return []byte{byte(x)}, nil } func (x *U8) UnmarshalBinary(dat []byte) (int, error) { - if err := binutil.NeedNBytes(dat, 1); err != nil { + if err := binutil.NeedNBytes(dat, sizeof8); err != nil { return 0, err } *x = U8(dat[0]) - return 1, nil + return sizeof8, nil } // unsigned little endian type U16le uint16 -func (U16le) BinaryStaticSize() int { return 2 } +func (U16le) BinaryStaticSize() int { return sizeof16 } func (x U16le) MarshalBinary() ([]byte, error) { - var buf [2]byte + var buf [sizeof16]byte binary.LittleEndian.PutUint16(buf[:], uint16(x)) return buf[:], nil } func (x *U16le) UnmarshalBinary(dat []byte) (int, error) { - if err := binutil.NeedNBytes(dat, 2); err != nil { + if err := binutil.NeedNBytes(dat, sizeof16); err != nil { return 0, err } *x = U16le(binary.LittleEndian.Uint16(dat)) - return 2, nil + return sizeof16, nil } type U32le uint32 -func (U32le) BinaryStaticSize() int { return 4 } +func (U32le) BinaryStaticSize() int { return sizeof32 } func (x U32le) MarshalBinary() ([]byte, error) { - var buf [4]byte + var buf [sizeof32]byte binary.LittleEndian.PutUint32(buf[:], uint32(x)) return buf[:], nil } func (x *U32le) UnmarshalBinary(dat []byte) (int, error) { - if err := binutil.NeedNBytes(dat, 4); err != nil { + if err := binutil.NeedNBytes(dat, sizeof32); err != nil { return 0, err } *x = U32le(binary.LittleEndian.Uint32(dat)) - return 4, nil + return sizeof32, nil } type U64le uint64 -func (U64le) BinaryStaticSize() int { return 8 } +func (U64le) BinaryStaticSize() int { return sizeof64 } func (x U64le) MarshalBinary() ([]byte, error) { - var buf [8]byte + var buf [sizeof64]byte binary.LittleEndian.PutUint64(buf[:], uint64(x)) return buf[:], nil } func (x *U64le) UnmarshalBinary(dat []byte) (int, error) { - if err := binutil.NeedNBytes(dat, 8); err != nil { + if err := binutil.NeedNBytes(dat, sizeof64); err != nil { return 0, err } *x = U64le(binary.LittleEndian.Uint64(dat)) - return 8, nil + return sizeof64, nil } // unsigned big endian type U16be uint16 -func (U16be) BinaryStaticSize() int { return 2 } +func (U16be) BinaryStaticSize() int { return sizeof16 } func (x U16be) MarshalBinary() ([]byte, error) { - var buf [2]byte + var buf [sizeof16]byte binary.BigEndian.PutUint16(buf[:], uint16(x)) return buf[:], nil } func (x *U16be) UnmarshalBinary(dat []byte) (int, error) { - if err := binutil.NeedNBytes(dat, 2); err != nil { + if err := binutil.NeedNBytes(dat, sizeof16); err != nil { return 0, err } *x = U16be(binary.BigEndian.Uint16(dat)) - return 2, nil + return sizeof16, nil } type U32be uint32 -func (U32be) BinaryStaticSize() int { return 4 } +func (U32be) BinaryStaticSize() int { return sizeof32 } func (x U32be) MarshalBinary() ([]byte, error) { - var buf [4]byte + var buf [sizeof32]byte binary.BigEndian.PutUint32(buf[:], uint32(x)) return buf[:], nil } func (x *U32be) UnmarshalBinary(dat []byte) (int, error) { - if err := binutil.NeedNBytes(dat, 4); err != nil { + if err := binutil.NeedNBytes(dat, sizeof32); err != nil { return 0, err } *x = U32be(binary.BigEndian.Uint32(dat)) - return 4, nil + return sizeof32, nil } type U64be uint64 -func (U64be) BinaryStaticSize() int { return 8 } +func (U64be) BinaryStaticSize() int { return sizeof64 } func (x U64be) MarshalBinary() ([]byte, error) { - var buf [8]byte + var buf [sizeof64]byte binary.BigEndian.PutUint64(buf[:], uint64(x)) return buf[:], nil } func (x *U64be) UnmarshalBinary(dat []byte) (int, error) { - if err := binutil.NeedNBytes(dat, 8); err != nil { + if err := binutil.NeedNBytes(dat, sizeof64); err != nil { return 0, err } *x = U64be(binary.BigEndian.Uint64(dat)) - return 8, nil + return sizeof64, nil } // signed type I8 int8 -func (I8) BinaryStaticSize() int { return 1 } +func (I8) BinaryStaticSize() int { return sizeof8 } func (x I8) MarshalBinary() ([]byte, error) { return []byte{byte(x)}, nil } func (x *I8) UnmarshalBinary(dat []byte) (int, error) { - if err := binutil.NeedNBytes(dat, 1); err != nil { + if err := binutil.NeedNBytes(dat, sizeof8); err != nil { return 0, err } *x = I8(dat[0]) - return 1, nil + return sizeof8, nil } // signed little endian type I16le int16 -func (I16le) BinaryStaticSize() int { return 2 } +func (I16le) BinaryStaticSize() int { return sizeof16 } func (x I16le) MarshalBinary() ([]byte, error) { - var buf [2]byte + var buf [sizeof16]byte binary.LittleEndian.PutUint16(buf[:], uint16(x)) return buf[:], nil } func (x *I16le) UnmarshalBinary(dat []byte) (int, error) { - if err := binutil.NeedNBytes(dat, 2); err != nil { + if err := binutil.NeedNBytes(dat, sizeof16); err != nil { return 0, err } *x = I16le(binary.LittleEndian.Uint16(dat)) - return 2, nil + return sizeof16, nil } type I32le int32 -func (I32le) BinaryStaticSize() int { return 4 } +func (I32le) BinaryStaticSize() int { return sizeof32 } func (x I32le) MarshalBinary() ([]byte, error) { - var buf [4]byte + var buf [sizeof32]byte binary.LittleEndian.PutUint32(buf[:], uint32(x)) return buf[:], nil } func (x *I32le) UnmarshalBinary(dat []byte) (int, error) { - if err := binutil.NeedNBytes(dat, 4); err != nil { + if err := binutil.NeedNBytes(dat, sizeof32); err != nil { return 0, err } *x = I32le(binary.LittleEndian.Uint32(dat)) - return 4, nil + return sizeof32, nil } type I64le int64 -func (I64le) BinaryStaticSize() int { return 8 } +func (I64le) BinaryStaticSize() int { return sizeof64 } func (x I64le) MarshalBinary() ([]byte, error) { - var buf [8]byte + var buf [sizeof64]byte binary.LittleEndian.PutUint64(buf[:], uint64(x)) return buf[:], nil } func (x *I64le) UnmarshalBinary(dat []byte) (int, error) { - if err := binutil.NeedNBytes(dat, 8); err != nil { + if err := binutil.NeedNBytes(dat, sizeof64); err != nil { return 0, err } *x = I64le(binary.LittleEndian.Uint64(dat)) - return 8, nil + return sizeof64, nil } // signed big endian type I16be int16 -func (I16be) BinaryStaticSize() int { return 2 } +func (I16be) BinaryStaticSize() int { return sizeof16 } func (x I16be) MarshalBinary() ([]byte, error) { - var buf [2]byte + var buf [sizeof16]byte binary.BigEndian.PutUint16(buf[:], uint16(x)) return buf[:], nil } func (x *I16be) UnmarshalBinary(dat []byte) (int, error) { - if err := binutil.NeedNBytes(dat, 2); err != nil { + if err := binutil.NeedNBytes(dat, sizeof16); err != nil { return 0, err } *x = I16be(binary.BigEndian.Uint16(dat)) - return 2, nil + return sizeof16, nil } type I32be int32 -func (I32be) BinaryStaticSize() int { return 4 } +func (I32be) BinaryStaticSize() int { return sizeof32 } func (x I32be) MarshalBinary() ([]byte, error) { - var buf [4]byte + var buf [sizeof32]byte binary.BigEndian.PutUint32(buf[:], uint32(x)) return buf[:], nil } func (x *I32be) UnmarshalBinary(dat []byte) (int, error) { - if err := binutil.NeedNBytes(dat, 4); err != nil { + if err := binutil.NeedNBytes(dat, sizeof32); err != nil { return 0, err } *x = I32be(binary.BigEndian.Uint32(dat)) - return 4, nil + return sizeof32, nil } type I64be int64 -func (I64be) BinaryStaticSize() int { return 8 } +func (I64be) BinaryStaticSize() int { return sizeof64 } func (x I64be) MarshalBinary() ([]byte, error) { - var buf [8]byte + var buf [sizeof64]byte binary.BigEndian.PutUint64(buf[:], uint64(x)) return buf[:], nil } func (x *I64be) UnmarshalBinary(dat []byte) (int, error) { - if err := binutil.NeedNBytes(dat, 8); err != nil { + if err := binutil.NeedNBytes(dat, sizeof64); err != nil { return 0, err } *x = I64be(binary.BigEndian.Uint64(dat)) - return 8, nil + return sizeof64, nil } diff --git a/lib/binstruct/size.go b/lib/binstruct/size.go index 52fa380..d6d70c6 100644 --- a/lib/binstruct/size.go +++ b/lib/binstruct/size.go @@ -28,6 +28,13 @@ var ( unmarshalerType = reflect.TypeOf((*Unmarshaler)(nil)).Elem() ) +const ( + sizeof8 = 1 + sizeof16 = 2 + sizeof32 = 4 + sizeof64 = 8 +) + func staticSize(typ reflect.Type) (int, error) { if typ.Implements(staticSizerType) { //nolint:forcetypeassert // Already did a type check via reflection. @@ -43,13 +50,13 @@ func staticSize(typ reflect.Type) (int, error) { } switch typ.Kind() { case reflect.Uint8, reflect.Int8: - return 1, nil + return sizeof8, nil case reflect.Uint16, reflect.Int16: - return 2, nil + return sizeof16, nil case reflect.Uint32, reflect.Int32: - return 4, nil + return sizeof32, nil case reflect.Uint64, reflect.Int64: - return 8, nil + return sizeof64, nil case reflect.Ptr: return staticSize(typ.Elem()) case reflect.Array: diff --git a/lib/btrfs/btrfsitem/statmode.go b/lib/btrfs/btrfsitem/statmode.go index a1302ee..557b688 100644 --- a/lib/btrfs/btrfsitem/statmode.go +++ b/lib/btrfs/btrfsitem/statmode.go @@ -1,5 +1,5 @@ // Copyright (C) 2020-2021 Ambassador Labs -// Copyright (C) 2022 Luke Shumaker <lukeshu@lukeshu.com> +// Copyright (C) 2022-2023 Luke Shumaker <lukeshu@lukeshu.com> // // SPDX-License-Identifier: Apache-2.0 // @@ -9,7 +9,6 @@ package btrfsitem type StatMode uint32 -//nolint:deadcode,varcheck // not all of these modes will be used const ( // 16 bits = 5⅓ octal characters @@ -73,6 +72,7 @@ func (mode StatMode) IsRegular() bool { // 's' (GNU `ls` behavior; though POSIX notes that many // implementations use '=' for sockets). func (mode StatMode) String() string { + //nolint:gomnd // Magic numbers is all this is. buf := [10]byte{ // type: This string is easy; it directly pairs with // the above ModeFmtXXX list above; the character in diff --git a/lib/btrfs/btrfsprim/objid.go b/lib/btrfs/btrfsprim/objid.go index 17a0eeb..5ba213d 100644 --- a/lib/btrfs/btrfsprim/objid.go +++ b/lib/btrfs/btrfsprim/objid.go @@ -1,4 +1,4 @@ -// Copyright (C) 2022 Luke Shumaker <lukeshu@lukeshu.com> +// Copyright (C) 2022-2023 Luke Shumaker <lukeshu@lukeshu.com> // // SPDX-License-Identifier: GPL-2.0-or-later @@ -68,6 +68,7 @@ func (id ObjID) Format(typ ItemType) string { case DEV_EXTENT_KEY: return fmt.Sprintf("%d", int64(id)) case QGROUP_RELATION_KEY: + //nolint:gomnd // TODO: I'm not sure what the 48/16 bit split means. return fmt.Sprintf("%d/%d", uint64(id)>>48, uint64(id)&((1<<48)-1)) diff --git a/lib/btrfs/btrfsprim/uuid.go b/lib/btrfs/btrfsprim/uuid.go index 4e3fd6b..0103ee4 100644 --- a/lib/btrfs/btrfsprim/uuid.go +++ b/lib/btrfs/btrfsprim/uuid.go @@ -1,4 +1,4 @@ -// Copyright (C) 2022 Luke Shumaker <lukeshu@lukeshu.com> +// Copyright (C) 2022-2023 Luke Shumaker <lukeshu@lukeshu.com> // // SPDX-License-Identifier: GPL-2.0-or-later @@ -56,6 +56,7 @@ func (a UUID) Cmp(b UUID) int { return 0 } +//nolint:gomnd // This is all magic numbers. func ParseUUID(str string) (UUID, error) { var ret UUID j := 0 diff --git a/lib/btrfs/btrfssum/csum.go b/lib/btrfs/btrfssum/csum.go index 770f6ea..6df9efd 100644 --- a/lib/btrfs/btrfssum/csum.go +++ b/lib/btrfs/btrfssum/csum.go @@ -1,4 +1,4 @@ -// Copyright (C) 2022 Luke Shumaker <lukeshu@lukeshu.com> +// Copyright (C) 2022-2023 Luke Shumaker <lukeshu@lukeshu.com> // // SPDX-License-Identifier: GPL-2.0-or-later @@ -70,6 +70,7 @@ func (typ CSumType) String() string { } func (typ CSumType) Size() int { + //nolint:gomnd // This is where we define the magic numbers. sizes := map[CSumType]int{ TYPE_CRC32: 4, TYPE_XXHASH: 8, diff --git a/lib/btrfs/btrfssum/shortsum.go b/lib/btrfs/btrfssum/shortsum.go index 6fd0c68..aaf7a89 100644 --- a/lib/btrfs/btrfssum/shortsum.go +++ b/lib/btrfs/btrfssum/shortsum.go @@ -1,4 +1,4 @@ -// Copyright (C) 2022 Luke Shumaker <lukeshu@lukeshu.com> +// Copyright (C) 2022-2023 Luke Shumaker <lukeshu@lukeshu.com> // // SPDX-License-Identifier: GPL-2.0-or-later @@ -56,10 +56,11 @@ func (sum ShortSum) EncodeJSON(w io.Writer) error { } func deHex(r rune) (byte, bool) { - if r > 0xff { + if r > math.MaxUint8 { return 0, false } c := byte(r) + //nolint:gomnd // Hex conversion. switch { case '0' <= c && c <= '9': return c - '0', true diff --git a/lib/btrfs/btrfstree/types_node.go b/lib/btrfs/btrfstree/types_node.go index b709d34..a26215b 100644 --- a/lib/btrfs/btrfstree/types_node.go +++ b/lib/btrfs/btrfstree/types_node.go @@ -23,21 +23,23 @@ import ( type NodeFlags uint64 +const sizeofNodeFlags = 7 + func (NodeFlags) BinaryStaticSize() int { - return 7 + return sizeofNodeFlags } func (f NodeFlags) MarshalBinary() ([]byte, error) { var bs [8]byte binary.LittleEndian.PutUint64(bs[:], uint64(f)) - return bs[:7], nil + return bs[:sizeofNodeFlags], nil } func (f *NodeFlags) UnmarshalBinary(dat []byte) (int, error) { var bs [8]byte - copy(bs[:7], dat[:7]) + copy(bs[:sizeofNodeFlags], dat[:sizeofNodeFlags]) *f = NodeFlags(binary.LittleEndian.Uint64(bs[:])) - return 7, nil + return sizeofNodeFlags, nil } var ( diff --git a/lib/btrfsprogs/btrfsinspect/mount.go b/lib/btrfsprogs/btrfsinspect/mount.go index f061526..d10037d 100644 --- a/lib/btrfsprogs/btrfsinspect/mount.go +++ b/lib/btrfsprogs/btrfsinspect/mount.go @@ -260,7 +260,7 @@ func (sv *subvolume) LookUpInode(_ context.Context, op *fuseops.LookUpInodeOp) e Child: 2, // an inode number that a real file will never have Attributes: fuseops.InodeAttributes{ Nlink: 1, - Mode: uint32(btrfsitem.ModeFmtDir | 0o700), + Mode: uint32(btrfsitem.ModeFmtDir | 0o700), //nolint:gomnd // TODO }, } return nil diff --git a/lib/btrfsprogs/btrfsinspect/rebuildmappings/fuzzymatchsums.go b/lib/btrfsprogs/btrfsinspect/rebuildmappings/fuzzymatchsums.go index a8d05eb..9e6b864 100644 --- a/lib/btrfsprogs/btrfsinspect/rebuildmappings/fuzzymatchsums.go +++ b/lib/btrfsprogs/btrfsinspect/rebuildmappings/fuzzymatchsums.go @@ -112,8 +112,8 @@ func fuzzyMatchBlockGroupSums(ctx context.Context, if apply { lvl = dlog.LogLevelInfo } - dlog.Logf(ctx, lvl, "(%v/%v) blockgroup[laddr=%v] matches=[%s]; bestpossible=%v%% (based on %v runs)", - i+1, numBlockgroups, bgLAddr, matchesStr, int(100*bgRun.PctFull()), len(bgRun.Runs)) + dlog.Logf(ctx, lvl, "(%v/%v) blockgroup[laddr=%v] matches=[%s]; bestpossible=%v (based on %v runs)", + i+1, numBlockgroups, bgLAddr, matchesStr, number.Percent(bgRun.PctFull()), len(bgRun.Runs)) if !apply { continue } diff --git a/lib/btrfsprogs/btrfsinspect/rebuildmappings/matchsums.go b/lib/btrfsprogs/btrfsinspect/rebuildmappings/matchsums.go index be82f87..02c657f 100644 --- a/lib/btrfsprogs/btrfsinspect/rebuildmappings/matchsums.go +++ b/lib/btrfsprogs/btrfsinspect/rebuildmappings/matchsums.go @@ -1,4 +1,4 @@ -// Copyright (C) 2022 Luke Shumaker <lukeshu@lukeshu.com> +// Copyright (C) 2022-2023 Luke Shumaker <lukeshu@lukeshu.com> // // SPDX-License-Identifier: GPL-2.0-or-later @@ -8,6 +8,7 @@ import ( "context" "github.com/datawire/dlib/dlog" + "golang.org/x/text/number" "git.lukeshu.com/btrfs-progs-ng/lib/btrfs" "git.lukeshu.com/btrfs-progs-ng/lib/btrfs/btrfssum" @@ -55,8 +56,8 @@ func matchBlockGroupSums(ctx context.Context, if len(matches) == 1 { lvl = dlog.LogLevelInfo } - dlog.Logf(ctx, lvl, "(%v/%v) blockgroup[laddr=%v] has %v matches based on %v%% coverage from %v runs", - i+1, numBlockgroups, bgLAddr, len(matches), int(100*bgRun.PctFull()), len(bgRun.Runs)) + dlog.Logf(ctx, lvl, "(%v/%v) blockgroup[laddr=%v] has %v matches based on %v coverage from %v runs", + i+1, numBlockgroups, bgLAddr, len(matches), number.Percent(bgRun.PctFull()), len(bgRun.Runs)) if len(matches) != 1 { continue } diff --git a/lib/btrfsprogs/btrfsinspect/rebuildmappings/rebuildmappings.go b/lib/btrfsprogs/btrfsinspect/rebuildmappings/rebuildmappings.go index 7311aca..665bc96 100644 --- a/lib/btrfsprogs/btrfsinspect/rebuildmappings/rebuildmappings.go +++ b/lib/btrfsprogs/btrfsinspect/rebuildmappings/rebuildmappings.go @@ -1,4 +1,4 @@ -// Copyright (C) 2022 Luke Shumaker <lukeshu@lukeshu.com> +// Copyright (C) 2022-2023 Luke Shumaker <lukeshu@lukeshu.com> // // SPDX-License-Identifier: GPL-2.0-or-later @@ -15,6 +15,7 @@ import ( "git.lukeshu.com/btrfs-progs-ng/lib/btrfsprogs/btrfsinspect" "git.lukeshu.com/btrfs-progs-ng/lib/containers" "git.lukeshu.com/btrfs-progs-ng/lib/maps" + "git.lukeshu.com/btrfs-progs-ng/lib/textui" ) func getNodeSize(fs *btrfs.FS) (btrfsvol.AddrDelta, error) { @@ -189,20 +190,20 @@ func RebuildMappings(ctx context.Context, fs *btrfs.FS, scanResults btrfsinspect unmappedPhysical += region.End.Sub(region.Beg) } } - dlog.Infof(ctx, "... %d KiB of unmapped physical space (across %d regions)", int(unmappedPhysical/1024), numUnmappedPhysical) + dlog.Infof(ctx, "... %d of unmapped physical space (across %d regions)", textui.IEC(unmappedPhysical, "B"), numUnmappedPhysical) unmappedLogicalRegions := ListUnmappedLogicalRegions(fs, logicalSums) var unmappedLogical btrfsvol.AddrDelta for _, region := range unmappedLogicalRegions { unmappedLogical += region.Size() } - dlog.Infof(ctx, "... %d KiB of unmapped summed logical space (across %d regions)", int(unmappedLogical/1024), len(unmappedLogicalRegions)) + dlog.Infof(ctx, "... %d of unmapped summed logical space (across %d regions)", textui.IEC(unmappedLogical, "B"), len(unmappedLogicalRegions)) var unmappedBlockGroups btrfsvol.AddrDelta for _, bg := range bgs { unmappedBlockGroups += bg.Size } - dlog.Infof(ctx, "... %d KiB of unmapped block groups (across %d groups)", int(unmappedBlockGroups/1024), len(bgs)) + dlog.Infof(ctx, "... %d of unmapped block groups (across %d groups)", textui.IEC(unmappedBlockGroups, "B"), len(bgs)) dlog.Info(_ctx, "detailed report:") for _, devID := range maps.SortedKeys(unmappedPhysicalRegions) { diff --git a/lib/btrfsprogs/btrfsutil/open.go b/lib/btrfsprogs/btrfsutil/open.go index 441d4e2..c5ee314 100644 --- a/lib/btrfsprogs/btrfsutil/open.go +++ b/lib/btrfsprogs/btrfsutil/open.go @@ -1,4 +1,4 @@ -// Copyright (C) 2022 Luke Shumaker <lukeshu@lukeshu.com> +// Copyright (C) 2022-2023 Luke Shumaker <lukeshu@lukeshu.com> // // SPDX-License-Identifier: GPL-2.0-or-later @@ -31,8 +31,9 @@ func Open(ctx context.Context, flag int, filenames ...string) (*btrfs.FS, error) } bufFile := diskio.NewBufferedFile[btrfsvol.PhysicalAddr]( typedFile, - textui.Tunable[btrfsvol.PhysicalAddr](16384), // block size: 16KiB - textui.Tunable(1024), // number of blocks to buffer; total of 16MiB + //nolint:gomnd // False positive: gomnd.ignored-functions=[textui.Tunable] doesn't support type params. + textui.Tunable[btrfsvol.PhysicalAddr](16*1024), // block size: 16KiB + textui.Tunable(1024), // number of blocks to buffer; total of 16MiB ) devFile := &btrfs.Device{ File: bufFile, |