On Sun, Nov 05, 2006 at 05:14:06AM +0100, Mikulas Patocka wrote:
> On Sat, 4 Nov 2006, Linus Torvalds wrote:
> >- you have a _very_ confusing usage of upper-case. Not only are a lot of
> > functions upper-case, some filenames are also upper-case. What would
> > otherwise be more readable just ends up being hard to read because it's
> > so odd and unexpected.
> >
> > I'm sure there is some logic to it, but it escapes me.
>
> I'm used to this. I usually make important functions with uppercase
> letters and nonimportant temporary functions with lowercase letters.
>
> But I see that it contradicts general kernel coding style, so I can change
> it.
We're more used to have uppercase for macros (or enums) and lowercase for
the rest. That way, when you read NULL, KERN_WARNING, PAGE_CACHE_SIZE,
INIT_LIST_HEAD..., you know that you're dealing with a macro, which is
very convenient.
> BTW do you find uppercase typedefs like
> typedef struct {
> ...
> } SPADFNODE;
> confusing too?
Yes for the reason above. Also, we don't much use type definitions for
structures, because it's easier to understand "struct spadfnode *node"
in a function declaration than "SPADFNODE *node". Take a look at other
file systems. You'll see lots of "struct inode", "struct buffer_head".
Sometimes, you'll find some types suffixed with "_t", such as "handle_t"
or "spinlock_t". Generally, they are used for very commonly used data
(such as spinlocks), or opaque data which are passed between functions
without any interpretation. But it's more from observation than a rule.
> Uppercase filenames are there because the files are taken from another
> (not yet released) project. But the kernel driver does not share any code
> except definitions of disk structures, I saw how badly an attempt to share
> kernel code affected XFS.
It's better to avoid uppercases in file names. I recently had to help
a user who could not build his kernel because of strange errors. I
finally found out that he was building from "entry.s" instead of "entry.S",
which suggested he copied the tree on a FAT. He confirmed having used a
vfat-formatted USB stick to copy his tree. Such errors are very annoying
to debug.
(...)
> I placed some benchmark on
> http://artax.karlin.mff.cuni.cz/~mikulas/spadfs/benchmarks/
Not bad at all it seems !
Regards,
Willy
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[Index of Archives]
[Kernel Newbies]
[Netfilter]
[Bugtraq]
[Photo]
[Stuff]
[Gimp]
[Yosemite News]
[MIPS Linux]
[ARM Linux]
[Linux Security]
[Linux RAID]
[Video 4 Linux]
[Linux for the blind]
[Linux Resources]