Skip to content

Commit f38e9c7

Browse files
committed
struct_ops: remove an unecessary struct field
Signed-off-by: shun159 <[email protected]>
1 parent 001149b commit f38e9c7

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

collection.go

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -418,8 +418,6 @@ type collectionLoader struct {
418418
programs map[string]*Program
419419
vars map[string]*Variable
420420
types *btf.Cache
421-
// structOps program name -> structOpsMap name
422-
stOpsProgsToMap map[string]string
423421
}
424422

425423
func newCollectionLoader(coll *CollectionSpec, opts *CollectionOptions) (*collectionLoader, error) {
@@ -445,7 +443,6 @@ func newCollectionLoader(coll *CollectionSpec, opts *CollectionOptions) (*collec
445443
make(map[string]*Program),
446444
make(map[string]*Variable),
447445
newBTFCache(&opts.Programs),
448-
make(map[string]string),
449446
}, nil
450447
}
451448

@@ -866,13 +863,13 @@ func (cl *collectionLoader) initKernStructOps() error {
866863
return fmt.Errorf("struct type: %s %w", kTypeName, err)
867864
}
868865

869-
cl.setStructOpsProgAttachTo(kType, ms.Name)
866+
cl.setStructOpsProgAttachTo(kType)
870867
}
871868

872869
return nil
873870
}
874871

875-
func (cl *collectionLoader) setStructOpsProgAttachTo(kernType *btf.Struct, mapName string) {
872+
func (cl *collectionLoader) setStructOpsProgAttachTo(kernType *btf.Struct) {
876873
for _, m := range kernType.Members {
877874
if _, ok := btf.As[*btf.Pointer](btf.UnderlyingType(m.Type)); !ok {
878875
continue
@@ -884,7 +881,6 @@ func (cl *collectionLoader) setStructOpsProgAttachTo(kernType *btf.Struct, mapNa
884881
continue
885882
}
886883

887-
cl.stOpsProgsToMap[ps.Name] = mapName
888884
if ps.AttachTo == "" {
889885
ps.AttachTo = fmt.Sprintf("%s:%s", kernType.Name, member)
890886
}

0 commit comments

Comments
 (0)