Thomas Schmitt
2021-Mar-30 20:57 UTC
[Libguestfs] Consider to replace isoinfo by own code rather than by xorriso
Hi, thank you for flying xorriso. :)) But as its author and looking at https://github.com/libguestfs/libguestfs/blob/master/daemon/isoinfo.ml i feel obliged to point out that using it as replacement for isoinfo will increase the consumption of RAM and CPU cycles substantially. xorriso command -indev loads the whole directory tree of the ISO filesystem with names and metadata. Depending on that tree this can be dozens of megabytes and lots of insertion operations in a not much optimized tree model. On the other hand it is quite uncomplicated to implement an own ISO 9660 PVD reader and to become independent of any external program for that purpose. The Primary Volume Descriptor begins at LBA 16 (= byte offset 32768). Its layout is described in ECMA-119 8.4 (note: BP = byte offset + 1) https://www.ecma-international.org/wp-content/uploads/ECMA-119_4th_edition_june_2019.pdf or in HTML at https://wiki.osdev.org/ISO_9660#The_Primary_Volume_Descriptor E.g. the info missing in xorriso's output of -pvd_info is at offsets: 80 - 87 iso_volume_space_size (unsigned 32 bit, little endian first, then again as big endian) 124 - 127 iso_volume_sequence_number (unsigned 16 bit, little endian first, then again as big endian) 128 - 131 iso_logical_block_size (unsigned 16 bit, little endian first, then again as big endian) (If you don't read 2048 here, then you are in unchartered territory.) The date format for e.g. iso_volume_creation_t at offset 813 - 829 is a decimal digit string YYYMMDDhhmmsshh with a trailing binary byte value for the time zone with 15 minutes granularity. ("hh" means hundredths of seconds.) See also https://wiki.osdev.org/ISO_9660#Numerical_formats https://wiki.osdev.org/ISO_9660#Date.2Ftime_format Have a nice day :) Thomas
Richard W.M. Jones
2021-Mar-30 21:22 UTC
[Libguestfs] Consider to replace isoinfo by own code rather than by xorriso
On Tue, Mar 30, 2021 at 10:57:07PM +0200, Thomas Schmitt wrote:> Hi, > > thank you for flying xorriso. :)) > > But as its author and looking at > > https://github.com/libguestfs/libguestfs/blob/master/daemon/isoinfo.ml > > i feel obliged to point out that using it as replacement for isoinfo > will increase the consumption of RAM and CPU cycles substantially. > > xorriso command -indev loads the whole directory tree of the ISO filesystem > with names and metadata. Depending on that tree this can be dozens of > megabytes and lots of insertion operations in a not much optimized tree > model."megabytes" may not be a problem - and in fact hasn't been in my testing. Could it grow unbounded?> On the other hand it is quite uncomplicated to implement an own ISO 9660 > PVD reader and to become independent of any external program for that > purpose. > > The Primary Volume Descriptor begins at LBA 16 (= byte offset 32768). > Its layout is described in ECMA-119 8.4 (note: BP = byte offset + 1) > https://www.ecma-international.org/wp-content/uploads/ECMA-119_4th_edition_june_2019.pdf > or in HTML at > https://wiki.osdev.org/ISO_9660#The_Primary_Volume_Descriptor > > E.g. the info missing in xorriso's output of -pvd_info is at offsets: > > 80 - 87 iso_volume_space_size > (unsigned 32 bit, little endian first, then again as big endian) > > 124 - 127 iso_volume_sequence_number > (unsigned 16 bit, little endian first, then again as big endian) > > 128 - 131 iso_logical_block_size > (unsigned 16 bit, little endian first, then again as big endian) > (If you don't read 2048 here, then you are in unchartered > territory.) > > The date format for e.g. iso_volume_creation_t at offset 813 - 829 > is a decimal digit string YYYMMDDhhmmsshh with a trailing binary byte > value for the time zone with 15 minutes granularity. ("hh" means > hundredths of seconds.) > See also > https://wiki.osdev.org/ISO_9660#Numerical_formats > https://wiki.osdev.org/ISO_9660#Date.2Ftime_formatOK, thanks. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com Fedora Windows cross-compiler. Compile Windows programs, test, and build Windows installers. Over 100 libraries supported. http://fedoraproject.org/wiki/MinGW