Projects
Mega:24.03
systemd
_service:tar_scm:add-a-new-switch-to-control-wh...
Sign Up
Log In
Username
Password
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File _service:tar_scm:add-a-new-switch-to-control-whether-udev-complies-wi.patch of Package systemd
From 18c373e2686a9156a701ad440507172ec8bb13a3 Mon Sep 17 00:00:00 2001 From: wangyuhang <wangyuhang27@huawei.com> Date: Fri, 7 Jul 2023 16:11:01 +0800 Subject: [PATCH] Add a new switch to control whether udev complies with the new SAT standards Reason: Original revisions of the SAT (SCSI-ATA Translation) specification, udev will identify devices starting with 70 and ending with 00 1d as ATA devices, rather than scsi devices, which may have a change in wwn id and affect user usage. So Add a new switch to control whether udev complies with the new SAT standards --- src/shared/udev-util.c | 17 ++++++++++++++++- src/shared/udev-util.h | 1 + src/udev/ata_id/ata_id.c | 18 ++++++++++++++++-- 3 files changed, 33 insertions(+), 3 deletions(-) diff --git a/src/shared/udev-util.c b/src/shared/udev-util.c index cf28ba8..18f03db 100644 --- a/src/shared/udev-util.c +++ b/src/shared/udev-util.c @@ -45,11 +45,17 @@ int udev_set_max_log_level(char *str) { } int udev_parse_config(void) { + return udev_parse_config_full(NULL); +} + +int udev_parse_config_full(bool *ret_ignore_newer_SAT) { _cleanup_free_ char *log_val = NULL; + _cleanup_free_ char *ignore_newer_SAT = NULL; int r; r = parse_env_file(NULL, "/etc/udev/udev.conf", - "udev_log", &log_val); + "udev_log", &log_val, + "ignore_newer_SAT", &ignore_newer_SAT); if (r == -ENOENT) return 0; if (r < 0) @@ -60,6 +66,15 @@ int udev_parse_config(void) { log_syntax(NULL, LOG_WARNING, "/etc/udev/udev.conf", 0, r, "Failed to set udev log level '%s', ignoring: %m", log_val); + if (ret_ignore_newer_SAT && ignore_newer_SAT) { + r = parse_boolean(ignore_newer_SAT); + if (r < 0) + log_syntax(NULL, LOG_WARNING, "/etc/udev/udev.conf", 0, r, + "failed to parse ignore_newer_SAT=%s, ignoring.", ignore_newer_SAT); + else + *ret_ignore_newer_SAT = r; + } + return 0; } diff --git a/src/shared/udev-util.h b/src/shared/udev-util.h index 651d335..ee1dbe5 100644 --- a/src/shared/udev-util.h +++ b/src/shared/udev-util.h @@ -8,6 +8,7 @@ int udev_set_max_log_level(char *str); int udev_parse_config(void); +int udev_parse_config_full(bool *ret_ignore_newer_SAT); int device_wait_for_initialization(sd_device *device, const char *subsystem, usec_t timeout_usec, sd_device **ret); int device_wait_for_devlink(const char *path, const char *subsystem, usec_t timeout_usec, sd_device **ret); diff --git a/src/udev/ata_id/ata_id.c b/src/udev/ata_id/ata_id.c index 0b1f0b7..92f87d9 100644 --- a/src/udev/ata_id/ata_id.c +++ b/src/udev/ata_id/ata_id.c @@ -31,9 +31,13 @@ #include "memory-util.h" #include "udev-util.h" #include "unaligned.h" +#include "proc-cmdline.h" +#include "string-util.h" #define COMMAND_TIMEOUT_MSEC (30 * 1000) +static bool arg_ignore_newer_SAT = false; + static bool arg_export = false; static const char *arg_device = NULL; @@ -159,7 +163,7 @@ static int disk_identify_command( return log_debug_errno(errno, "ioctl v3 failed: %m"); } else { if (!((sense[0] & 0x7f) == 0x72 && desc[0] == 0x9 && desc[1] == 0x0c) && - !((sense[0] & 0x7f) == 0x70 && sense[12] == 0x00 && sense[13] == 0x1d)) + (arg_ignore_newer_SAT || !((sense[0] & 0x7f) == 0x70 && sense[12] == 0x00 && sense[13] == 0x1d))) return log_debug_errno(SYNTHETIC_ERRNO(EIO), "ioctl v4 failed: %m"); } @@ -410,10 +414,20 @@ static int run(int argc, char *argv[]) { int r; log_set_target(LOG_TARGET_AUTO); - udev_parse_config(); + udev_parse_config_full(&arg_ignore_newer_SAT); log_parse_environment(); log_open(); + /* When either ignore_newer_SAT in udev.conf or udev.ignore_newer_SAT in the kernel command line is true, + * set arg_ignore_newer_SAT to true and ignoring the new SAT standard + */ + if (!arg_ignore_newer_SAT) { + r = proc_cmdline_get_bool("udev.ignore_newer_SAT", /* flags = */ 0, &arg_ignore_newer_SAT); + if (r < 0) { + log_warning_errno(r, "Failed to parse udev.ignore_newer_SAT kernel command line argument, ignoring: %m"); + } + } + r = parse_argv(argc, argv); if (r <= 0) return r; -- 2.33.0
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.
浙ICP备2022010568号-2