tools/bpf/bpftool/token.c

Source file repositories/reference/linux-study-clean/tools/bpf/bpftool/token.c

File Facts

System
Linux kernel
Corpus path
tools/bpf/bpftool/token.c
Extension
.c
Size
3970 bytes
Lines
211
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

if (strncmp(ent->mnt_type, "bpf", 3) == 0) {
			if (has_delegate_options(ent->mnt_opts))
				__show_token_info(ent);
		}
	}

	if (json_output)
		jsonw_end_array(json_wtr);

	endmntent(fp);

	return 0;
}

static int do_show(int argc, char **argv)
{
	if (argc)
		return BAD_ARG();

	return show_token_info();
}

static int do_help(int argc, char **argv)
{
	if (json_output) {
		jsonw_null(json_wtr);
		return 0;
	}

	fprintf(stderr,
		"Usage: %1$s %2$s { show | list }\n"
		"       %1$s %2$s help\n"
		"       " HELP_SPEC_OPTIONS " }\n"
		"\n"
		"",
		bin_name, argv[-2]);
	return 0;
}

static const struct cmd cmds[] = {
	{ "show",	do_show },
	{ "list",	do_show },
	{ "help",	do_help },
	{ 0 }
};

int do_token(int argc, char **argv)
{
	return cmd_select(cmds, argc, argv, do_help);
}

Annotation

Implementation Notes