From 8677e557385003a45bf7a6d2d5c1c7a5faf39c6a Mon Sep 17 00:00:00 2001 From: root Date: Tue, 13 Jun 2023 17:39:16 +0800 Subject: [PATCH] fix the issue of incorrect device id in diskerrors. --- ras-diskerror-handler.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/ras-diskerror-handler.c b/ras-diskerror-handler.c index 38d0a36c..3150b325 100644 --- a/ras-diskerror-handler.c +++ b/ras-diskerror-handler.c @@ -31,6 +31,17 @@ #include "ras-report.h" +#define KERNEL_DEVICE_ID_BITS 20 +#define KERNEL_DEVICE_ID_MASK ((1U << KERNEL_DEVICE_ID_BITS) - 1) +static unsigned int major(dev_t devid) +{ + return (unsigned int)(devid >> KERNEL_DEVICE_ID_BITS); +} +static unsigned int minor(dev_t devid) +{ + return (unsigned int)(devid & KERNEL_DEVICE_ID_MASK); +} + static const struct { int error; const char *name;