[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 3/4] migration: drop is_write complications
From: |
Paolo Bonzini |
Subject: |
Re: [Qemu-devel] [PATCH 3/4] migration: drop is_write complications |
Date: |
Tue, 09 Apr 2013 14:25:45 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130311 Thunderbird/17.0.4 |
Il 09/04/2013 14:17, Juan Quintela ha scritto:
>> > This test assumes that it makes sense to call qemu_get_byte on a
>> > write-opened QEMUFile. This is not true anymore after this patch.
>> > After eliminating is_write, the right thing to do is abort.
>
> But this would not abort, it would do a segmenation fault!
>
> I would not complain to a:
>
> assert(!f->ops->get_buffer);
>
> It would told us from where we got the "invalid" call, but this removal
> will change a "silent fail" (that I don't like either) to a segmentation
> fault (that is even worse).
It would still assert if you open a file in the wrong mode:
- if (!f->ops->get_buffer)
- return;
-
- if (f->is_write)
- abort();
+ assert(!qemu_file_is_writable(f));
It would segfault if you declare the QEMUFileOps wrong (e.g. no *_buffer
operation), but that's a bug in the QEMUFile implementation rather than
the usage. I think a segfault is acceptable for that.
Paolo
[Qemu-devel] [PATCH 2/4] migration: use a single I/O operation when writev_buffer is not defined, Paolo Bonzini, 2013/04/08
[Qemu-devel] [PATCH 4/4] migration: simplify writev vs. non-writev logic, Paolo Bonzini, 2013/04/08
Re: [Qemu-devel] [PATCH 0/4] QEMUFile improvements and simplifications, Juan Quintela, 2013/04/09
Re: [Qemu-devel] [PATCH 0/4] QEMUFile improvements and simplifications, Liuji (Jeremy), 2013/04/10