Skip to content

Commit

Permalink
Fixes bio{snoop,top} on 4.10.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Ryan Leary committed Jan 8, 2017
1 parent 9a174ab commit bc43a29
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
10 changes: 4 additions & 6 deletions tools/biosnoop.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,14 +106,12 @@
* test, and maintenance burden.
*/
#ifdef REQ_WRITE
if (req->cmd_flags & REQ_WRITE) {
data.rwflag = !!(req->cmd_flags & REQ_WRITE);
#elif defined(REQ_OP_SHIFT)
data.rwflag = !!((req->cmd_flags >> REQ_OP_SHIFT) == REQ_OP_WRITE);
#else
if ((req->cmd_flags >> REQ_OP_SHIFT) == REQ_OP_WRITE) {
data.rwflag = !!((req->cmd_flags & REQ_OP_MASK) == REQ_OP_WRITE);
#endif
data.rwflag = 1;
} else {
data.rwflag = 0;
}
events.perf_submit(ctx, &data, sizeof(data));
start.delete(&req);
Expand Down
4 changes: 3 additions & 1 deletion tools/biotop.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,10 @@ def signal_ignore(signal, frame):
*/
#ifdef REQ_WRITE
info.rwflag = !!(req->cmd_flags & REQ_WRITE);
#else
#elif defined(REQ_OP_SHIFT)
info.rwflag = !!((req->cmd_flags >> REQ_OP_SHIFT) == REQ_OP_WRITE);
#else
info.rwflag = !!((req->cmd_flags & REQ_OP_MASK) == REQ_OP_WRITE);
#endif
whop = whobyreq.lookup(&req);
Expand Down

0 comments on commit bc43a29

Please sign in to comment.