Skip to content

Commit bc43a29

Browse files
author
Ryan Leary
committed
Fixes bio{snoop,top} on 4.10.
This commit fixes iovisor#888. The 2 scripts run the same check, and now run basically the same code to do it. Tested on 4.10-rc2.
1 parent 9a174ab commit bc43a29

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

tools/biosnoop.py

+4-6
Original file line numberDiff line numberDiff line change
@@ -106,14 +106,12 @@
106106
* test, and maintenance burden.
107107
*/
108108
#ifdef REQ_WRITE
109-
if (req->cmd_flags & REQ_WRITE) {
109+
data.rwflag = !!(req->cmd_flags & REQ_WRITE);
110+
#elif defined(REQ_OP_SHIFT)
111+
data.rwflag = !!((req->cmd_flags >> REQ_OP_SHIFT) == REQ_OP_WRITE);
110112
#else
111-
if ((req->cmd_flags >> REQ_OP_SHIFT) == REQ_OP_WRITE) {
113+
data.rwflag = !!((req->cmd_flags & REQ_OP_MASK) == REQ_OP_WRITE);
112114
#endif
113-
data.rwflag = 1;
114-
} else {
115-
data.rwflag = 0;
116-
}
117115
118116
events.perf_submit(ctx, &data, sizeof(data));
119117
start.delete(&req);

tools/biotop.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,10 @@ def signal_ignore(signal, frame):
137137
*/
138138
#ifdef REQ_WRITE
139139
info.rwflag = !!(req->cmd_flags & REQ_WRITE);
140-
#else
140+
#elif defined(REQ_OP_SHIFT)
141141
info.rwflag = !!((req->cmd_flags >> REQ_OP_SHIFT) == REQ_OP_WRITE);
142+
#else
143+
info.rwflag = !!((req->cmd_flags & REQ_OP_MASK) == REQ_OP_WRITE);
142144
#endif
143145
144146
whop = whobyreq.lookup(&req);

0 commit comments

Comments
 (0)