All of lore.kernel.org
 help / color / mirror / Atom feed
From: "H. Peter Anvin" <hpa@zytor.com>
To: Alain Knaff <alain@knaff.lu>
Cc: linux-kernel@vger.kernel.org, torvalds@linux-foundation.org, w@1wt.eu
Subject: Re: [update3] [PATCH] init: bzip2 or lzma -compressed kernels and initrds
Date: Thu, 11 Sep 2008 15:43:53 -0700	[thread overview]
Message-ID: <48C99F29.2030007@zytor.com> (raw)
In-Reply-To: <200809090641.m896fscX028849@hitchhiker.org.lu>

Alain Knaff wrote:
> From: Alain Knaff <alain@knaff.lu>
> 
> This is an updated version of my bzip2/lzma patch
> 
> It is based on an idea by Christian Ludwig, includes support for
> compressing the kernel with bzip2 or lzma rather than gzip. Both
> compressors give smaller sizes than gzip.  Lzma's decompresses faster
> than bzip2.
> 
> It also supports ramdisks and initramfs' compressed using these two
> compressors.
> 
> The functionality has been successfully used for a couple of years by
> the udpcast project
> 
> This version applies to "tip" kernel 2.6.27-rc5
> 
> Changes since last version (update2):
> 
> - Removed NEW_CODE #ifdef : non-Intel architectures will be patched
>   eventually anyways
> - Replaced IN_MEMORY #ifdefs by (less efficient) runtime checks
> 
> Signed-off-by: Alain Knaff <alain@knaff.lu>

Looks a lot better now.  See the following, though:

> -#define OF(args)	args
>  #define STATIC		static
> +#define NEW_CODE

Should be deleted, right?

>  
> -	phdrs = malloc(sizeof(*phdrs) * ehdr.e_phnum);
> +	phdrs = (void *) malloc(sizeof(*phdrs) * ehdr.e_phnum);
>  	if (!phdrs)

malloc() returns a void pointer already...

> +
> +#ifdef CONFIG_RD_BZIP2
> +	/*
> +	 * If it matches the bzip magic numbers, return -1
> +	 */
> +	if (buf[0] == 0x42 && (buf[1] == 0x5a)) {
> +		printk(KERN_NOTICE
> +		       "RAMDISK: Bzipped image found at block %d\n",
> +		       start_block);
> +		*uncompressor = bunzip2;
>  		nblocks = 0;
>  		goto done;
>  	}
> +#endif
> +
> +#ifdef CONFIG_RD_LZMA
> +	/*
> +	 * If it matches the bzip magic numbers, return -1
                              ^^^^
                              ????
> +	 */
> +	if (buf[0] == 0x5d && (buf[1] == 0x00)) {
> +		printk(KERN_NOTICE
> +		       "RAMDISK: Lzma image found at block %d\n",
> +		       start_block);



> -#define OF(args)  args
> +#ifdef CONFIG_RD_BZIP2
> +#include <linux/decompress_bunzip2.h>
> +#endif
> +#ifdef CONFIG_RD_LZMA
> +#include <linux/decompress_unlzma.h>
>  #endif

There is no reason to include header files conditionally.

It might be worthwhile to create a proper subdirectory rather than using 
an underscored namespace (also, in general, dashes are preferred in 
filenames.)


> +#ifndef always_inline
> +#  if defined(__GNUC__) && (__GNUC__ > 3 || __GNUC__ == 3 && __GNUC_MINOR__ > 0)
> +#    define always_inline __attribute__((always_inline)) inline
> +#  else
> +#    define always_inline inline
> +#  endif
> +#endif

Any reason to not just use <linux/compiler.h> here?

> +#ifdef CONFIG_FEATURE_LZMA_FAST
> +#  define speed_inline always_inline
> +#else
> +#  define speed_inline
> +#endif

Should this be always_inline or just plain inline?

	-hpa

  reply	other threads:[~2008-09-11 22:44 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-09  6:41 [update3] [PATCH] init: bzip2 or lzma -compressed kernels and initrds Alain Knaff
2008-09-11 22:43 ` H. Peter Anvin [this message]
2008-09-11 23:16   ` Alain Knaff
2008-09-11 23:21     ` H. Peter Anvin
2008-09-22  6:16       ` [update5] " Alain Knaff
2008-09-22 16:08         ` H. Peter Anvin
2008-09-22 16:15           ` Alain Knaff
2008-09-23 19:07             ` H. Peter Anvin
2008-09-23 19:44               ` Alain Knaff
2008-09-23 20:07                 ` H. Peter Anvin
2008-09-23 21:07                 ` H. Peter Anvin
2008-09-23 21:25                   ` Alain Knaff
2008-09-23 21:30                     ` H. Peter Anvin
2008-09-23 21:49                       ` H. Peter Anvin
2008-09-23 22:00                       ` Alain Knaff
2008-09-23 22:19                         ` H. Peter Anvin
2008-09-23 22:23                           ` Alain Knaff
2008-10-09 17:44                             ` H. Peter Anvin
2008-10-10  3:11                               ` Alain Knaff
2008-10-10 21:31                                 ` H. Peter Anvin
2008-10-11  7:28                                   ` Alain Knaff
2008-10-11 14:10                                     ` H. Peter Anvin
2008-10-13  7:02                                     ` Alain Knaff
2008-09-23 21:37                     ` H. Peter Anvin
2008-09-24  3:52                     ` Willy Tarreau

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=48C99F29.2030007@zytor.com \
    --to=hpa@zytor.com \
    --cc=alain@knaff.lu \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@linux-foundation.org \
    --cc=w@1wt.eu \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.