-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
98 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// | ||
// Created by Fábio Domingues on 19/07/17. | ||
// | ||
|
||
#include "utils_c.h" | ||
#include <linux/blk_types.h> | ||
|
||
bool __c_is_async_write(struct disk_write_op_meta *m) { | ||
return !((m->bi_rw & REQ_SYNC) || | ||
(m->bi_rw & REQ_FUA) || | ||
(m->bi_rw & REQ_FLUSH) || | ||
(m->bi_rw & REQ_FLUSH_SEQ) || | ||
(m->bi_rw & REQ_SOFTBARRIER)) && | ||
(m->bi_rw & REQ_WRITE); | ||
} | ||
|
||
bool __c_is_barrier_write(struct disk_write_op_meta *m) { | ||
return ((m->bi_rw & REQ_FUA) || | ||
(m->bi_rw & REQ_FLUSH) || | ||
(m->bi_rw & REQ_FLUSH_SEQ) || | ||
(m->bi_rw & REQ_SOFTBARRIER)) && | ||
(m->bi_rw & REQ_WRITE); | ||
} | ||
|
||
bool __c_is_meta(struct disk_write_op_meta *m) { | ||
return (m->bi_rw & REQ_META) && true; | ||
} | ||
|
||
bool __c_has_write_flag(struct disk_write_op_meta *m) { | ||
return (m->bi_rw & REQ_WRITE) && true; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// | ||
// Created by Fábio Domingues on 19/07/17. | ||
// | ||
|
||
#ifndef CRASHMONKEY_UTILS_C_H | ||
#define CRASHMONKEY_UTILS_C_H | ||
#ifdef __cplusplus | ||
extern "C" | ||
{ | ||
#else | ||
// get bool type definition | ||
#include <linux/types.h> | ||
#endif | ||
|
||
#include "../disk_wrapper_ioctl.h" | ||
|
||
bool __c_is_async_write(struct disk_write_op_meta* m); | ||
bool __c_is_barrier_write(struct disk_write_op_meta* m); | ||
bool __c_is_meta(struct disk_write_op_meta* m); | ||
bool __c_has_write_flag(struct disk_write_op_meta* m); | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif | ||
#endif //CRASHMONKEY_UTILS_C_H |