diff --git a/syscare-build/src/package/rpm/tags/attr.rs b/syscare-build/src/package/rpm/tags/attr.rs index ef226d77b29cbde804a34b32ee6e7e9a24b5cb1d..b836e0275aa0f1b100e55d71dbf1b2dc4f164e46 100644 --- a/syscare-build/src/package/rpm/tags/attr.rs +++ b/syscare-build/src/package/rpm/tags/attr.rs @@ -29,32 +29,8 @@ impl std::fmt::Display for RpmDefAttr { } } -#[derive(Debug, PartialEq, Eq, PartialOrd, Ord)] -pub struct RpmAttr { - pub mode: u32, - pub user: String, - pub group: String, -} - -impl std::fmt::Display for RpmAttr { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - f.write_fmt(format_args!( - "%attr({:o},{},{})", - self.mode, self.user, self.group - )) - } -} - #[test] fn test() { - let attr = RpmAttr { - mode: 0o755, - user: String::from("root"), - group: String::from("nobody"), - }; - println!("RpmAttr::new()\n{}\n", attr); - assert_eq!(attr.to_string(), "%attr(755,root,nobody)"); - let def_attr = RpmDefAttr { file_mode: 0o755, user: String::from("root"), diff --git a/syscare-common/src/ffi/os_str.rs b/syscare-common/src/ffi/os_str.rs index 0c414e1875f079ba05a496a34e8c67996764db47..1e61fe931372b14fab3ff8922ffedc3bfa420839 100644 --- a/syscare-common/src/ffi/os_str.rs +++ b/syscare-common/src/ffi/os_str.rs @@ -141,7 +141,7 @@ pub trait OsStrExt: AsRef { }) } - fn split_whitespace(&self) -> Filter, FilterFn> { + fn split_whitespace(&self) -> Filter, FilterFn> { self.split(SplitFn::from(char::is_whitespace)) .filter(|s| !s.is_empty()) } diff --git a/syscared/src/patch/driver/upatch/target.rs b/syscared/src/patch/driver/upatch/target.rs index be5aabcd11d938fa68e16290c5d0e6f96dcceedb..ff35d2fb7456c2075c75256093fa2a20c3162425 100644 --- a/syscared/src/patch/driver/upatch/target.rs +++ b/syscared/src/patch/driver/upatch/target.rs @@ -24,8 +24,8 @@ use crate::patch::entity::UserPatch; #[derive(Debug, Default)] pub struct PatchTarget { - process_map: HashMap>, // pid -> patch list - patch_map: IndexMap, // uuid -> patch file + process_map: HashMap>, // pid -> patch list + patch_map: IndexMap, // uuid -> patch file collision_map: HashMap>, // function old addr -> patch collision list } diff --git a/upatch-build/src/dwarf.rs b/upatch-build/src/dwarf.rs index fe0821c6b38b0c40ccc14771563279ee35e84481..a643556db3043707023bbaf2fdcfc1a675c41a1a 100644 --- a/upatch-build/src/dwarf.rs +++ b/upatch-build/src/dwarf.rs @@ -304,7 +304,7 @@ pub struct ProducerIterator { } impl> ProducerIterator { - fn current(&self) -> Result, DebuggingInformationEntry)>> { + fn current(&self) -> Result, DebuggingInformationEntry<'_, '_, R>)>> { if let Some((unit, offsets)) = &self.state { if let Some(offset) = offsets.last() { return Ok(Some((unit, unit.entry(*offset)?))); diff --git a/upatch-build/src/elf/read/elfs.rs b/upatch-build/src/elf/read/elfs.rs index 52c5e6b6168c81b82c52141a89adc53043b5bb35..e6c65bbda29247925a64b4417fd218aeab9624a2 100644 --- a/upatch-build/src/elf/read/elfs.rs +++ b/upatch-build/src/elf/read/elfs.rs @@ -41,11 +41,11 @@ impl Elf { Ok(Self { mmap, endian }) } - pub fn header(&self) -> Result
{ + pub fn header(&self) -> Result> { Ok(Header::from(&self.mmap, self.endian)) } - pub fn sections(&self) -> Result { + pub fn sections(&self) -> Result> { let header = self.header()?; let offset = header.get_e_shoff() as usize; let num = header.get_e_shnum() as usize; @@ -59,7 +59,7 @@ impl Elf { )) } - pub fn symbols(&self) -> Result { + pub fn symbols(&self) -> Result> { let sections = self.sections()?; for section in sections.clone() { if section.get_sh_type().eq(&SHT_SYMTAB) { diff --git a/upatch-build/src/elf/write/elfs.rs b/upatch-build/src/elf/write/elfs.rs index 9ce2847898bf4a221632a441fb252b887723ba25..c2ea121bd13a06cef41249793b5f183c2f595694 100644 --- a/upatch-build/src/elf/write/elfs.rs +++ b/upatch-build/src/elf/write/elfs.rs @@ -70,7 +70,7 @@ impl Elf { Ok(res) } - pub fn symbols(&mut self) -> Result { + pub fn symbols(&mut self) -> Result> { let sections = &self.sections()?; for section in sections { if section.get_sh_type().eq(&SHT_SYMTAB) { diff --git a/upatch-build/src/file_relation.rs b/upatch-build/src/file_relation.rs index 677cb8bce04616b76e6dd74f30d0eb745bd7a9e6..c7d941e4520cf6d71ed3497ca3aecbf2abb6216b 100644 --- a/upatch-build/src/file_relation.rs +++ b/upatch-build/src/file_relation.rs @@ -32,12 +32,6 @@ const UPATCH_ID_PREFIX: &str = ".upatch_"; const NON_EXIST_PATH: &str = "/dev/null"; -#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)] -pub struct ObjectRelation { - pub original_object: PathBuf, - pub patched_object: PathBuf, -} - /* * The task of this class is to find out: * 1. relationship between binary and debuginfo