Ticket #1472: hpsa-respect-hba-mode-1472.patch
File hpsa-respect-hba-mode-1472.patch, 1.9 KB (added by , 4 years ago) |
---|
-
ChangeLog
1 1 $Id$ 2 2 3 2021-04-09 Phillip Schichtel <phillip@schich.tel> 4 5 os_linux.cpp: Only require '-d cciss,N' if hpsa devices are in RAID mode 6 3 7 2021-04-09 Alex Samorukov <samm@os2.kiev.ua> 4 8 5 9 os_openbsd.cpp: fix SAT autodetection for the sd* devices (#1467) -
os_linux.cpp
3206 3206 return x * 100000 + y * 1000 + z; 3207 3207 } 3208 3208 3209 // Check for SCSI host proc_name "hpsa" 3210 static bool is_hpsa (const char * name)3209 // Check for SCSI host proc_name "hpsa" and HPSA raid_level 3210 static bool is_hpsa_in_raid_mode(const char * name) 3211 3211 { 3212 3212 char path[128]; 3213 3213 snprintf(path, sizeof(path), "/sys/block/%s/device", name); … … 3247 3247 if (strcmp(proc_name, "hpsa")) 3248 3248 return false; 3249 3249 3250 return true; 3250 // See: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/scsi/hpsa.c?id=6417f03132a6952cd17ddd8eaddbac92b61b17e0#n693 3251 snprintf(path, sizeof(path), "/sys/block/%s/device/raid_level", name); 3252 fd = open(path, O_RDONLY); 3253 if (fd < 0) 3254 return false; 3255 3256 char raid_level[4]; 3257 n = read(fd, raid_level, sizeof(raid_level) - 1); 3258 close(fd); 3259 if (n < 3) 3260 return false; 3261 raid_level[n] = 0; 3262 3263 if (strcmp(raid_level, "N/A")) 3264 return true; 3265 3266 return false; 3251 3267 } 3252 3268 3253 3269 // Guess device type (ata or scsi) based on device name (Linux … … 3302 3318 return get_scsi_passthrough_device(usbtype, new linux_scsi_device(this, name, "")); 3303 3319 } 3304 3320 3305 // Fail if hpsa driver 3306 if (is_hpsa (test_name))3321 // Fail if hpsa driver and device is using RAID 3322 if (is_hpsa_in_raid_mode(test_name)) 3307 3323 return missing_option("-d cciss,N"); 3308 3324 3309 3325 // No USB bridge or hpsa driver found, assume regular SCSI device