tools/testing/selftests/bpf/veristat.c

Source file repositories/reference/linux-study-clean/tools/testing/selftests/bpf/veristat.c

File Facts

System
Linux kernel
Corpus path
tools/testing/selftests/bpf/veristat.c
Extension
.c
Size
84192 bytes
Lines
3375
Domain
Support Tooling And Documentation
Bucket
tools
Inferred role
Support Tooling And Documentation: implementation source
Status
source implementation candidate

Why This File Exists

Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.

Dependency Surface

Detected Declarations

Annotated Snippet

struct verif_stats {
	char *file_name;
	char *prog_name;

	long stats[NUM_STATS_CNT];
};

/* joined comparison mode stats */
struct verif_stats_join {
	char *file_name;
	char *prog_name;

	const struct verif_stats *stats_a;
	const struct verif_stats *stats_b;
};

struct stat_specs {
	int spec_cnt;
	enum stat_id ids[ALL_STATS_CNT];
	enum stat_variant variants[ALL_STATS_CNT];
	bool asc[ALL_STATS_CNT];
	bool abs[ALL_STATS_CNT];
	int lens[ALL_STATS_CNT * 3]; /* 3x for comparison mode */
};

enum resfmt {
	RESFMT_TABLE,
	RESFMT_TABLE_CALCLEN, /* fake format to pre-calculate table's column widths */
	RESFMT_CSV,
};

enum filter_kind {
	FILTER_NAME,
	FILTER_STAT,
};

enum operator_kind {
	OP_EQ,		/* == or = */
	OP_NEQ,		/* != or <> */
	OP_LT,		/* < */
	OP_LE,		/* <= */
	OP_GT,		/* > */
	OP_GE,		/* >= */
};

struct filter {
	enum filter_kind kind;
	/* FILTER_NAME */
	char *any_glob;
	char *file_glob;
	char *prog_glob;
	/* FILTER_STAT */
	enum operator_kind op;
	int stat_id;
	enum stat_variant stat_var;
	long value;
	bool abs;
};

struct rvalue {
	enum { INTEGRAL, ENUMERATOR } type;
	union {
		long long ivalue;
		char *svalue;
	};
};

struct field_access {
	enum { FIELD_NAME, ARRAY_INDEX } type;
	union {
		char *name;
		struct rvalue index;
	};
};

struct var_preset {
	struct field_access *atoms;
	int atom_count;
	char *full_name;
	struct rvalue value;
	bool applied;
};

enum dump_mode {
	DUMP_NONE = 0,
	DUMP_XLATED = 1,
	DUMP_JITED = 2,
};

static struct env {

Annotation

Implementation Notes