From: Alain Knaff <alain@knaff.lu>
To: "H. Peter Anvin" <hpa@zytor.com>
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: Fri, 12 Sep 2008 01:16:16 +0200 [thread overview]
Message-ID: <48C9A6C0.4070802@knaff.lu> (raw)
In-Reply-To: <48C99F29.2030007@zytor.com>
H. Peter Anvin wrote:
> Looks a lot better now. See the following, though:
Thanks :)
>
>> -#define OF(args) args
>> #define STATIC static
>> +#define NEW_CODE
>
> Should be deleted, right?
Is already deleted in update4, posted yesterday.
>> - phdrs = malloc(sizeof(*phdrs) * ehdr.e_phnum);
>> + phdrs = (void *) malloc(sizeof(*phdrs) * ehdr.e_phnum);
>> if (!phdrs)
>
> malloc() returns a void pointer already...
ok, I'll consider this for update5
>> +
>> +#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);
noted, will be fixed in update5
>> -#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.)
I hate to contradict you, but in that case, lots of other filenames
would need fixing too:
> ls include/linux/*_*.h
include/linux/8250_pci.h include/linux/linux_logo.h
include/linux/ac97_codec.h include/linux/lm_interface.h
include/linux/acpi_pmtmr.h include/linux/memory_hotplug.h
include/linux/adfs_fs.h include/linux/minix_fs.h
include/linux/adfs_fs_i.h include/linux/mm_inline.h
include/linux/adfs_fs_sb.h include/linux/mm_types.h
include/linux/affs_hardblocks.h include/linux/mmu_notifier.h
include/linux/agp_backend.h include/linux/mnt_namespace.h
include/linux/aio_abi.h include/linux/mod_devicetable.h
include/linux/anon_inodes.h include/linux/msdos_fs.h
....
And dashes are not even in the majority:
> ls include/linux/*-*.h | wc
67 67 1867
> ls include/linux/*_*.h | wc
282 282 7598
Any other people want to chime in about this before I make update5? I'm
all for adopting common coding standards, but only if they are actually
common...
>> +#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?
As you may have understood, the decompressors themselves are samples
and/or reference implementations downloaded from elsewhere, and thus
might not be up to the coding standards of the rest of the kernel.
... but the same can be said of inflate.c (the existing gzip
decompressor), which would not pass muster either (and indeed, the only
scripts/checkpatch.pl WARNINGS of my patch are about funny indentation
of inflate.c that happen in the context of my changes...)
There's a fine line to walk here between "bringing up" these codes to
standard (at the risk of breaking them...) or touching the decompressing
engines as little as possible.
But, I've taken note for update5...
>> +#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
Same remark: this is 3rd party code which I preferred to touch as little
as possible...
Alain
next prev parent reply other threads:[~2008-09-11 23:17 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
2008-09-11 23:16 ` Alain Knaff [this message]
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=48C9A6C0.4070802@knaff.lu \
--to=alain@knaff.lu \
--cc=hpa@zytor.com \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox