Skip to content

Commit a3b6274

Browse files
authored
Merge pull request #41 from rmalmain/fast_block_snapshot
Added missing LibAFL markers.
2 parents 2bc13c1 + f2cb66d commit a3b6274

File tree

3 files changed

+15
-0
lines changed

3 files changed

+15
-0
lines changed

block/block-backend.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,10 @@
2727
#include "qemu/option.h"
2828
#include "trace.h"
2929
#include "migration/misc.h"
30+
31+
//// --- Begin LibAFL code ---
3032
#include "libafl_extras/syx-snapshot/syx-snapshot.h"
33+
//// --- End LibAFL code ---
3134

3235
/* Number of coroutines to reserve per attached device model */
3336
#define COROUTINE_POOL_RESERVATION 64
@@ -714,10 +717,12 @@ bool monitor_add_blk(BlockBackend *blk, const char *name, Error **errp)
714717
error_setg(errp, "Invalid device name");
715718
return false;
716719
}
720+
//// --- Begin LibAFL code ---
717721
if (blk_by_name(name)) {
718722
error_setg(errp, "Device with id '%s' already exists", name);
719723
return false;
720724
}
725+
//// --- End LibAFL code ---
721726
if (blk_by_name_hash(g_str_hash(name))) {
722727
error_setg(errp, "Device with name hash '%x' already exists", g_str_hash(name));
723728
return false;
@@ -766,11 +771,13 @@ const char *blk_name(const BlockBackend *blk)
766771
return blk->name ?: "";
767772
}
768773

774+
//// --- Begin LibAFL code ---
769775
guint blk_name_hash(const BlockBackend* blk)
770776
{
771777
IO_CODE();
772778
return blk->name_hash;
773779
}
780+
//// --- End LibAFL code ---
774781

775782
/*
776783
* Return the BlockBackend with name @name if it exists, else null.
@@ -1660,12 +1667,16 @@ static void coroutine_fn blk_aio_read_entry(void *opaque)
16601667

16611668
assert(qiov->size == acb->bytes);
16621669

1670+
//// --- Begin LibAFL code ---
16631671
if (!syx_snapshot_cow_cache_read_entry(rwco->blk, rwco->offset, acb->bytes, qiov, 0, rwco->flags)) {
1672+
//// --- End LibAFL code ---
16641673
rwco->ret = blk_co_do_preadv_part(rwco->blk, rwco->offset, acb->bytes, qiov,
16651674
0, rwco->flags);
1675+
//// --- Begin LibAFL code ---
16661676
} else {
16671677
rwco->ret = 0;
16681678
}
1679+
//// --- End LibAFL code ---
16691680

16701681
blk_aio_complete(acb);
16711682
}

include/sysemu/block-backend-global-state.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,9 @@ void coroutine_fn no_co_wrapper blk_co_unref(BlockBackend *blk);
4848

4949
void blk_remove_all_bs(void);
5050
BlockBackend *blk_by_name(const char *name);
51+
//// --- Begin LibAFL code ---
5152
BlockBackend *blk_by_name_hash(guint name_hash);
53+
//// --- End LibAFL code ---
5254
BlockBackend *blk_next(BlockBackend *blk);
5355
BlockBackend *blk_all_next(BlockBackend *blk);
5456
bool monitor_add_blk(BlockBackend *blk, const char *name, Error **errp);

include/sysemu/block-backend-io.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@
2424
*/
2525

2626
const char *blk_name(const BlockBackend *blk);
27+
//// --- Begin LibAFL code ---
2728
guint blk_name_hash(const BlockBackend* blk);
29+
//// --- End LibAFL code ---
2830

2931
BlockDriverState *blk_bs(BlockBackend *blk);
3032

0 commit comments

Comments
 (0)