From a6a915dd12bd4b8debbb8c38e71db94db3cde0ff Mon Sep 17 00:00:00 2001 From: Motomu Utsumi Date: Tue, 20 May 2025 10:29:42 +0900 Subject: [PATCH] Skip loading unexisting bpf object while BPF loader migration This makes bpfloader.rs simpler while BPF loader migration. Bug: 410982483 Test: TH Change-Id: I32fbbaed3efed45b5297634dbcfc7c80132cabc8 --- loader/bpfloader.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/loader/bpfloader.rs b/loader/bpfloader.rs index 786f7ff..69ab5fb 100644 --- a/loader/bpfloader.rs +++ b/loader/bpfloader.rs @@ -317,7 +317,11 @@ fn kernel_version() -> Result { fn libbpf_worker(file_desc: &BpfFileDesc) -> Result<(), anyhow::Error> { info!("Loading {}", file_desc.filename); let filepath = Path::new(file_desc.dir).join(file_desc.filename); - ensure!(filepath.exists(), "File not found {}", filepath.display()); + // TODO: Make this error once the BPF loader migration completes. + if !filepath.exists() { + info!("Skipping load of {} as it does not exist", filepath.display()); + return Ok(()); + } let filename = filepath.file_stem().ok_or_else(|| anyhow!("Failed to parse stem from filename"))?; let filename = filename.to_str().ok_or_else(|| anyhow!("Failed to parse filename"))?;