68 lines
2.6 KiB
Diff
68 lines
2.6 KiB
Diff
From 8a86e15f07dd7030bfc31fb4944c24fb9a481fc5 Mon Sep 17 00:00:00 2001
|
|
From: wangyuhang <524413304@qq.com>
|
|
Date: Tue, 16 Jan 2024 13:57:07 +0800
|
|
Subject: [PATCH] udev: even if a device is a zac device, scsi-$ID_SERIAL will
|
|
be reserved for it (#30459)
|
|
|
|
Conflict:code context adaptation and do not merge the changes to 60-persistent-storage.rules
|
|
Reference:https://github.com/systemd/systemd/commit/8a86e15f07dd7030bfc31fb4944c24fb9a481fc5
|
|
---
|
|
src/udev/ata_id/ata_id.c | 13 +++++++++++--
|
|
1 file changed, 11 insertions(+), 2 deletions(-)
|
|
|
|
diff --git a/src/udev/ata_id/ata_id.c b/src/udev/ata_id/ata_id.c
|
|
index 1fc27f4..49357e3 100644
|
|
--- a/src/udev/ata_id/ata_id.c
|
|
+++ b/src/udev/ata_id/ata_id.c
|
|
@@ -310,7 +310,8 @@ static void disk_identify_fixup_uint16 (uint8_t identify[512], unsigned offset_w
|
|
*/
|
|
static int disk_identify(int fd,
|
|
uint8_t out_identify[512],
|
|
- int *out_is_packet_device) {
|
|
+ int *out_is_packet_device,
|
|
+ int *ret_peripheral_device_type) {
|
|
int ret;
|
|
uint8_t inquiry_buf[36];
|
|
int peripheral_device_type;
|
|
@@ -384,6 +385,10 @@ static int disk_identify(int fd,
|
|
out:
|
|
if (out_is_packet_device)
|
|
*out_is_packet_device = is_packet_device;
|
|
+
|
|
+ if (ret_peripheral_device_type)
|
|
+ *ret_peripheral_device_type = peripheral_device_type;
|
|
+
|
|
return ret;
|
|
}
|
|
|
|
@@ -407,6 +412,7 @@ int main(int argc, char *argv[]) {
|
|
{ "help", no_argument, NULL, 'h' },
|
|
{}
|
|
};
|
|
+ int peripheral_device_type = -1;
|
|
|
|
log_set_target(LOG_TARGET_AUTO);
|
|
udev_parse_config();
|
|
@@ -445,7 +451,7 @@ int main(int argc, char *argv[]) {
|
|
return 1;
|
|
}
|
|
|
|
- if (disk_identify(fd, identify.byte, &is_packet_device) == 0) {
|
|
+ if (disk_identify(fd, identify.byte, &is_packet_device, &peripheral_device_type) == 0) {
|
|
/*
|
|
* fix up only the fields from the IDENTIFY data that we are going to
|
|
* use and copy it into the hd_driveid struct for convenience
|
|
@@ -640,6 +646,9 @@ int main(int argc, char *argv[]) {
|
|
if (IN_SET(identify.wyde[0], 0x848a, 0x844a) ||
|
|
(identify.wyde[83] & 0xc004) == 0x4004)
|
|
printf("ID_ATA_CFA=1\n");
|
|
+
|
|
+ if (peripheral_device_type >= 0)
|
|
+ printf("ID_ATA_PERIPHERAL_DEVICE_TYPE=%d\n", peripheral_device_type);
|
|
} else {
|
|
if (serial[0] != '\0')
|
|
printf("%s_%s\n", model, serial);
|
|
--
|
|
2.33.0
|
|
|