Skip to contentSkip to conversation

struct task_struct -> task_t

DISCUSSION Albert Cahalan 2 participants 2 messages Jan 21, 2004

lore
Share & tools
lore
#0 lore raw
Quoted 14 lines · Martin Hicks
Quoted 7 lines · On Mon, Jan 19, 2004 at 10:24:34PM +0000…
Quoted 5 lines · john moser

It has come to my attention that in some places in the kernel, 'struct task_struct' is used; and in others, 'task_t' is used. Also, 'task_t' is 'typedef struct task_struct task_t;'.

Quoted 5 lines
Quoted 2 lines

I made a small script to change around as much as I could so that everything uses task_t,

What the fsck for? If anything, the opposite (and removal of that typedef) would be preferable.

Quoted 6 lines

John,

As Al is trying to point out, we try to discourage the use of typedefs in the kernel. It is much easier to see that blah_t is really a struct if we always use 'struct blah'.

That's no good for variable usage. We don't
write "struct current".

You're giving the argument for Hungarian
notation. Not that I'd suggest it, but that
is where your argument leads.

IMHO, we type too much already.

#1 lore raw
Quoted 22 lines · Albert Cahalan
Quoted 14 lines · Martin Hicks
Quoted 7 lines · On Mon, Jan 19, 2004 at 10:24:34PM +0000…
Quoted 5 lines · john moser

It has come to my attention that in some places in the kernel, 'struct task_struct' is used; and in others, 'task_t' is used. Also, 'task_t' is 'typedef struct task_struct task_t;'.

Quoted 5 lines
Quoted 2 lines

I made a small script to change around as much as I could so that everything uses task_t,

What the fsck for? If anything, the opposite (and removal of that typedef) would be preferable.

Quoted 6 lines

John,

As Al is trying to point out, we try to discourage the use of typedefs in the kernel. It is much easier to see that blah_t is really a struct if we always use 'struct blah'.

Quoted 9 lines

That's no good for variable usage. We don't
write "struct current".

You're giving the argument for Hungarian
notation. Not that I'd suggest it, but that
is where your argument leads.

IMHO, we type too much already.

At least, don't be redundant.
If you want explicit struct, let the type be 'struct task' (ie, kill the second _struct).
If you want to use struct types as the rest of types, typedef a task_t.
But 'struct task_struct' is redundand, long and ugly.

Signature · 4 lines
J.A. Magallon <jamagallon()able!es>     \                 Software is like sex:
werewolf!able!es                         \           It's better when it's free
Mandrake Linux release 10.0 (Cooker) for i586
Linux 2.6.1-jam4 (gcc 3.3.2 (Mandrake Linux 10.0 3.3.2-4mdk))