// Code generated by bpf2go; DO NOT EDIT.
//go:build mips || mips64 || ppc64 || s390x

package main

import (
	"bytes"
	_ "embed"
	"fmt"
	"io"

	"github.com/cilium/ebpf"
)

// loadTracepoint returns the embedded CollectionSpec for tracepoint.
func loadTracepoint() (*ebpf.CollectionSpec, error) {
	reader := bytes.NewReader(_TracepointBytes)
	spec, err := ebpf.LoadCollectionSpecFromReader(reader)
	if err != nil {
		return nil, fmt.Errorf("can't load tracepoint: %w", err)
	}

	return spec, err
}

// loadTracepointObjects loads tracepoint and converts it into a struct.
//
// The following types are suitable as obj argument:
//
//	*tracepointObjects
//	*tracepointPrograms
//	*tracepointMaps
//
// See ebpf.CollectionSpec.LoadAndAssign documentation for details.
func loadTracepointObjects(obj interface{}, opts *ebpf.CollectionOptions) error {
	spec, err := loadTracepoint()
	if err != nil {
		return err
	}

	return spec.LoadAndAssign(obj, opts)
}

// tracepointSpecs contains maps and programs before they are loaded into the kernel.
//
// It can be passed ebpf.CollectionSpec.Assign.
type tracepointSpecs struct {
	tracepointProgramSpecs
	tracepointMapSpecs
	tracepointVariableSpecs
}

// tracepointProgramSpecs contains programs before they are loaded into the kernel.
//
// It can be passed ebpf.CollectionSpec.Assign.
type tracepointProgramSpecs struct {
	TraceOpenat *ebpf.ProgramSpec `ebpf:"trace_openat"`
}

// tracepointMapSpecs contains maps before they are loaded into the kernel.
//
// It can be passed ebpf.CollectionSpec.Assign.
type tracepointMapSpecs struct {
	Events          *ebpf.MapSpec `ebpf:"events"`
	IgnoreUidsMap   *ebpf.MapSpec `ebpf:"ignore_uids_map"`
	TargetHashesMap *ebpf.MapSpec `ebpf:"target_hashes_map"`
}

// tracepointVariableSpecs contains global variables before they are loaded into the kernel.
//
// It can be passed ebpf.CollectionSpec.Assign.
type tracepointVariableSpecs struct {
}

// tracepointObjects contains all objects after they have been loaded into the kernel.
//
// It can be passed to loadTracepointObjects or ebpf.CollectionSpec.LoadAndAssign.
type tracepointObjects struct {
	tracepointPrograms
	tracepointMaps
	tracepointVariables
}

func (o *tracepointObjects) Close() error {
	return _TracepointClose(
		&o.tracepointPrograms,
		&o.tracepointMaps,
	)
}

// tracepointMaps contains all maps after they have been loaded into the kernel.
//
// It can be passed to loadTracepointObjects or ebpf.CollectionSpec.LoadAndAssign.
type tracepointMaps struct {
	Events          *ebpf.Map `ebpf:"events"`
	IgnoreUidsMap   *ebpf.Map `ebpf:"ignore_uids_map"`
	TargetHashesMap *ebpf.Map `ebpf:"target_hashes_map"`
}

func (m *tracepointMaps) Close() error {
	return _TracepointClose(
		m.Events,
		m.IgnoreUidsMap,
		m.TargetHashesMap,
	)
}

// tracepointVariables contains all global variables after they have been loaded into the kernel.
//
// It can be passed to loadTracepointObjects or ebpf.CollectionSpec.LoadAndAssign.
type tracepointVariables struct {
}

// tracepointPrograms contains all programs after they have been loaded into the kernel.
//
// It can be passed to loadTracepointObjects or ebpf.CollectionSpec.LoadAndAssign.
type tracepointPrograms struct {
	TraceOpenat *ebpf.Program `ebpf:"trace_openat"`
}

func (p *tracepointPrograms) Close() error {
	return _TracepointClose(
		p.TraceOpenat,
	)
}

func _TracepointClose(closers ...io.Closer) error {
	for _, closer := range closers {
		if err := closer.Close(); err != nil {
			return err
		}
	}
	return nil
}

// Do not access this directly.
//
//go:embed tracepoint_bpfeb.o
var _TracepointBytes []byte
