Skip to content

Commit

Permalink
fix: conditional compilation of syx-related code in block-backend.c.
Browse files Browse the repository at this point in the history
  • Loading branch information
rmalmain committed Mar 8, 2024
1 parent 465f2c7 commit f282d6a
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions block/block-backend.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@
#include "migration/misc.h"

//// --- Begin LibAFL code ---
#ifdef CONFIG_SOFTMMU
#include "libafl_extras/syx-snapshot/syx-snapshot.h"
#endif
//// --- End LibAFL code ---

/* Number of coroutines to reserve per attached device model */
Expand Down Expand Up @@ -736,9 +738,7 @@ bool monitor_add_blk(BlockBackend *blk, const char *name, Error **errp)

blk->name = g_strdup(name);
//// --- Begin LibAFL code ---

blk->name_hash = g_str_hash(blk->name);

//// --- End LibAFL code ---
QTAILQ_INSERT_TAIL(&monitor_block_backends, blk, monitor_link);
return true;
Expand Down Expand Up @@ -1674,14 +1674,18 @@ static void coroutine_fn blk_aio_read_entry(void *opaque)
assert(qiov->size == acb->bytes);

//// --- Begin LibAFL code ---
#ifdef CONFIG_SOFTMMU
if (!syx_snapshot_cow_cache_read_entry(rwco->blk, rwco->offset, acb->bytes, qiov, 0, rwco->flags)) {
#endif
//// --- End LibAFL code ---
rwco->ret = blk_co_do_preadv_part(rwco->blk, rwco->offset, acb->bytes, qiov,
0, rwco->flags);
//// --- Begin LibAFL code ---
#ifdef CONFIG_SOFTMMU
} else {
rwco->ret = 0;
}
#endif
//// --- End LibAFL code ---

blk_aio_complete(acb);
Expand All @@ -1695,12 +1699,19 @@ static void coroutine_fn blk_aio_write_entry(void *opaque)

assert(!qiov || qiov->size == acb->bytes);

//// --- Begin LibAFL code ---
#ifdef CONFIG_SOFTMMU
if (!syx_snapshot_cow_cache_write_entry(rwco->blk, rwco->offset, acb->bytes, qiov, 0, rwco->flags)) {
rwco->ret = blk_co_do_pwritev_part(rwco->blk, rwco->offset, acb->bytes,
qiov, 0, rwco->flags);
#endif
//// --- End LibAFL code ---
rwco->ret = blk_co_do_pwritev_part(rwco->blk, rwco->offset, acb->bytes, qiov, 0, rwco->flags);
//// --- Begin LibAFL code ---
#ifdef CONFIG_SOFTMMU
} else {
rwco->ret = 0;
}
#endif
//// --- End LibAFL code ---

blk_aio_complete(acb);
}
Expand Down

0 comments on commit f282d6a

Please sign in to comment.