Commit | Line | Data |
---|---|---|
9f8e26f4 C |
1 | // Copyright 2005-2009, Ecole des Mines de Nantes, University of Copenhagen |
2 | // Yoann Padioleau, Julia Lawall, Rene Rydhof Hansen, Henrik Stuart, Gilles Muller, Nicolas Palix | |
3 | // This file is part of Coccinelle. | |
4 | // | |
5 | // Coccinelle is free software: you can redistribute it and/or modify | |
6 | // it under the terms of the GNU General Public License as published by | |
7 | // the Free Software Foundation, according to version 2 of the License. | |
8 | // | |
9 | // Coccinelle is distributed in the hope that it will be useful, | |
10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | // GNU General Public License for more details. | |
13 | // | |
14 | // You should have received a copy of the GNU General Public License | |
15 | // along with Coccinelle. If not, see <http://www.gnu.org/licenses/>. | |
16 | // | |
17 | // The authors reserve the right to distribute this or future versions of | |
18 | // Coccinelle under other licenses. | |
19 | ||
20 | ||
34e49164 C |
21 | @@ |
22 | struct SHT sht; | |
23 | local function proc_info_func; | |
24 | @@ | |
25 | sht.proc_info = proc_info_func; | |
26 | ||
27 | @@ | |
28 | identifier buffer, start, offset, length, inout, hostptr, hostno; | |
29 | @@ | |
30 | proc_info_func ( | |
31 | + struct Scsi_Host *hostptr, | |
32 | char *buffer, char **start, off_t offset, int length, | |
33 | - int hostno, | |
34 | int inout) { | |
35 | ... | |
36 | - struct Scsi_Host *hostptr; | |
37 | ... | |
38 | - hostptr = scsi_host_hn_get(hostno); | |
39 | ... | |
40 | ?- if (!hostptr) { ... } | |
41 | ... | |
42 | ?- scsi_host_put(hostptr); | |
43 | ... | |
44 | } | |
45 | ||
46 | @@ | |
47 | expression E; | |
48 | @@ | |
49 | proc_info_func(...) { | |
50 | <... | |
51 | ( | |
52 | \+- E->host_no == hostno | |
53 | + E == shpnt | |
54 | | | |
55 | - hostno | |
56 | + shpnt->host_no | |
57 | ) | |
58 | ...> | |
59 | } | |
60 | ||
61 | @@ | |
62 | struct foo E; | |
63 | @@ | |
64 | proc_info_func(...) { | |
65 | <... | |
66 | ( | |
67 | \+- E->host_no == hostno | |
68 | + E == shpnt | |
69 | | | |
70 | - hostno | |
71 | + shpnt->host_no | |
72 | ) | |
73 | ...> | |
74 | } |