ata: Don't make device nodes for disks that claim to be empty

This commit is contained in:
K. Lange 2021-09-02 21:30:59 +09:00
parent 1d4fbc41b3
commit db9c2a6d3f

View File

@ -658,13 +658,15 @@ static int ata_device_detect(struct ata_device * dev) {
if ((cl == 0x00 && ch == 0x00) ||
(cl == 0x3C && ch == 0xC3)) {
/* Parallel ATA device, or emulated SATA */
off_t sectors = ata_max_offset(dev);
if (sectors == 0) return 0;
char devname[64];
snprintf((char *)&devname, 20, "/dev/hd%c", ata_drive_char);
fs_node_t * node = ata_device_create(dev);
vfs_mount(devname, node);
ata_device_init(dev);
node->length = ata_max_offset(dev);
node->length = sectors;
ata_drive_char++;
return 1;