A fs question & a debugging option

Christopher W. Curtis (ccurtis@aet-usa.com)
Tue, 16 Mar 1999 19:20:33 -0500


[Not on the list, please Cc: replies]

Hi!

I was wondering if Linux supports the equivalent of Sun's tmpfs
filesystem. I haven't seen it in the 2.2 kernels, and think that it's a
significant detriment. Is it an option that I'm simply overlooking or
is a group working on an implementation? For those unaware, it is
simply a pseudo-filesystem that does not reside on disk, but rather
shares disk/memory with the swap. It's very useful for filesystems such
as /tmp where data needn't or shouldn't persist across reboots, and
helps answer the question "should /tmp be its own partition?"

The second thing could be a substancial change in the kernel. When I
write my code, I use the following debugging construction:
----------
#if DEBUG > 9
# error Unknown debug level
#endif
#if DEBUG > 8
# define DEBUG9(x) {} /* Same as a comment */
#endif
#if DEBUG > 7
# define DEBUG8(x) printf x
#else
# define DEBUG8(x) {}
#endif
...
#ifdef DEBUG
# define DEBUG0(x) printf x
#else
# define DEBUG0(x) {}
#endif
----------

Then, in the source code, I can use the following syntax:
----------
...
DEBUG6(( "Testing the foo for barness... " ));
if( foo == bar )
{ DEBUG6(( "it bars.\n" ));
do_something( foo );
} else
DEBUG6(( "nope.\n" ));
...
----------

And when I compile the program, I pass the compiler the DEBUG flag. If
DEBUG is set to 6 in this case, the DEBUG6() construct becomes printf
(can be changed to printk, or whatever) or if it is below 6, it gets
compiled as:
----------
...
{}
if( foo == bar )
{ {}
do_something( foo );
} else
{}
...
----------

I find it useful for debugging and for compiling out a lot of cruft if
it isn't really needed. It's not very helpful for variable output
setting at runtime, but it can eliminate a lot of "if( debuglevel == foo
) printk(...)" statements if you are willing to never have the ability
to turn them back on without recompiling. It may not be that much of a
savings, but it will eliminate some branching and resident memory size,
though it is a lot of work.

Figured I'd throw it out anyway if anyone was interested.

Christopher

-- 
Oh My God!  They Killed init!  You Bastards!!
make install; not war

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/