This is the mail archive of the
elfutils-devel@sourceware.org
mailing list for the elfutils project.
Don't let dwfl_linux_kernel_report_offline/find_elf go through build dir
- From: Mark Wielaard <mjw at redhat dot com>
- To: elfutils-devel at lists dot fedorahosted dot org
- Date: Sun, 20 Sep 2009 20:13:39 +0200
- Subject: Don't let dwfl_linux_kernel_report_offline/find_elf go through build dir
Hi,
dwfl_linux_kernel_report_offline has the following comment:
/* Skip a "source" subtree, which tends to be large.
This insane hard-coding of names is what depmod does too. */
But on my installs source is just a symlink to build, and the whole
source tree is under that build (symlink) and so is still traversed by
dwfl_linux_kernel_report_offline(). And indeed depmod (from
module-init-tools-3.7-pre9) does also skip the build subtree now. So
this patch does the same for dwfl_linux_kernel_report_offline() and
dwfl_linux_kernel_find_elf(), which saves several seconds on my
slow-disk/low-mem laptop (yes, it is that slow...)
OK to commit/push?
Mark
>From 8e17401c834e4b77a4ef267f599418d4970ecb13 Mon Sep 17 00:00:00 2001
From: Mark Wielaard <mjw@redhat.com>
Date: Sun, 20 Sep 2009 20:07:48 +0200
Subject: [PATCH] dwfl_linux_kernel_report_offline/find_elf skip subdirectory named "build".
---
libdwfl/ChangeLog | 6 ++++++
libdwfl/linux-kernel-modules.c | 16 ++++++++++------
2 files changed, 16 insertions(+), 6 deletions(-)
diff --git a/libdwfl/ChangeLog b/libdwfl/ChangeLog
index 5b876d3..90766d4 100644
--- a/libdwfl/ChangeLog
+++ b/libdwfl/ChangeLog
@@ -1,3 +1,9 @@
+2009-09-20 Mark Wielaard <mjw@redhat.com>
+
+ * linux-kernel-modules.c (dwfl_linux_kernel_report_offline):
+ Skip subdirectory named "build".
+ (dwfl_linux_kernel_find_elf): Likewise.
+
2009-09-04 Roland McGrath <roland@redhat.com>
* image-header.c (__libdw_image_header): Fix tranposed comparison.
diff --git a/libdwfl/linux-kernel-modules.c b/libdwfl/linux-kernel-modules.c
index e07073c..1fd48c2 100644
--- a/libdwfl/linux-kernel-modules.c
+++ b/libdwfl/linux-kernel-modules.c
@@ -319,10 +319,12 @@ dwfl_linux_kernel_report_offline (Dwfl *dwfl, const char *release,
FTSENT *f;
while ((f = fts_read (fts)) != NULL)
{
- /* Skip a "source" subtree, which tends to be large.
+ /* Skip "source" and "build" subtree, which tends to be large.
This insane hard-coding of names is what depmod does too. */
- if (f->fts_namelen == sizeof "source" - 1
- && !strcmp (f->fts_name, "source"))
+ if ((f->fts_namelen == sizeof "source" - 1
+ && !strcmp (f->fts_name, "source"))
+ || (f->fts_namelen == sizeof "build" - 1
+ && !strcmp (f->fts_name, "build")))
{
fts_set (fts, f, FTS_SKIP);
continue;
@@ -691,10 +693,12 @@ dwfl_linux_kernel_find_elf (Dwfl_Module *mod,
int error = ENOENT;
while ((f = fts_read (fts)) != NULL)
{
- /* Skip a "source" subtree, which tends to be large.
+ /* Skip "source" and "build" subtree, which tends to be large.
This insane hard-coding of names is what depmod does too. */
- if (f->fts_namelen == sizeof "source" - 1
- && !strcmp (f->fts_name, "source"))
+ if ((f->fts_namelen == sizeof "source" - 1
+ && !strcmp (f->fts_name, "source"))
+ || (f->fts_namelen == sizeof "build" - 1
+ && !strcmp (f->fts_name, "build")))
{
fts_set (fts, f, FTS_SKIP);
continue;
--
1.6.2.5