sync patches from upstream
This commit is contained in:
parent
04c603ab35
commit
4f1f06fb5b
@ -0,0 +1,129 @@
|
||||
From 98a7de479aa6da2d499b893fb1b5e5bfc598ab40 Mon Sep 17 00:00:00 2001
|
||||
From: chenjiayi <chenjiayi22@huawei.com>
|
||||
Date: Fri, 26 Jan 2024 15:27:03 +0800
|
||||
Subject: [PATCH] feature(devmaster): add net_driver builtin to be compatible
|
||||
with systemd-udev 255
|
||||
|
||||
The net_driver builtin is added to be compatible with systemd-udev 255.
|
||||
Otherwise devmaster would crash when encounterring net_driver builtin in udev rules.
|
||||
---
|
||||
exts/devmaster/src/lib/builtin/mod.rs | 12 ++++-
|
||||
exts/devmaster/src/lib/builtin/net_driver.rs | 56 ++++++++++++++++++++
|
||||
2 files changed, 66 insertions(+), 2 deletions(-)
|
||||
create mode 100644 exts/devmaster/src/lib/builtin/net_driver.rs
|
||||
|
||||
diff --git a/exts/devmaster/src/lib/builtin/mod.rs b/exts/devmaster/src/lib/builtin/mod.rs
|
||||
index 259ebd13..30ad9031 100644
|
||||
--- a/exts/devmaster/src/lib/builtin/mod.rs
|
||||
+++ b/exts/devmaster/src/lib/builtin/mod.rs
|
||||
@@ -34,6 +34,7 @@ pub mod hwdb;
|
||||
pub mod input_id;
|
||||
pub mod keyboard;
|
||||
pub mod kmod;
|
||||
+pub mod net_driver;
|
||||
pub mod net_id;
|
||||
pub mod net_setup_link;
|
||||
pub mod path_id;
|
||||
@@ -108,8 +109,9 @@ pub enum BuiltinCommand {
|
||||
PathId = 8,
|
||||
Uaccess = 9,
|
||||
UsbId = 10,
|
||||
- Example = 11,
|
||||
- Max = 12,
|
||||
+ NetDriver = 11,
|
||||
+ Example = 12,
|
||||
+ Max = 13,
|
||||
}
|
||||
|
||||
impl FromStr for BuiltinCommand {
|
||||
@@ -135,6 +137,7 @@ impl FromStr for BuiltinCommand {
|
||||
"path_id" => Ok(BuiltinCommand::PathId),
|
||||
"uaccess" => Ok(BuiltinCommand::Uaccess),
|
||||
"usb_id" => Ok(BuiltinCommand::UsbId),
|
||||
+ "net_driver" => Ok(BuiltinCommand::NetDriver),
|
||||
"example" => Ok(BuiltinCommand::Example),
|
||||
_ => Err(Error::BuiltinCommandError {
|
||||
msg: "invalid builtin command".to_string(),
|
||||
@@ -157,6 +160,7 @@ impl Display for BuiltinCommand {
|
||||
BuiltinCommand::PathId => "path_id",
|
||||
BuiltinCommand::Uaccess => "uaccess",
|
||||
BuiltinCommand::UsbId => "usb_id",
|
||||
+ BuiltinCommand::NetDriver => "net_driver",
|
||||
BuiltinCommand::Example => "example",
|
||||
_ => "invalid",
|
||||
};
|
||||
@@ -190,6 +194,10 @@ impl BuiltinManager {
|
||||
builtins.insert(BuiltinCommand::PathId, Box::new(path_id::PathId {}));
|
||||
builtins.insert(BuiltinCommand::Uaccess, Box::new(uaccess::Uaccess {}));
|
||||
builtins.insert(BuiltinCommand::UsbId, Box::new(usb_id::UsbId {}));
|
||||
+ builtins.insert(
|
||||
+ BuiltinCommand::NetDriver,
|
||||
+ Box::new(net_driver::NetDriver {}),
|
||||
+ );
|
||||
builtins.insert(BuiltinCommand::Example, Box::new(example::Example {}));
|
||||
|
||||
BuiltinManager { builtins }
|
||||
diff --git a/exts/devmaster/src/lib/builtin/net_driver.rs b/exts/devmaster/src/lib/builtin/net_driver.rs
|
||||
new file mode 100644
|
||||
index 00000000..83e6398e
|
||||
--- /dev/null
|
||||
+++ b/exts/devmaster/src/lib/builtin/net_driver.rs
|
||||
@@ -0,0 +1,56 @@
|
||||
+// Copyright (c) 2022 Huawei Technologies Co.,Ltd. All rights reserved.
|
||||
+//
|
||||
+// sysMaster is licensed under Mulan PSL v2.
|
||||
+// You can use this software according to the terms and conditions of the Mulan
|
||||
+// PSL v2.
|
||||
+// You may obtain a copy of Mulan PSL v2 at:
|
||||
+// http://license.coscl.org.cn/MulanPSL2
|
||||
+// THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY
|
||||
+// KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
|
||||
+// NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
+// See the Mulan PSL v2 for more details.
|
||||
+
|
||||
+//! net_driver builtin
|
||||
+//!
|
||||
+//! Todo: compatible with udev
|
||||
+
|
||||
+use crate::builtin::Builtin;
|
||||
+use crate::error::Result;
|
||||
+use crate::rules::exec_unit::ExecuteUnit;
|
||||
+
|
||||
+/// btrfs builtin command
|
||||
+pub struct NetDriver;
|
||||
+
|
||||
+impl Builtin for NetDriver {
|
||||
+ /// builtin command
|
||||
+ fn cmd(
|
||||
+ &self,
|
||||
+ _exec_unit: &ExecuteUnit,
|
||||
+ _argc: i32,
|
||||
+ _argv: Vec<String>,
|
||||
+ _test: bool,
|
||||
+ ) -> Result<bool> {
|
||||
+ Ok(true)
|
||||
+ }
|
||||
+
|
||||
+ /// builtin init function
|
||||
+ fn init(&self) {}
|
||||
+
|
||||
+ /// builtin exit function
|
||||
+ fn exit(&self) {}
|
||||
+
|
||||
+ /// check whether builtin command should reload
|
||||
+ fn should_reload(&self) -> bool {
|
||||
+ false
|
||||
+ }
|
||||
+
|
||||
+ /// the help of builtin command
|
||||
+ fn help(&self) -> String {
|
||||
+ "detect network interface driver".to_string()
|
||||
+ }
|
||||
+
|
||||
+ /// whether the builtin command can only run once
|
||||
+ fn run_once(&self) -> bool {
|
||||
+ false
|
||||
+ }
|
||||
+}
|
||||
--
|
||||
Gitee
|
||||
@ -12,13 +12,14 @@
|
||||
|
||||
Name: sysmaster
|
||||
Version: 1.0.0
|
||||
Release: 1
|
||||
Release: 2
|
||||
Summary: redesign and reimplement process1.
|
||||
|
||||
License: Mulan PSL v2
|
||||
URL: https://gitee.com/openeuler/sysmaster
|
||||
Source0: %{name}-%{version}.tar.xz
|
||||
|
||||
Patch0: backport-feature-devmaster-add-net_driver-builtin-to-be-compa.patch
|
||||
|
||||
ExclusiveArch: x86_64 aarch64
|
||||
|
||||
@ -160,6 +161,9 @@ if [ $1 -eq 0 ] ; then
|
||||
fi
|
||||
|
||||
%changelog
|
||||
* Tue Apr 9 2024 chenjiayi<chenjiayi22@huawei.com> - 1.0.0-2
|
||||
- sync patches from upstream
|
||||
|
||||
* Thu Feb 22 2024 zhangyao<zhangyao108@huawei.com> - 1.0.0-1
|
||||
- update version to 1.0.0
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user