Skip to contentSkip to conversation

struct task_struct -> task_t

DISCUSSION john moser 3 participants 3 messages Jan 19, 2004

lore
Share & tools
lore

john moser

author
#0 lore raw

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;'.

I made a small script to change around as much as I could so that everything uses task_t, but all the forward declarations make it difficult. The script doesn't work as-is, so it will take you a few tries to compile and remove duplicate declarations of task_t. If anyone's interested in changing all of these to be consistent, this is your starting point.

running this in the top level of the source tree should get you started:

for i in find . -type f; do echo $i; cat $i | \
sed -e "s/struct task_struct/task_t/g" | \
sed -e "s/^\s*task_t;/struct task_struct;\ntypedef struct task_struct task_t;/g" \

Quoted 1 line

/tmp/tmpkernel; \

cat /tmp/tmpkernel > $i; rm /tmp/tmpkernel; done; \
cat include/linux/sched.h | \
sed -e "s/typedef task_t task_t/typedef struct task_struct task_t/g" | \
sed -e "s/task_t {/struct task_struct {/g" > /tmp/tmpkernel; \
cat /tmp/tmpkernel > include/linux/sched.h; rm /tmp/tmpkernel

That should also switch the forward declarations of struct task_struct over to 'struct task_struct; typedef struct task_struct task_t;' pairs. This leaves a few holes, as there are some places where the typedef occurs after one has already occured, and so these need to be fixed.

I am only able to deal with i386, and there's a lot of stuff in the asm includes that needs to be adjusted by hand after running the above script.

_____________________________________________________________
Linux.Net -->Open Source to everyone
Powered by Linare Corporation
http://www.linare.com/

#1 lore raw
Quoted 6 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;'.

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.

#2 lore raw
Quoted 10 lines · On Mon, Jan 19, 2004 at 10:24:34PM +0000…
Quoted 6 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;'.

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.

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'.

mh

Signature · 1 line
Martin Hicks || [email protected] || PGP/GnuPG: 0x4C7F2BEE