On Thu, Dec 20, 2018 at 08:46:47AM +0100, Fabiano Fidêncio wrote: > PPC ISOs do not have the "El Torito" extension that describes whether > the media is bootable or not. However, they have a "bootinfo.txt" file > placed under "ppc" directory in order to specify the media is bootable. > > So, let's add a few more checks looking for "/ppc/bootinfo.txt" in case > the El Torito header is not found. > > The whole implementation has been based on the following sources: > - The ISO 9660 (ECMA-119) specification: > http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-119.pdf > - The ISO 9660 osdev wiki page: > https://wiki.osdev.org/ISO_9660 > - IBM's developer article: > https://www.ibm.com/developerworks/linux/library/l-detecting-bootable-ibm-power-server-iso-images/index.html > > And what the implementation does is: > - Access the *root* directory record, which has a fixed size of 33 bytes > and is located at the bytes offset 156 of the PVD; > - Load the *root* directory record extent content into the memory and: > - Search for the the dir/file we're looking at; > - In the dir is present, we load its directory record extent content > into the memory and search for the next dir/file; > - In case the file is present, we return that the media is bootable; > - Otherwise, we return the media is non bootable; > > Mind, though, that this code is *not* generic enough to be adapted in > case we want to search for a different dir/file and the reason for that > is related to some ISOs using a TRANS.TBL table that translates the > given name of a file to the shown name of the same file. > > If, for some reason, we ever want to take the path of having this code > more generic we'd have to: > - For each directory acessed, search for TRANS.TBL; > - In case it's present, load its content into a hash table and, for > each dir/file, check the name of the file we're looking for with the > shown name (only present in the TRANS.TBL; > - Otherwise, just follow the very same code we currently have; > > The decision for not implementing this TRANS.TBL changes is, mainly, > because it'd make the code circa twice slower than it currently is > (as we'd have to search for the TRANS.TBL as the first thing ...) > without any specific gain for the needs we have right now. In case > there's the need, in the future, it could be implemented in the way > described here. > > https://gitlab.com/libosinfo/libosinfo/issues/8 > > Signed-off-by: Fabiano Fidêncio <fidencio@xxxxxxxxxx> > --- > osinfo/osinfo_media.c | 291 +++++++++++++++++++++++++++++++++++++++++- > osinfo/osinfo_media.h | 3 +- > 2 files changed, 287 insertions(+), 7 deletions(-) Reviewed-by: Daniel P. Berrangé <berrange@xxxxxxxxxx> Regards, Daniel -- |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :| _______________________________________________ Libosinfo mailing list Libosinfo@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libosinfo