From c0b9d8e0d415758a72743500c7d90af00e719730 Mon Sep 17 00:00:00 2001
From: renoseven <dev@renoseven.net>
Date: Mon, 21 Apr 2025 20:02:16 +0800
Subject: [PATCH] syscared: adapt common::fs changes
Signed-off-by: renoseven <dev@renoseven.net>
syscared/src/patch/resolver/kpatch.rs | 6 +++---
syscared/src/patch/resolver/upatch.rs | 6 +++---
2 files changed, 6 insertions(+), 6 deletions(-)
@@ -112,9 +112,9 @@ pub struct KpatchResolverImpl;
impl KpatchResolverImpl {
#[inline]
fn resolve_patch_file(patch: &mut KernelPatch) -> Result<()> {
- let patch_file =
- fs::MappedFile::open(&patch.patch_file).context("Failed to map patch file")?;
- let patch_elf = NativeFile::parse(patch_file.as_bytes()).context("Invalid patch format")?;
+ let patch_file = fs::mmap(&patch.patch_file)
+ .with_context(|| format!("Failed to mmap file {}", patch.patch_file.display()))?;
+ let patch_elf = NativeFile::parse(patch_file.as_ref()).context("Invalid patch format")?;
// Read sections
let function_section = patch_elf
@@ -93,9 +93,9 @@ pub struct UpatchResolverImpl;
impl UpatchResolverImpl {
#[inline]
fn resolve_patch_elf(patch: &mut UserPatch) -> Result<()> {
- let patch_file =
- fs::MappedFile::open(&patch.patch_file).context("Failed to map patch file")?;
- let patch_elf = NativeFile::parse(patch_file.as_bytes()).context("Invalid patch format")?;
+ let patch_file = fs::mmap(&patch.patch_file)
+ .with_context(|| format!("Failed to mmap file {}", patch.patch_file.display()))?;
+ let patch_elf = NativeFile::parse(patch_file.as_ref()).context("Invalid patch format")?;
// Read sections
let function_section = patch_elf
--
2.43.0