2019-08-09 01:39 UTC+0100 ~ Peter Wu <pe...@lekensteyn.nl> > /proc/config has never existed as far as I can see, but /proc/config.gz > is present on Arch Linux. Add support for decompressing config.gz using > zlib which is a mandatory dependency of libelf. Replace existing stdio > functions with gzFile operations since the latter transparently handles > uncompressed and gzip-compressed files. > > Cc: Quentin Monnet <quentin.mon...@netronome.com> > Signed-off-by: Peter Wu <pe...@lekensteyn.nl> > --- > v3: replace popen(gunzip) by linking directly to zlib. Reword commit > message, remove "Fixes" line. (this patch) > v2: fix style (reorder vars as reverse xmas tree, rename function, > braces), fallback to /proc/config.gz if uname() fails. > https://lkml.kernel.org/r/20190806010702.3303-1-pe...@lekensteyn.nl > v1: https://lkml.kernel.org/r/20190805001541.8096-1-pe...@lekensteyn.nl > > Hi, > > Thanks to Jakub for observing that zlib is already used by libelf, this > simplifies the patch tremendously as the same API can be used for both > compressed and uncompressed files. No special case exists anymore for > fclose/pclose. > > According to configure.ac in elfutils, zlib is mandatory, so I just > assume it to be available. For simplicity I also silently assume lines > to be less than 4096 characters. If that is not the case, then lines > will appear truncated, but that should not be an issue for the > CONFIG_xyz lines that we are scanning for. > > Jakub requested the handle leak fix to be posted separately against the > bpf tree, but since the whole code is rewritten I am not sure if it is > worth it. It is an unusual edge case: /boot/config-$(uname -r) could be > opened, but starts with unexpected data. > > Kind regards, > Peter
This version seems good to me, thanks! Reviewed-by: Quentin Monnet <quentin.mon...@netronome.com>