Skip to contentSkip to conversation

edd_id util

DISCUSSION Orgad Shaneh 2 participants 3 messages May 20, 2009 – May 22, 2009

lore
Share & tools
lore
#0 lore raw

Hello,

edd_id is a nice small util of udev to match device to its edd record (/sys/firmware/edd/int13_
dev8X).

Looking at its code, the way it matches devices is only by their mbr signature. Therefore, if the disk is wiped (or new), it won't be able to match anything, and will return 6 (no valid MBR signature).

I think in such case, another method for matching should be considered. the records in sysfs have a file named sectors, which is the device capacity in sectors. proc holds a similar file for kernel devices in /proc/ide/[hs]dX/capacity.

These files can be compared to match device to edd dev... If there is more than 1 device with the exact same capacity, it might print the first or not print anything, and exit with error.

I agree the best way to match is by signature, but if it is not found
- IMHO the alternative way should be taken.

#1 lore raw
Quoted 15 lines · Orgad Shaneh

Hello,

edd_id is a nice small util of udev to match device to its edd record (/sys/firmware/edd/int13_
dev8X).

Looking at its code, the way it matches devices is only by their mbr signature. Therefore, if the disk is wiped (or new), it won't be able to match anything, and will return 6 (no valid MBR signature).

I think in such case, another method for matching should be considered. the records in sysfs have a file named sectors, which is the device capacity in sectors. proc holds a similar file for kernel devices in /proc/ide/[hs]dX/capacity.

Quoted 6 lines

These files can be compared to match device to edd dev... If there is more than 1 device with the exact same capacity, it might print the first or not print anything, and exit with error.

I agree the best way to match is by signature, but if it is not found
- IMHO the alternative way should be taken.

On my machine there is also a pci_dev link. Could that be used?

#2 lore raw
In reply to Orgad Shaneh
Quoted 31 lines · Orgad Shaneh
Quoted 17 lines · Alan Jenkins
Quoted 15 lines · Orgad Shaneh

Hello,

edd_id is a nice small util of udev to match device to its edd record (/sys/firmware/edd/int13_
dev8X).

Looking at its code, the way it matches devices is only by their mbr signature. Therefore, if the disk is wiped (or new), it won't be able to match anything, and will return 6 (no valid MBR signature).

I think in such case, another method for matching should be considered. the records in sysfs have a file named sectors, which is the device capacity in sectors. proc holds a similar file for kernel devices in /proc/ide/[hs]dX/capacity.

Quoted 8 lines
Quoted 6 lines

These files can be compared to match device to edd dev... If there is more than 1 device with the exact same capacity, it might print the first or not print anything, and exit with error.

I agree the best way to match is by signature, but if it is not found
- IMHO the alternative way should be taken.

On my machine there is also a pci_dev link. Could that be used?

Can't find it here (debian testing, kernel 2.6.26-2-686)... Can it be matched with /dev?

Quoted 23 lines · Orgad Shaneh
Quoted 21 lines · Alan Jenkins
Quoted 19 lines · Orgad Shaneh

Hello,

edd_id is a nice small util of udev to match device to its edd record (/sys/firmware/edd/int13_
dev8X).

Looking at its code, the way it matches devices is only by their mbr signature. Therefore, if the disk is wiped (or new), it won't be able to match anything, and will return 6 (no valid MBR signature).

I think in such case, another method for matching should be considered. the records in sysfs have a file named sectors, which is the device capacity in sectors. proc holds a similar file for kernel devices in /proc/ide/[hs]dX/capacity.

These files can be compared to match device to edd dev... If there is more than 1 device with the exact same capacity, it might print the first or not print anything, and exit with error.

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

I agree the best way to match is by signature, but if it is not found
- IMHO the alternative way should be taken.

On my machine there is also a pci_dev link. Could that be used?

Can't find it here (debian testing, kernel 2.6.26-2-686)... Can it be matched with /dev?

Oops, not quite. I forgot you can have multiple disks attached to the same pci device. So pci_dev wouldn't be reliable even if the necessary information was provided by all bioses. It'd just be another heuristic.

I think you're right in principle. If the current method doesn't always work, it may not hurt to add more methods that will only work some of the time. I expect patches would be welcomed :-).

What do you rely on edd_id for? Is it used for GRUB and devices.map?

Alan