lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Wed, 12 Aug 2009 08:45:54 -0700
From:	"Luis R. Rodriguez" <mcgrof@...il.com>
To:	Nicolas Palix <npalix@...u.dk>
Cc:	Joe Perches <joe@...ches.com>, Julia Lawall <julia@...u.dk>,
	devel@...uxdriverproject.org, linux-kernel@...r.kernel.org
Subject: Re: Typedef removal tool

On Wed, Aug 12, 2009 at 5:23 AM, Nicolas Palix<npalix@...u.dk> wrote:
> On Wednesday 12 August 2009 09:45:35 Luis R. Rodriguez wrote:
>> On Tue, Aug 11, 2009 at 10:01 PM, Julia Lawall<julia@...u.dk> wrote:
>> > On Tue, 11 Aug 2009, Luis R. Rodriguez wrote:
>> >
>> >> Anyone know if there is a typedef removal tool? When porting drivers
>> >> this needs to be done quite often.
>> >>
>> >> FWIW I've started porting some driver and have come across some tools,
>> >> or written my own scripts, which have helped. Using spatch to port a
>> >> driver was such a tool I explored. I think I'll try to put together
>> >> some info on the driver project wiki for this. typdef removal tool
>> >> would still be neat.
>> >
>> > Nicolas Palix (in CC) did a bit of work on this recently using Coccinelle,
>> > but the problem is that simply removing the typedef is not enough, one has
>> > to come up with a name that is within the spirit of the names used in
>> > Linux, or perhaps recognize that the structure in question already exists
>> > in a more general form in the kernel an thus the declaration should be
>> > removed completely.
>> >
>> > Someone else made a dedicated tool using a dictionary of the old and new
>> > names that at least partially addresses these problems.  Nicolas knows who
>> > that person is.
>>
>> Sounds like a very proper way to do this.
>>
>> I wrote something not-so-proper and simple based on Joe's work that
>> just replaces a specified typedef name with one the user specifies.
>> Should do it for simple porting where you do not have to prove
>> correctness and avoid namespace collisions.
>>
>
> We have done this for the new Hyper-V drivers.
> Joe Perches (CC) proposes a shell and perl solution (cvt_typedef_to_struct.bash)
> with the typedefs file dictionary, attached to this email.
>
> I have modified my typedef_str.cocci file to use his dictionary.
> This cocci file generates a cocci file per typedef to remove.
> The generated files could be applied with the modified version
> of Joe's shell script or by hand, at your convenience.

Great thanks Nicholas! I'll play with these.

BTW I was under the impression spatch wouldn't touch header files or
dive in to untangle macros. Is that incorrect? Would the cocci files
allow spatch to not only change typdef usages with simple struct uses
but also redefine a typedef declaration to a simple struct definition
through header files? For upstream work I don't expect as much macro
mess as you would with typical vendor drivers. For drivers which do
need to get ported I do expect an tangling web of macro mess one may
need to put up with at times.

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ