Skip to content

Commit

Permalink
colo: claim in find_and_check_chardev
Browse files Browse the repository at this point in the history
This factors out claiming of chardev, and changes the call to
non-fatal to return an error like the rest of the chardev checks.

Signed-off-by: Marc-André Lureau <[email protected]>
Message-Id: <[email protected]>
Signed-off-by: Paolo Bonzini <[email protected]>
  • Loading branch information
elmarco authored and bonzini committed Oct 24, 2016
1 parent 7fa47e2 commit fbf3cc3
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions net/colo-compare.c
Original file line number Diff line number Diff line change
Expand Up @@ -589,6 +589,13 @@ static int find_and_check_chardev(CharDriverState **chr,
chr_name);
return 1;
}

if (qemu_chr_fe_claim(*chr) < 0) {
error_setg(errp, "chardev \"%s\" cannot be claimed",
chr_name);
return 1;
}

return 0;
}

Expand Down Expand Up @@ -646,12 +653,6 @@ static void colo_compare_complete(UserCreatable *uc, Error **errp)
return;
}

qemu_chr_fe_claim_no_fail(s->chr_pri_in.chr);

qemu_chr_fe_claim_no_fail(s->chr_sec_in.chr);

qemu_chr_fe_claim_no_fail(s->chr_out.chr);

net_socket_rs_init(&s->pri_rs, compare_pri_rs_finalize);
net_socket_rs_init(&s->sec_rs, compare_sec_rs_finalize);

Expand Down

0 comments on commit fbf3cc3

Please sign in to comment.