MCPcopy Create free account
hub / github.com/cloud-hypervisor/cloud-hypervisor / update_ptm_with_response

Method update_ptm_with_response

tpm/src/lib.rs:95–106  ·  view source on GitHub ↗
(&mut self, buf: &[u8])

Source from the content-addressed store, hash-verified

93 }
94
95 fn update_ptm_with_response(&mut self, buf: &[u8]) -> Result<()> {
96 let expected_len = 4;
97 let len = buf.len();
98 if len != expected_len {
99 return Err(Error::ConvertToPtm(anyhow!(
100 "PtmRes buffer is of incorrect length. Got {len} expected {expected_len}."
101 )));
102 }
103
104 *self = u32::from_be_bytes(buf[..].try_into().unwrap());
105 Ok(())
106 }
107
108 fn set_member_type(&mut self, _mem: MemberType) {}
109

Callers 6

test_ptmresultFunction · 0.80
test_ptmcapFunction · 0.80
test_ptmestFunction · 0.80
test_ptminitFunction · 0.80
test_ptmsetbuffersizeFunction · 0.80
run_control_cmdMethod · 0.80

Calls 4

try_intoMethod · 0.80
set_result_codeMethod · 0.80
set_member_typeMethod · 0.80
lenMethod · 0.45

Tested by 5

test_ptmresultFunction · 0.64
test_ptmcapFunction · 0.64
test_ptmestFunction · 0.64
test_ptminitFunction · 0.64
test_ptmsetbuffersizeFunction · 0.64