aya: add id and pinning fields to bpf_map_def

pull/1/head
Alessandro Decina 4 years ago
parent ab8d512b60
commit 40b7da6655

@ -54,6 +54,8 @@ pub(crate) struct bpf_map_def {
pub(crate) value_size: u32, pub(crate) value_size: u32,
pub(crate) max_entries: u32, pub(crate) max_entries: u32,
pub(crate) map_flags: u32, pub(crate) map_flags: u32,
pub(crate) id: u32,
pub(crate) pinning: u32,
} }
/// The main entry point into the library, used to work with eBPF programs and maps. /// The main entry point into the library, used to work with eBPF programs and maps.

@ -163,6 +163,8 @@ mod tests {
value_size: 4, value_size: 4,
max_entries: 1024, max_entries: 1024,
map_flags: 0, map_flags: 0,
id: 0,
pinning: 0,
}, },
section_index: 0, section_index: 0,
data: Vec::new(), data: Vec::new(),
@ -214,6 +216,8 @@ mod tests {
value_size: 4, value_size: 4,
max_entries: 1024, max_entries: 1024,
map_flags: 0, map_flags: 0,
id: 0,
pinning: 0,
}, },
section_index: 0, section_index: 0,
data: Vec::new(), data: Vec::new(),
@ -270,6 +274,8 @@ mod tests {
value_size: 4, value_size: 4,
max_entries: 1024, max_entries: 1024,
map_flags: 0, map_flags: 0,
id: 0,
pinning: 0,
}, },
section_index: 0, section_index: 0,
data: Vec::new(), data: Vec::new(),

@ -415,6 +415,8 @@ mod tests {
value_size: 4, value_size: 4,
max_entries: 1024, max_entries: 1024,
map_flags: 0, map_flags: 0,
id: 0,
pinning: 0,
}, },
section_index: 0, section_index: 0,
data: Vec::new(), data: Vec::new(),

@ -464,6 +464,8 @@ fn parse_map(section: &Section, name: &str) -> Result<Map, ParseError> {
value_size: section.data.len() as u32, value_size: section.data.len() as u32,
max_entries: 1, max_entries: 1,
map_flags: 0, /* FIXME: set rodata readonly */ map_flags: 0, /* FIXME: set rodata readonly */
id: 0,
pinning: 0,
}; };
(def, section.data.to_vec()) (def, section.data.to_vec())
} else { } else {
@ -610,7 +612,9 @@ mod tests {
key_size: 2, key_size: 2,
value_size: 3, value_size: 3,
max_entries: 4, max_entries: 4,
map_flags: 5 map_flags: 5,
id: 0,
pinning: 0
}) })
), ),
Ok(bpf_map_def { Ok(bpf_map_def {
@ -618,7 +622,9 @@ mod tests {
key_size: 2, key_size: 2,
value_size: 3, value_size: 3,
max_entries: 4, max_entries: 4,
map_flags: 5 map_flags: 5,
id: 0,
pinning: 0
}) })
)); ));
} }
@ -642,7 +648,9 @@ mod tests {
key_size: 2, key_size: 2,
value_size: 3, value_size: 3,
max_entries: 4, max_entries: 4,
map_flags: 5 map_flags: 5,
id: 0,
pinning: 0
}) })
), ),
"foo" "foo"
@ -656,6 +664,8 @@ mod tests {
value_size: 3, value_size: 3,
max_entries: 4, max_entries: 4,
map_flags: 5, map_flags: 5,
id: 0,
pinning: 0
}, },
data data
}) if name == "foo" && data.is_empty() }) if name == "foo" && data.is_empty()
@ -682,6 +692,8 @@ mod tests {
value_size, value_size,
max_entries: 1, max_entries: 1,
map_flags: 0, map_flags: 0,
id: 0,
pinning: 0
}, },
data data
}) if name == ".bss" && data == map_data && value_size == map_data.len() as u32 }) if name == ".bss" && data == map_data && value_size == map_data.len() as u32
@ -743,7 +755,9 @@ mod tests {
key_size: 2, key_size: 2,
value_size: 3, value_size: 3,
max_entries: 4, max_entries: 4,
map_flags: 5 map_flags: 5,
id: 0,
pinning: 0
}) })
),), ),),
Ok(()) Ok(())

Loading…
Cancel
Save