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

Method new

devices/src/tpm.rs:231–243  ·  view source on GitHub ↗
(path: impl AsRef<Path>)

Source from the content-addressed store, hash-verified

229
230impl Tpm {
231 pub fn new(path: impl AsRef<Path>) -> Result<Self> {
232 let emulator = Emulator::new(path)
233 .map_err(|e| Error::Init(anyhow!("Failed while initializing tpm Emulator: {e:?}")))?;
234 let mut tpm = Tpm {
235 emulator,
236 regs: [0; TPM_CRB_R_MAX],
237 backend_buff_size: TPM_CRB_BUFFER_MAX,
238 data_buff: [0; TPM_CRB_BUFFER_MAX],
239 data_buff_len: 0,
240 };
241 tpm.reset()?;
242 Ok(tpm)
243 }
244
245 fn get_active_locality(&mut self) -> u32 {
246 if get_reg_field(

Callers

nothing calls this directly

Calls 2

newFunction · 0.85
resetMethod · 0.45

Tested by

no test coverage detected