* struct task_struct -> task_t
@ 2004-01-19 22:17 john moser
2004-01-19 22:24 ` viro
0 siblings, 1 reply; 5+ messages in thread
From: john moser @ 2004-01-19 22:17 UTC (permalink / raw)
To: linux-kernel
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" \
> /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/
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: struct task_struct -> task_t
2004-01-19 22:17 struct task_struct -> task_t john moser
@ 2004-01-19 22:24 ` viro
2004-01-19 23:57 ` Martin Hicks
0 siblings, 1 reply; 5+ messages in thread
From: viro @ 2004-01-19 22:24 UTC (permalink / raw)
To: john moser; +Cc: linux-kernel
On Mon, Jan 19, 2004 at 02:17:57PM -0800, john moser wrote:
> 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.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: struct task_struct -> task_t
2004-01-19 22:24 ` viro
@ 2004-01-19 23:57 ` Martin Hicks
0 siblings, 0 replies; 5+ messages in thread
From: Martin Hicks @ 2004-01-19 23:57 UTC (permalink / raw)
To: viro; +Cc: john moser, linux-kernel
On Mon, Jan 19, 2004 at 10:24:34PM +0000, viro@parcelfarce.linux.theplanet.co.uk wrote:
> On Mon, Jan 19, 2004 at 02:17:57PM -0800, john moser wrote:
> > 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
--
Martin Hicks || mort@bork.org || PGP/GnuPG: 0x4C7F2BEE
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: struct task_struct -> task_t
@ 2004-01-20 23:50 Albert Cahalan
2004-01-21 10:05 ` J.A. Magallon
0 siblings, 1 reply; 5+ messages in thread
From: Albert Cahalan @ 2004-01-20 23:50 UTC (permalink / raw)
To: linux-kernel mailing list; +Cc: mort, viro, bluefoxicy
Martin Hicks writes:
> On Mon, Jan 19, 2004 at 10:24:34PM +0000, viro@parcelfarce.linux.theplanet.co.uk wrote:
>> On Mon, Jan 19, 2004 at 02:17:57PM -0800, john moser wrote:
>>> 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'.
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.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: struct task_struct -> task_t
2004-01-20 23:50 Albert Cahalan
@ 2004-01-21 10:05 ` J.A. Magallon
0 siblings, 0 replies; 5+ messages in thread
From: J.A. Magallon @ 2004-01-21 10:05 UTC (permalink / raw)
To: Albert Cahalan; +Cc: linux-kernel mailing list, mort, viro, bluefoxicy
On 01.21, Albert Cahalan wrote:
> Martin Hicks writes:
> > On Mon, Jan 19, 2004 at 10:24:34PM +0000, viro@parcelfarce.linux.theplanet.co.uk wrote:
> >> On Mon, Jan 19, 2004 at 02:17:57PM -0800, john moser wrote:
>
> >>> 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'.
>
> 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.
--
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))
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2004-01-21 10:05 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-01-19 22:17 struct task_struct -> task_t john moser
2004-01-19 22:24 ` viro
2004-01-19 23:57 ` Martin Hicks
-- strict thread matches above, loose matches on Subject: below --
2004-01-20 23:50 Albert Cahalan
2004-01-21 10:05 ` J.A. Magallon
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox