syscare/0047-all-fix-compile-failure-of-rustc-1.80.patch

208 lines
6.9 KiB
Diff
Raw Normal View History

From 058670c8782b8b840fb99ddc174e00feb3b9ff89 Mon Sep 17 00:00:00 2001
From: renoseven <dev@renoseven.net>
Date: Fri, 16 Aug 2024 14:21:00 +0800
Subject: [PATCH] all: fix compile failure of rustc 1.80
Signed-off-by: renoseven <dev@renoseven.net>
---
syscare-build/src/build_root/package_root.rs | 6 ++----
syscare-build/src/build_root/patch_root.rs | 11 +++--------
syscared/src/patch/entity/kpatch.rs | 3 +--
syscared/src/patch/entity/upatch.rs | 3 +--
syscared/src/patch/resolver/kpatch.rs | 11 +++++++----
syscared/src/patch/resolver/upatch.rs | 7 +++----
6 files changed, 17 insertions(+), 24 deletions(-)
diff --git a/syscare-build/src/build_root/package_root.rs b/syscare-build/src/build_root/package_root.rs
index 75ff65d..eaac349 100644
--- a/syscare-build/src/build_root/package_root.rs
+++ b/syscare-build/src/build_root/package_root.rs
@@ -25,7 +25,6 @@ const BUILD_ROOT_DIR_NAME: &str = "patch";
#[derive(Debug, Clone)]
pub struct PackageRoot {
- pub path: PathBuf,
pub source: PathBuf,
pub debuginfo: PathBuf,
pub build_root: PackageBuildRoot,
@@ -33,17 +32,16 @@ pub struct PackageRoot {
impl PackageRoot {
pub fn new<P: AsRef<Path>>(directory: P) -> Result<Self> {
- let path = directory.as_ref().to_path_buf();
+ let path = directory.as_ref();
let source = path.join(SOURCE_DIR_NAME);
let debuginfo = path.join(DEBUGINFO_DIR_NAME);
let build_root = PackageBuildRoot::new(path.join(BUILD_ROOT_DIR_NAME))?;
- fs::create_dir_all(&path)?;
+ fs::create_dir_all(path)?;
fs::create_dir_all(&source)?;
fs::create_dir_all(&debuginfo)?;
Ok(Self {
- path,
source,
debuginfo,
build_root,
diff --git a/syscare-build/src/build_root/patch_root.rs b/syscare-build/src/build_root/patch_root.rs
index d493233..0aa0a1c 100644
--- a/syscare-build/src/build_root/patch_root.rs
+++ b/syscare-build/src/build_root/patch_root.rs
@@ -22,25 +22,20 @@ const OUTPUT_DIR_NAME: &str = "output";
#[derive(Debug, Clone)]
pub struct PatchRoot {
- pub path: PathBuf,
pub build: PathBuf,
pub output: PathBuf,
}
impl PatchRoot {
pub fn new<P: AsRef<Path>>(directory: P) -> Result<Self> {
- let path = directory.as_ref().to_path_buf();
+ let path = directory.as_ref();
let build = path.join(BUILD_DIR_NAME);
let output = path.join(OUTPUT_DIR_NAME);
- fs::create_dir_all(&path)?;
+ fs::create_dir_all(path)?;
fs::create_dir_all(&build)?;
fs::create_dir_all(&output)?;
- Ok(Self {
- path,
- build,
- output,
- })
+ Ok(Self { build, output })
}
}
diff --git a/syscared/src/patch/entity/kpatch.rs b/syscared/src/patch/entity/kpatch.rs
index ab2c8b2..a6b48c5 100644
--- a/syscared/src/patch/entity/kpatch.rs
+++ b/syscared/src/patch/entity/kpatch.rs
@@ -14,7 +14,7 @@
use std::{ffi::OsString, path::PathBuf, sync::Arc};
-use syscare_abi::{PatchInfo, PatchType};
+use syscare_abi::PatchInfo;
use uuid::Uuid;
/// Kernel patch function definition
@@ -61,7 +61,6 @@ impl std::fmt::Display for KernelPatchFunction {
pub struct KernelPatch {
pub uuid: Uuid,
pub name: OsString,
- pub kind: PatchType,
pub info: Arc<PatchInfo>,
pub pkg_name: String,
pub module_name: OsString,
diff --git a/syscared/src/patch/entity/upatch.rs b/syscared/src/patch/entity/upatch.rs
index ef24866..0fbacb4 100644
--- a/syscared/src/patch/entity/upatch.rs
+++ b/syscared/src/patch/entity/upatch.rs
@@ -14,7 +14,7 @@
use std::{ffi::OsString, path::PathBuf, sync::Arc};
-use syscare_abi::{PatchInfo, PatchType};
+use syscare_abi::PatchInfo;
use uuid::Uuid;
/// User patch function definition
@@ -58,7 +58,6 @@ impl std::fmt::Display for UserPatchFunction {
pub struct UserPatch {
pub uuid: Uuid,
pub name: OsString,
- pub kind: PatchType,
pub info: Arc<PatchInfo>,
pub pkg_name: String,
pub functions: Vec<UserPatchFunction>,
diff --git a/syscared/src/patch/resolver/kpatch.rs b/syscared/src/patch/resolver/kpatch.rs
index 7946c42..85ec18e 100644
--- a/syscared/src/patch/resolver/kpatch.rs
+++ b/syscared/src/patch/resolver/kpatch.rs
@@ -21,7 +21,7 @@ use std::{
use anyhow::{anyhow, Context, Result};
use object::{NativeFile, Object, ObjectSection};
-use syscare_abi::{PatchEntity, PatchInfo, PatchType};
+use syscare_abi::{PatchEntity, PatchInfo};
use syscare_common::{
concat_os,
ffi::{CStrExt, OsStrExt},
@@ -71,7 +71,7 @@ mod ffi {
unsafe impl Pod for KpatchFunction {}
pub struct KpatchRelocation {
- pub addr: (u64, Relocation),
+ pub _addr: (u64, Relocation),
pub name: (u64, Relocation),
pub object: (u64, Relocation),
}
@@ -93,7 +93,11 @@ mod ffi {
if let (Some(addr), Some(name), Some(object)) =
(self.0.next(), self.0.next(), self.0.next())
{
- return Some(KpatchRelocation { addr, name, object });
+ return Some(KpatchRelocation {
+ _addr: addr,
+ name,
+ object,
+ });
}
None
}
@@ -205,7 +209,6 @@ impl PatchResolverImpl for KpatchResolverImpl {
"/",
&patch_entity.patch_target
),
- kind: PatchType::KernelPatch,
info: patch_info.clone(),
pkg_name: patch_info.target.full_name(),
module_name,
diff --git a/syscared/src/patch/resolver/upatch.rs b/syscared/src/patch/resolver/upatch.rs
index cb06c24..e8c2f2c 100644
--- a/syscared/src/patch/resolver/upatch.rs
+++ b/syscared/src/patch/resolver/upatch.rs
@@ -21,7 +21,7 @@ use std::{
use anyhow::{anyhow, Context, Result};
use object::{NativeFile, Object, ObjectSection};
-use syscare_abi::{PatchEntity, PatchInfo, PatchType};
+use syscare_abi::{PatchEntity, PatchInfo};
use syscare_common::{concat_os, ffi::CStrExt, fs};
use super::PatchResolverImpl;
@@ -59,7 +59,7 @@ mod ffi {
pub const UPATCH_FUNCTION_OFFSET: usize = 40;
pub struct UpatchRelocation {
- pub addr: (u64, Relocation),
+ pub _addr: (u64, Relocation),
pub name: (u64, Relocation),
}
@@ -78,7 +78,7 @@ mod ffi {
fn next(&mut self) -> Option<Self::Item> {
if let (Some(addr), Some(name)) = (self.0.next(), self.0.next()) {
- return Some(UpatchRelocation { addr, name });
+ return Some(UpatchRelocation { _addr: addr, name });
}
None
}
@@ -168,7 +168,6 @@ impl PatchResolverImpl for UpatchResolverImpl {
"/",
fs::file_name(&patch_entity.patch_target)
),
- kind: PatchType::UserPatch,
info: patch_info.clone(),
pkg_name: patch_info.target.full_name(),
patch_file: patch_root.join(&patch_entity.patch_name),
--
2.34.1