[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: [PATCH] grub-installer: Handle disks with multi-letter names



 > > Why are you changing [a-z0-9} to [a-z]? 

I looked at drivers/ide/ide-probe.c in the Linux kernel and it has

	sprintf(disk->disk_name, "hd%c", 'a' + hwif->index * MAX_DRIVES	+ unit);

so under Linux there is no way to get anything other than hda...hdz.

 > I think, from distant memory, that that breaks the Hurd, which has
 > /dev/hd0 etc.

Very well could be.  Feel free to drop that change (or let me know and I
will respin the patch).

 > I don't see why we need /dev/[sv]d[a-z][a-z][a-z], either.
 > Documentation/devices.txt doesn't list SCSI devices that high, and I'd
 > be astonished if you ever found that many virtio devices either.

in drivers/block/virtio_blk.c the disk naming code is

	if (index < 26) {
		sprintf(vblk->disk->disk_name, "vd%c", 'a' + index % 26);
	} else if (index < (26 + 1) * 26) {
		sprintf(vblk->disk->disk_name, "vd%c%c",
			'a' + index / 26 - 1, 'a' + index % 26);
	} else {
		const unsigned int m1 = (index / 26 - 1) / 26 - 1;
		const unsigned int m2 = (index / 26 - 1) % 26;
		const unsigned int m3 =  index % 26;
		sprintf(vblk->disk->disk_name, "vd%c%c%c",
			'a' + m1, 'a' + m2, 'a' + m3);
	}

so at least conceivably, one could have /dev/vdabc.  The code for sd is
similar though more confusingly written, and I don't think > 26*26 SCSI
disks is actually that far-fetched for big systems.

Again though two letters is probably OK for now, so feel free to drop
the change or ask me for a new patch.

(And hmm... is that a bug in the test against (26 + 1) * 26?)

Thanks,
  Roland


Reply to: