Skip to content

Commit f282d6a

Browse files
committed
fix: conditional compilation of syx-related code in block-backend.c.
1 parent 465f2c7 commit f282d6a

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

block/block-backend.c

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,9 @@
2929
#include "migration/misc.h"
3030

3131
//// --- Begin LibAFL code ---
32+
#ifdef CONFIG_SOFTMMU
3233
#include "libafl_extras/syx-snapshot/syx-snapshot.h"
34+
#endif
3335
//// --- End LibAFL code ---
3436

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

737739
blk->name = g_strdup(name);
738740
//// --- Begin LibAFL code ---
739-
740741
blk->name_hash = g_str_hash(blk->name);
741-
742742
//// --- End LibAFL code ---
743743
QTAILQ_INSERT_TAIL(&monitor_block_backends, blk, monitor_link);
744744
return true;
@@ -1674,14 +1674,18 @@ static void coroutine_fn blk_aio_read_entry(void *opaque)
16741674
assert(qiov->size == acb->bytes);
16751675

16761676
//// --- Begin LibAFL code ---
1677+
#ifdef CONFIG_SOFTMMU
16771678
if (!syx_snapshot_cow_cache_read_entry(rwco->blk, rwco->offset, acb->bytes, qiov, 0, rwco->flags)) {
1679+
#endif
16781680
//// --- End LibAFL code ---
16791681
rwco->ret = blk_co_do_preadv_part(rwco->blk, rwco->offset, acb->bytes, qiov,
16801682
0, rwco->flags);
16811683
//// --- Begin LibAFL code ---
1684+
#ifdef CONFIG_SOFTMMU
16821685
} else {
16831686
rwco->ret = 0;
16841687
}
1688+
#endif
16851689
//// --- End LibAFL code ---
16861690

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

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

1702+
//// --- Begin LibAFL code ---
1703+
#ifdef CONFIG_SOFTMMU
16981704
if (!syx_snapshot_cow_cache_write_entry(rwco->blk, rwco->offset, acb->bytes, qiov, 0, rwco->flags)) {
1699-
rwco->ret = blk_co_do_pwritev_part(rwco->blk, rwco->offset, acb->bytes,
1700-
qiov, 0, rwco->flags);
1705+
#endif
1706+
//// --- End LibAFL code ---
1707+
rwco->ret = blk_co_do_pwritev_part(rwco->blk, rwco->offset, acb->bytes, qiov, 0, rwco->flags);
1708+
//// --- Begin LibAFL code ---
1709+
#ifdef CONFIG_SOFTMMU
17011710
} else {
17021711
rwco->ret = 0;
17031712
}
1713+
#endif
1714+
//// --- End LibAFL code ---
17041715

17051716
blk_aio_complete(acb);
17061717
}

0 commit comments

Comments
 (0)