Skip to content

Commit 9822173

Browse files
committed
cap: rename FromUint64 to FromBitmap
Signed-off-by: Akihiro Suda <[email protected]>
1 parent af4c55f commit 9822173

2 files changed

Lines changed: 6 additions & 6 deletions

File tree

pkg/cap/cap_linux.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,11 @@ import (
2828
"github.com/syndtr/gocapability/capability"
2929
)
3030

31-
// FromUint64 parses an integer into string slice like
31+
// FromBitmap parses an uint64 bitmap into string slice like
3232
// []{"CAP_SYS_ADMIN", ...}.
3333
//
3434
// Unknown cap numbers are returned as []int.
35-
func FromUint64(v uint64) ([]string, []int) {
35+
func FromBitmap(v uint64) ([]string, []int) {
3636
var (
3737
res []string
3838
unknown []int
@@ -57,7 +57,7 @@ func FromUint64(v uint64) ([]string, []int) {
5757
return res, unknown
5858
}
5959

60-
// ParseProcPIDStatus returns uint64 value from /proc/<PID>/status file
60+
// ParseProcPIDStatus returns uint64 bitmap value from /proc/<PID>/status file
6161
func ParseProcPIDStatus(r io.Reader) (map[capability.CapType]uint64, error) {
6262
res := make(map[capability.CapType]uint64)
6363
scanner := bufio.NewScanner(r)
@@ -113,7 +113,7 @@ func Current() ([]string, error) {
113113
return nil, err
114114
}
115115
capEff := caps[capability.EFFECTIVE]
116-
names, _ := FromUint64(capEff)
116+
names, _ := FromBitmap(capEff)
117117
return names, nil
118118
}
119119

pkg/cap/cap_linux_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ func TestCapsList(t *testing.T) {
3030
assert.Len(t, caps59, 41)
3131
}
3232

33-
func TestFromUint64(t *testing.T) {
33+
func TestFromBitmap(t *testing.T) {
3434
type testCase struct {
3535
comment string
3636
v uint64
@@ -72,7 +72,7 @@ func TestFromUint64(t *testing.T) {
7272
}
7373

7474
for _, tc := range testCases {
75-
knownNames, unknown := FromUint64(tc.v)
75+
knownNames, unknown := FromBitmap(tc.v)
7676
t.Logf("[%s] v=0x%x, got=%+v (%d entries), unknown=%v",
7777
tc.comment, tc.v, knownNames, len(knownNames), unknown)
7878
assert.Equal(t, tc.knownNames, knownNames)

0 commit comments

Comments
 (0)