[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] Re: [RFC PATCH 04/20] Make QEMUFile buf expandable, and int
From: |
Stefan Hajnoczi |
Subject: |
[Qemu-devel] Re: [RFC PATCH 04/20] Make QEMUFile buf expandable, and introduce qemu_realloc_buffer() and qemu_clear_buffer(). |
Date: |
Wed, 21 Apr 2010 09:03:43 +0100 |
On Wed, Apr 21, 2010 at 6:57 AM, Yoshiaki Tamura
<address@hidden> wrote:
> @@ -454,6 +458,25 @@ void qemu_fflush(QEMUFile *f)
> }
> }
>
> +void *qemu_realloc_buffer(QEMUFile *f, int size)
> +{
> + f->buf_max_size = size;
> +
> + f->buf = qemu_realloc(f->buf, f->buf_max_size);
> + if (f->buf == NULL) {
> + fprintf(stderr, "qemu file buffer realloc failed\n");
> + exit(1);
> + }
> +
> + return f->buf;
> +}
> +
qemu_realloc() will abort() if there was not enough memory to realloc.
Just like qemu_malloc(), you don't need to check for NULL.
Stefan
- [Qemu-devel] [RFC PATCH 01/20] Modify DIRTY_FLAG value and introduce DIRTY_IDX to use as indexes of bit-based phys_ram_dirty., (continued)
- [Qemu-devel] [RFC PATCH 01/20] Modify DIRTY_FLAG value and introduce DIRTY_IDX to use as indexes of bit-based phys_ram_dirty., Yoshiaki Tamura, 2010/04/21
- [Qemu-devel] [RFC PATCH 10/20] Introduce skip_header parameter to qemu_loadvm_state() so that it can be called iteratively without reading the header., Yoshiaki Tamura, 2010/04/21
- [Qemu-devel] [RFC PATCH 19/20] Insert do_event_tap() to virtio-{blk, net}, comment out assert() on cpu_single_env temporally., Yoshiaki Tamura, 2010/04/21
- [Qemu-devel] [RFC PATCH 04/20] Make QEMUFile buf expandable, and introduce qemu_realloc_buffer() and qemu_clear_buffer()., Yoshiaki Tamura, 2010/04/21
- [Qemu-devel] Re: [RFC PATCH 04/20] Make QEMUFile buf expandable, and introduce qemu_realloc_buffer() and qemu_clear_buffer()., Anthony Liguori, 2010/04/23
[Qemu-devel] [RFC PATCH 08/20] Introduce RAMSaveIO and use cpu_physical_memory_get_dirty_range() to check multiple dirty pages., Yoshiaki Tamura, 2010/04/21
[Qemu-devel] [RFC PATCH 07/20] Introduce qemu_put_vector() and qemu_put_vector_prepare() to use put_vector() in QEMUFile., Yoshiaki Tamura, 2010/04/21