[PATCH 0/11] use ether_addr_equal_64bits

From: Julia Lawall
Date: Mon Dec 30 2013 - 12:19:15 EST

Ether_addr_equal_64bits is more efficient than ether_addr_equal, and can be
used when each argument is an array within a structure that contains at
least two bytes of data beyond the array.

The semantic patch that makes this change is as follows. To give
moderately good results, this semantic patch requires the spatch options
--recursive-includes and --relax-include-path. These options make spatch
quite slow. The results are also very incomplete. In particular, there is
no result if the structure definition cannot be found or if one of the
arguments is a pointer. The ocaml code prints some information justifying
the transformation.

// <smpl>
expression *e;
position p;


identifier T;
struct T eth;
identifier fld;
identifier T1;
struct T1 eth1;
identifier fld1;
position p!=pre.p;

ether_addr_equal@p(eth.fld, eth1.fld1)

identifier r.T;
type t1, t2;
identifier r.fld, fld2;
position p;

struct T@p { ...
t1 fld[...];
t2 fld2;

identifier r.T1;
type t1, t2;
identifier r.fld1, fld2;
position p1;

struct T1@p1 { ...
t1 fld1[...];
t2 fld2;

rp << r.p;
okp << ok.p;
okp1 << ok1.p1;
t << r.T;
t1 << r.T1;

let rp = List.hd rp in
let okp = List.hd okp in
let okp1 = List.hd okp1 in
Printf.printf "## %s: struct %s defined in %s\n" rp.file t okp.file;
Printf.printf "## %s: struct %s defined in %s\n" rp.file t1 okp1.file;
flush stdout

@depends on ok && ok1@
position r.p;

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