Commit Graph

661 Commits (79101e748ac080a52c958b43b79547bc9e1dabc2)
 

Author SHA1 Message Date
Alessandro Decina 46e0a2ede4 aya: don't export VerifierLog 4 years ago
Alessandro Decina 7c6ae76975 aya: HashMap: add support for LRU maps 4 years ago
Alessandro Decina 04fde46855 aya: more docs 4 years ago
Alessandro Decina eea27f52f3 aya: tweak docs 4 years ago
Alessandro Decina 5aa9cb12ad aya: rename perf map and add docs
Rename the perf_map module to just perf, and rename PerfMap to
PerfEventArray.
4 years ago
Alessandro Decina d94bfde295 aya: maps: add docs and make the hash_map and program_array modules public 4 years ago
Alessandro Decina ce3f83acb1 aya: add HashMap docs 4 years ago
Alessandro Decina e28da8812e aya: make HashMap::new private 4 years ago
Alessandro Decina 24f7c37158 aya: add ProgramArray docs 4 years ago
Alessandro Decina 3fddc8165c aya: make ProgramArray::new private 4 years ago
Alessandro Decina 6682a5ff39 aya: remove pop()
lookup_and_delete_elem is only supported for QUEUE and STACK maps at the
moment.
4 years ago
Alessandro Decina 1bbbf616b6 aya: add some docs for the crate and `Bpf` 4 years ago
Alessandro Decina 563ce46118 aya: maps: group syscall errors into MapError::SyscallError 4 years ago
Alessandro Decina f9554d6db5 aya: fix bindings for PERF_EVENT_IOC_{ENABLE|DISABLE|SET_BPF} 4 years ago
Alessandro Decina a92bfebf50 aya: remove TryInto magic from program()/program_mut() too
For programs it's actually useful being able to get the underlying
Program enum, for example when iterating/loading all the programs
4 years ago
Alessandro Decina 42e0a659b2 aya: remove TryInto cleverness from map() and map_mut()
Require callers to call try_into() explicitly. It's more characters, but
it's easier to understand/document.

Also introduce MapError::NotFound instead of returning Result<Option<_>>.
4 years ago
Alessandro Decina d3482c063c aya: fix some badly completed match arms 4 years ago
Alessandro Decina ee05f9d949 aya: fix verifier log handling 4 years ago
Alessandro Decina 92b4ed2664 aya: add support for function calls 4 years ago
Alessandro Decina 8b0eee317d aya: section: collecting relocations can't fail anymore 4 years ago
Alessandro Decina 318c16cea3 aya: obj: rename symbol_table to symbols_by_index 4 years ago
Alessandro Decina 286e117fe0 aya: add Program::name() and make ::prog_type() public 4 years ago
Alessandro Decina 0199e4b297 aya: bpf: Add Bpf::programs() 4 years ago
Alessandro Decina dcb5121985 aya: bpf: remove lifetime param from previous signature 4 years ago
Alessandro Decina ed53f7470b aya: maps: add Map::name() and Map::map_type() 4 years ago
Alessandro Decina 0a493baed6 aya: add Bpf::maps() to get all the maps 4 years ago
Alessandro Decina 29f2d9b2d9 aya: switch to rustified enums 4 years ago
Alessandro Decina bdca32cebf aya-bpf-bindings: fix anonymous enums 4 years ago
Alessandro Decina f0444233b3 xtask: rework command line
xtask codegen --libbpf-dir <libbpf-dir> [SUBCOMMAND]

If SUBCOMMAND (eg aya or aya-bpf-bindings) is not given, codegen
everything.
4 years ago
Alessandro Decina 9d112c35c7 xtask: aya-bpf-bindings: generate bindings for aarch64 4 years ago
Alessandro Decina 713494609e aya-bpf-bindings: remove unused code 4 years ago
Alessandro Decina 59ed237343 aya: generate code with xtask 4 years ago
Alessandro Decina fb0c8f0bc9 xtask: add code generator for aya 4 years ago
Alessandro Decina 08d4b1aeda aya-gen: add bindgen builder for userspace code 4 years ago
Alessandro Decina d9c3489165 aya-gen: rename probe_read_getter to read_getter
The same code can be used to wrap with preserve_access_index()
4 years ago
Alessandro Decina 9cd04a79e7 xtask: use more aya-gen 4 years ago
Alessandro Decina 99447bcc0d aya-gen: add bindgen module and utils to write to file 4 years ago
Alessandro Decina 16975e87d8 xtask: rework code generator for bpf helpers 4 years ago
Alessandro Decina 7ae3ddf2fa xtask: use aya-gen to generate the getters 4 years ago
Alessandro Decina b66a73f6c7 Add aya-gen
aya-gen can be used to generate bindings for kernel types, eg:

	aya-gen btf-types ethhdr --probe-read-getters

Will generate:

	// ...

	#[repr(C)]
	#[derive(Debug, Copy, Clone)]
	pub struct ethhdr {
	    pub h_dest: [::aya_bpf_cty::c_uchar; 6usize],
	    pub h_source: [::aya_bpf_cty::c_uchar; 6usize],
	    pub h_proto: __be16,
	}

	impl ethhdr {
	    pub fn h_dest(&self) -> Option<[::aya_bpf_cty::c_uchar; 6usize]> {
		unsafe { ::aya_bpf::helpers::bpf_probe_read(&self.h_dest) }.ok()
	    }
	    pub fn h_source(&self) -> Option<[::aya_bpf_cty::c_uchar; 6usize]> {
		unsafe { ::aya_bpf::helpers::bpf_probe_read(&self.h_source) }.ok()
	    }
	    pub fn h_proto(&self) -> Option<__be16> {
		unsafe { ::aya_bpf::helpers::bpf_probe_read(&self.h_proto) }.ok()
	    }
	}
4 years ago
Alessandro Decina 7815711196 bpf: add aya-bpf-bindings
Move the generated bindings to aya-bpf-bindings.
4 years ago
Alessandro Decina b5cb1f479f xask: add bindings::write 4 years ago
Alessandro Decina ee205627b7 xtask: rename bindgen module to bindings 4 years ago
Alessandro Decina 1bb3846071 xtask: fix getters source order
Generate getters in the same order as the fields they access. Avoids git
noise and makes for better docs.
4 years ago
Alessandro Decina 25170a539b xtask: start moving bindgen to its own module 4 years ago
Alessandro Decina dc15c978f5 aya-bpf: generate bpf_probe_read getters for kernel types 4 years ago
Alessandro Decina cdf960aaa1 bpf: initial bpf bindings 4 years ago
Alessandro Decina 8327ffbb8d xdp: xdp BPF_LINK_CREATE was added in 5.9 4 years ago
Alessandro Decina 1e779c520a aya: obj: implement sane defaults for license and kernel version
Default to license=GPL and kernel_version=any
4 years ago
Alessandro Decina f11df77f85 aya: implement missing bit of retprobes 4 years ago