On 5/21/09, Orgad Shaneh <orgads@xxxxxxxxx> wrote: > On Thu, May 21, 2009 at 2:30 PM, Alan Jenkins > <sourcejedi.lkml@xxxxxxxxxxxxxx> wrote: >> >> On 5/20/09, Orgad Shaneh <orgads@xxxxxxxxx> wrote: >> > 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. >> >> 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? > On 5/21/09, Orgad Shaneh <orgads@xxxxxxxxx> wrote: > On Thu, May 21, 2009 at 2:30 PM, Alan Jenkins > <sourcejedi.lkml@xxxxxxxxxxxxxx> wrote: >> >> On 5/20/09, Orgad Shaneh <orgads@xxxxxxxxx> wrote: >> > 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. >> >> 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 -- To unsubscribe from this list: send the line "unsubscribe linux-hotplug" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html