[PATCH][2.5.70] experiment: export more info about IDE devices via

Andy Pfiffer (andyp@osdl.org)
02 Jun 2003 15:45:36 -0700


This is a MIME-formatted message. If you see this text it means that your
E-mail software does not support MIME-formatted messages.

--=_courier-11813-1054594105-0001-2
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 7bit

Go from this:

% grep -H "" /sysfs/bus/ide/devices/*/name
/sysfs/bus/ide/devices/0.0/name:IDE Drive
/sysfs/bus/ide/devices/0.1/name:IDE Drive
/sysfs/bus/ide/devices/1.0/name:IDE Drive
%

To this:
% grep -H "" /sysfs/bus/ide/devices/*/name
/sysfs/bus/ide/devices/0.0/name:disk IC35L040AVER07-0
/sysfs/bus/ide/devices/0.1/name:disk IC35L020AVER07-0
/sysfs/bus/ide/devices/1.0/name:removable cdrom LTN486S
%

--=_courier-11813-1054594105-0001-2
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 7bit
Content-Description:
Content-Disposition: inline; filename=ide-names-sysfs-2.5.70.patch

# This is a BitKeeper generated patch for the following project:
# Project Name: Linux kernel tree
# This patch format is intended for GNU patch command version 2.5 or higher.
# This patch includes the following deltas:
# ChangeSet 1.1427 -> 1.1428
# drivers/ide/ide-probe.c 1.49 -> 1.50
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 03/06/02 andyp@andyp.pdx.osdl.net 1.1428
# Cosmetic face-lift for the contents of the name file for IDE devices in sysfs.
# Rather than a boring and inspecific "IDE Drive", you can now see things like
# "removable cdrom LTN486S" or "disk IC35L020AVER07-0".
# --------------------------------------------
#
diff -Nru a/drivers/ide/ide-probe.c b/drivers/ide/ide-probe.c
--- a/drivers/ide/ide-probe.c Mon Jun 2 15:32:04 2003
+++ b/drivers/ide/ide-probe.c Mon Jun 2 15:32:04 2003
@@ -1292,11 +1292,38 @@

for (unit = 0; unit < MAX_DRIVES; ++unit) {
ide_drive_t * drive = &hwif->drives[unit];
+ struct hd_driveid * id = drive->id;
+ char * media_str;
+ char unknown_str[8];
+
ide_add_generic_settings(drive);
snprintf(drive->gendev.bus_id,BUS_ID_SIZE,"%u.%u",
hwif->index,unit);
- snprintf(drive->gendev.name,DEVICE_NAME_SIZE,
- "%s","IDE Drive");
+ switch (drive->media) {
+ case ide_scsi:
+ media_str = "scsi";
+ break;
+ case ide_disk:
+ media_str = "disk";
+ break;
+ case ide_optical:
+ media_str = "optical";
+ break;
+ case ide_cdrom:
+ media_str = "cdrom";
+ break;
+ case ide_tape:
+ media_str = "tape";
+ break;
+ default:
+ snprintf(unknown_str,8,"type%d",drive->media);
+ media_str = unknown_str;
+ break;
+ }
+ snprintf(drive->gendev.name,DEVICE_NAME_SIZE, "%s%s%s %s",
+ (drive->is_flash) ? "flash " : "",
+ (drive->removable) ? "removable " : "",
+ media_str, id->model);
drive->gendev.parent = &hwif->gendev;
drive->gendev.bus = &ide_bus_type;
drive->gendev.driver_data = drive;

--=_courier-11813-1054594105-0001-2--