2001-02-20 09:37:19

by Andrzej Krzysztofowicz

[permalink] [raw]
Subject: Re: Newbie ask for help: cramfs port to isofs

"zhaoway wrote:"

> --- vanilla-2.4.1/fs/isofs/dir.c Sat Dec 30 01:13:45 2000
> +++ cisofs/fs/isofs/dir.c Mon Feb 19 18:40:16 2001
> @@ -108,8 +111,7 @@
> unsigned int block, offset;
> int inode_number = 0; /* Quiet GCC */
> struct buffer_head *bh = NULL;
> - int len;
> - int map;
> + int len = 0;

This will be the most probably rejected.
Zero initializers are intentionally removed from the code to decrease
the kernel image size.

> - len = 0;
> -

--
=======================================================================
Andrzej M. Krzysztofowicz [email protected]
phone (48)(58) 347 14 61
Faculty of Applied Phys. & Math., Technical University of Gdansk

2001-02-20 09:55:43

by Nick Holloway

[permalink] [raw]
Subject: Re: Newbie ask for help: cramfs port to isofs

[email protected] (Andrzej Krzysztofowicz) writes:
> "zhaoway wrote:"
> > - int len;
> > - int map;
> > + int len = 0;
>
> This will be the most probably rejected.
> Zero initializers are intentionally removed from the code to decrease
> the kernel image size.

A little knowledge is a dangerous thing.

The zero initializers can be removed from _static_ variables (those not
within function scope), where the initialization to zero is guarenteed.

In the case above, the variable being initialized is an automatic variable
(allocated on the stack), and so needs to be initialized.

--
`O O' | [email protected]
// ^ \\ | http://www.pyrites.org.uk/

2001-02-20 12:30:29

by Alan

[permalink] [raw]
Subject: Re: Newbie ask for help: cramfs port to isofs

> > struct buffer_head *bh = NULL;
> > - int len;
> > - int map;
> > + int len = 0;
>
> This will be the most probably rejected.
> Zero initializers are intentionally removed from the code to decrease
> the kernel image size.

Why. Its not static.

2001-02-21 03:49:01

by H. Peter Anvin

[permalink] [raw]
Subject: Re: Newbie ask for help: cramfs port to isofs

Followup to: <[email protected]>
By author: zhaoway <[email protected]>
In newsgroup: linux.dev.kernel
>
> I plan to automatically de-compressing ``*.cramed'' files made with
> cramit.c (which is a simplified version of mkcramfs.c also attached
> below) from within isofs.o. This indeed isn't a very clean idea I
> agree. If you have better design, please let me know.
>

It would be better to have this controlled by SUSP records. It looks
like the -z option to mkisofs was intended to do this, but it never
quite got done and integrated.

-hpa
--
<[email protected]> at work, <[email protected]> in private!
"Unix gives you enough rope to shoot yourself in the foot."
http://www.zytor.com/~hpa/puzzle.txt

2001-02-23 08:57:37

by Pavel Machek

[permalink] [raw]
Subject: Re: Newbie ask for help: cramfs port to isofs

Hi!

> I've nearly no prior experience with kernel hacking (nor C if you have
> to ask, haha), sorry in advance for the newbiesh looking. ;-)
>
> See attach for a rough try to port cramfs to isofs which gave me lots
> of oops and reboots and fscks this week. Please if you have some spare
> time to give it a look with your experienced eyes to help me out of
> this helpless state. Thanks alot!
>
> I plan to automatically de-compressing ``*.cramed'' files made with
> cramit.c (which is a simplified version of mkcramfs.c also attached
> below) from within isofs.o. This indeed isn't a very clean idea I
> agree. If you have better design, please let me know.

Nice toy: I believe that it should even _speed up_
operations. Surely if you have k6/400 with 4x cdrom like me ;-).

> My problem is that when I after mount ``$ file somefile.not.cram.ed''
> the kernel hangs. And my de-compression code surely has some thing

strace file somefile.not.cram.ed, and looks what what goes bad.

Pavel
--
I'm [email protected]. "In my country we have almost anarchy and I don't care."
Panos Katsaloulis describing me w.r.t. patents at [email protected]

2001-02-23 08:58:17

by Pavel Machek

[permalink] [raw]
Subject: Re: Newbie ask for help: cramfs port to isofs

Hi!

> > --- vanilla-2.4.1/fs/isofs/dir.c Sat Dec 30 01:13:45 2000
> > +++ cisofs/fs/isofs/dir.c Mon Feb 19 18:40:16 2001
> > @@ -108,8 +111,7 @@
> > unsigned int block, offset;
> > int inode_number = 0; /* Quiet GCC */
> > struct buffer_head *bh = NULL;
> > - int len;
> > - int map;
> > + int len = 0;
>
> This will be the most probably rejected.
> Zero initializers are intentionally removed from the code to decrease
> the kernel image size.

Definitely not zero initializers of _auto_ variables!!!
Pavel
--
I'm [email protected]. "In my country we have almost anarchy and I don't care."
Panos Katsaloulis describing me w.r.t. patents at [email protected]