Filter devaliases and never open same device twice.

* grub-core/disk/ieee1275/ofdisk.c (last_devpath): New variable.
	(last_ihandle): Likewise.
	(ofdisk_hash_ent): New member shortest.
	(ofdisk_hash_add): Add canonical path too.
	(scan): New function.
	(grub_ofdisk_iterate): Iterate over hashed entries.
	(compute_dev_path): Don't add :0.
	(grub_ofdisk_open): Don't really open the disk.
	(grub_ofdisk_close): Avoid closing unrelated disk.
	(grub_ofdisk_read): Implement reopen logic.
	* grub-core/kern/ieee1275/openfw.c (grub_ieee1275_canonicalise_devname):
	New function.
	* include/grub/ieee1275/ieee1275.h (grub_ieee1275_canonicalise_devname):
	New proto.
This commit is contained in:
Vladimir 'phcoder' Serbinenko 2010-09-13 19:17:29 +02:00
parent fb53b340aa
commit b2a30ac5e4
4 changed files with 227 additions and 86 deletions

View file

@ -190,4 +190,6 @@ int EXPORT_FUNC(grub_ieee1275_devices_iterate) (int (*hook)
(struct grub_ieee1275_devalias *
alias));
char *EXPORT_FUNC(grub_ieee1275_canonicalise_devname) (const char *path);
#endif /* ! GRUB_IEEE1275_HEADER */