[PATCH] Support gzip-compressed pci.ids

Daniel Drake dsd at gentoo.org
Thu Jun 21 05:53:46 PDT 2007


Danny Kukawka wrote:
>> This patch adds in a fallback to read a .gz version if the plaintext
>> version is not available. As zlib is used for decompression, hald now links
>> against libz.
> 
> Not sure if we really need this at all. See the discussion on the list.

I just saw the patch to use libpci to do this. I was previously under 
the impression that libpci didn't provide API in this area. I'll test 
the patch later today and provide feedback -- it's certainly a better 
approach.

> Have embedded user/systems a original pci.ids file? This make no sense, you 
> have a small and well known number of devices in such system, you need only a 
> very small and specific pci.ids file.

I didn't think of that. In that case, making zlib support optional would 
make sense.

>> -if test "x$with_libpci" != xno ; then
>> +if test "x$with_libpci" != xno -a test "x$ZLIB_AVAILABLE" != "xyes"; then
>> +   AC_ERROR([libpci support requires zlib])
>> +elif test "x$with_libpci" != xno ; then
>>    dnl check for libpci
>>    AC_CHECK_HEADERS([pci/pci.h],
>>                     [AC_CHECK_LIB([pci], [pci_init], [USE_LIBPCI="yes"],
> 
> Same as above. It should also compile without compressed pci.ids!

This problem already exists (due to your commit e172b224c8de) and is not 
introduced or fixed by my patch (-lz is used unconditionally in 
configure.in and in one of the makefiles). The above addition just gives 
you a nice error for the situation when you have libpci but not zlib 
installed :)

>> --- a/hald/ids.c
>> +++ b/hald/ids.c
>> @@ -45,6 +45,8 @@
>>  #include "ids.h"
>>
> 
> #ifdef HAVE_Z_LIB /* or whatever the define is*/
> 
>>  #ifdef USE_PCI_IDS
>> +#include <zlib.h>
>> +
> 
> endif /* HAVE_Z_LIB  */
> 
> same with pci_ids_load_gz () and related calls.
> 
>> +static dbus_bool_t
>> +pci_ids_load_gz (const char *path)
>> +{
>> +#define ZLIB_BUFFER_STEP 0x40000 /* 256kb */
> 
> If you want this for embedded users as you wrote, why such big steps? If there 
> are e.g. only 270kb needed you have to allocate additional 256kb ...

I was thinking that embedded users *wouldn't* be using PCI IDs at all 
(would they really care about pretty names?), so I wrote it without 
small footprint considerations in mind.

Thanks for the feedback.

Daniel



More information about the hal mailing list