mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Tom Rini <trini@kernel.crashing.org>
To: Kernel Mailing List <linux-kernel@vger.kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Subject: [PATCH,RFC 2.6.9-rc1 2/2] zlib_inflate: Add __BOOTER__ around zlib_inflate_trees_fixed(...)
Date: Thu, 2 Sep 2004 10:47:08 -0700	[thread overview]
Message-ID: <20040902174707.GC26144@smtp.west.cox.net> (raw)
In-Reply-To: <20040902173626.GB26144@smtp.west.cox.net>

On Thu, Sep 02, 2004 at 10:36:26AM -0700, Tom Rini wrote:

> On Wed, Sep 01, 2004 at 04:17:00PM -0700, Tom Rini wrote:
> 
> > The following patch switches arch/ppc/boot over from using its own
> > version of zlib to the code found under lib/zlib_inflate.  The plus side
> > to this, is one less version of zlib stuff around in the kernel.  The
> > downside is that the zlib code is ~8kB larger now, so I'm not sure if
> > this is a good idea.
> 
> So, to try and get around this growth in size, I decided to see how bad
> things would look, and how much it would take, to get the size back down
> to what it was.  After messing around, I've come up with two patches,
> which in the end shrink the overall size slightly.  The first, and I
> hope least objectionable is to move zlib_inflateSync, and related bits
> used by PPP into inflate_sync.c.  This saves us 169 bytes.

This is the second part of what I found.  zlib_inflate_trees_fixed(...)
isn't called in decompressing a kernel.  Dropping this, and the call to
it saves ~8kB.  __BOOTER__ is a flag already passed along during the
build of arch/ppc/boot/.  But, I'm going to guess doing it this way is
just too ugly.  zlib_inflate_trees_fixed(...) itself could be moved into
another file, but that leaves the problem of having to provide some sort
of stub function, and perhaps making zlib_inflate_trees_fixed return
Z_OK (real version) or Z_STREAM_ERROR (stub).

Or if anyone else has a better idea, I'd be glad to give that a shot.
Thanks.

Signed-off-by: Tom Rini <trini@kernel.crashing.org>

Index: linux-2.6/lib/zlib_inflate/infblock.c
===================================================================
--- linux-2.6.orig/lib/zlib_inflate/infblock.c
+++ linux-2.6/lib/zlib_inflate/infblock.c
@@ -134,6 +134,7 @@ int zlib_inflate_blocks(
           DUMPBITS(t)
           s->mode = LENS;               /* get length of stored block */
           break;
+#ifndef __BOOTER__
         case 1:                         /* fixed */
           {
             uInt bl, bd;
@@ -150,6 +151,7 @@ int zlib_inflate_blocks(
           DUMPBITS(3)
           s->mode = CODES;
           break;
+#endif
         case 2:                         /* dynamic */
           DUMPBITS(3)
           s->mode = TABLE;
Index: linux-2.6/lib/zlib_inflate/inftrees.c
===================================================================
--- linux-2.6.orig/lib/zlib_inflate/inftrees.c
+++ linux-2.6/lib/zlib_inflate/inftrees.c
@@ -374,6 +374,7 @@ int zlib_inflate_trees_dynamic(
 }
 
 
+#ifndef __BOOTER__
 /* build fixed tables only once--keep them here */
 #include "inffixed.h"
 
@@ -392,3 +393,4 @@ int zlib_inflate_trees_fixed(
   *td = fixed_td;
   return Z_OK;
 }
+#endif

-- 
Tom Rini
http://gate.crashing.org/~trini/

  reply	other threads:[~2004-09-02 17:47 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-09-01 23:17 [PATCH 2.6.9-rc1] ppc32: Switch arch/ppc/boot to zlib_inflate Tom Rini
2004-09-02 17:36 ` [PATCH,RFC 2.6.9-rc1 1/2] zlib_inflate: Move zlib_inflateSync & friends Tom Rini
2004-09-02 17:47   ` Tom Rini [this message]
2004-09-03  1:14     ` [PATCH,RFC 2.6.9-rc1 2/2] zlib_inflate: Add __BOOTER__ around zlib_inflate_trees_fixed(...) Paul Mackerras
2004-09-03  1:45       ` Tom Rini
2004-09-03 17:40         ` Tom Rini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20040902174707.GC26144@smtp.west.cox.net \
    --to=trini@kernel.crashing.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=paulus@samba.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®