2 Star 0 Fork 91

yangshicheng / systemd

forked from src-openEuler / systemd 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
backport-udev-store-action-in-struct-Event.patch 2.60 KB
一键复制 编辑 原始数据 按行查看 历史
From 0c3d8182c997c979c7a0ccce88d9fc48638261a5 Mon Sep 17 00:00:00 2001
From: Yu Watanabe <watanabe.yu+github@gmail.com>
Date: Fri, 25 Mar 2022 02:39:55 +0900
Subject: [PATCH] udev: store action in struct Event
Reference:https://github.com/systemd/systemd/commit/0c3d8182c997c979c7a0ccce88d9fc48638261a5
Conflict:NA
---
src/udev/udevd.c | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/src/udev/udevd.c b/src/udev/udevd.c
index 53728c9f7971..d153b03a38e1 100644
--- a/src/udev/udevd.c
+++ b/src/udev/udevd.c
@@ -125,6 +125,7 @@ typedef struct Event {
sd_device *dev;
+ sd_device_action_t action;
uint64_t seqnum;
uint64_t blocker_seqnum;
@@ -964,16 +965,12 @@ static int event_queue_start(Manager *manager) {
r = event_is_blocked(event);
if (r > 0)
continue;
- if (r < 0) {
- sd_device_action_t a = _SD_DEVICE_ACTION_INVALID;
-
- (void) sd_device_get_action(event->dev, &a);
+ if (r < 0)
log_device_warning_errno(event->dev, r,
"Failed to check dependencies for event (SEQNUM=%"PRIu64", ACTION=%s), "
"assuming there is no blocking event, ignoring: %m",
event->seqnum,
- strna(device_action_to_string(a)));
- }
+ strna(device_action_to_string(event->action)));
r = event_run(event);
if (r <= 0) /* 0 means there are no idle workers. Let's escape from the loop. */
@@ -984,6 +981,7 @@ static int event_queue_start(Manager *manager) {
}
static int event_queue_insert(Manager *manager, sd_device *dev) {
+ sd_device_action_t action;
uint64_t seqnum;
Event *event;
int r;
@@ -999,6 +997,10 @@ static int event_queue_insert(Manager *manager, sd_device *dev) {
if (r < 0)
return r;
+ r = sd_device_get_action(dev, &action);
+ if (r < 0)
+ return r;
+
event = new(Event, 1);
if (!event)
return -ENOMEM;
@@ -1007,6 +1009,7 @@ static int event_queue_insert(Manager *manager, sd_device *dev) {
.manager = manager,
.dev = sd_device_ref(dev),
.seqnum = seqnum,
+ .action = action,
.state = EVENT_QUEUED,
};
1
https://gitee.com/yangshicheng/systemd.git
git@gitee.com:yangshicheng/systemd.git
yangshicheng
systemd
systemd
master

搜索帮助