I'm trying to transform uses of list types and functions/macros to hash-list 
equivalents in an out-of-tree Linux kernel module, have been able to do some 
transforms but have not found a solution for others and am hoping someone on 
this list could help.  The ones I still need help with are transforming all 
declarations similar to 'struct list_entry x' to 'struct hlist_node x' and all 
calls to list iterator macros such as 'list_for_each_entry(...) {' to 
'hlist_for_each_entry(...) {'.  So, with the following:

struct foo_struct {
                struct list_entry list;
                ...
};

void foo()
{
                struct foo_struct *pos;
                ...
                list_for_each_entry(pos, &list_head, list) {
                                ...
                }

What SmPL script would transform the above to:

struct foo_struct {
                struct hlist_node list;
                ...
};

void foo()
{
                struct foo_struct *pos;
                ...
                hlist_for_each_entry(pos, &list_head, list) {
                                ...
                }

Thanks in advance for any help,
Bruce.
_______________________________________________
Cocci mailing list
[email protected]
https://systeme.lip6.fr/mailman/listinfo/cocci

Reply via email to