From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60550) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X37Uz-0007Ho-Au for qemu-devel@nongnu.org; Fri, 04 Jul 2014 13:42:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1X37Ut-0008CK-0t for qemu-devel@nongnu.org; Fri, 04 Jul 2014 13:42:13 -0400 Received: from mx1.redhat.com ([209.132.183.28]:64396) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X37Us-0008Bq-OV for qemu-devel@nongnu.org; Fri, 04 Jul 2014 13:42:06 -0400 From: "Dr. David Alan Gilbert (git)" Date: Fri, 4 Jul 2014 18:41:13 +0100 Message-Id: <1404495717-4239-3-git-send-email-dgilbert@redhat.com> In-Reply-To: <1404495717-4239-1-git-send-email-dgilbert@redhat.com> References: <1404495717-4239-1-git-send-email-dgilbert@redhat.com> Subject: [Qemu-devel] [PATCH 02/46] Move QEMUFile structure to qemu-file.h List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: aarcange@redhat.com, yamahata@private.email.ne.jp, lilei@linux.vnet.ibm.com, quintela@redhat.com From: "Dr. David Alan Gilbert" This is mostly as an easy way to get to the MigrationIncomingState that I'm hanging off the file. Signed-off-by: Dr. David Alan Gilbert buf_size = pending; len = f->ops->get_buffer(f->opaque, f->buf + pending, f->pos, - IO_BUF_SIZE - pending); + QEMUFILE_IO_BUF_SIZE - pending); if (len > 0) { f->buf_size += len; f->pos += len; @@ -621,7 +599,7 @@ static void add_to_iovec(QEMUFile *f, const uint8_t *buf, int size) f->iov[f->iovcnt++].iov_len = size; } - if (f->iovcnt >= MAX_IOV_SIZE) { + if (f->iovcnt >= QEMUFILE_MAX_IOV_SIZE) { qemu_fflush(f); } } @@ -650,7 +628,7 @@ void qemu_put_buffer(QEMUFile *f, const uint8_t *buf, int size) } while (size > 0) { - l = IO_BUF_SIZE - f->buf_index; + l = QEMUFILE_IO_BUF_SIZE - f->buf_index; if (l > size) { l = size; } @@ -660,7 +638,7 @@ void qemu_put_buffer(QEMUFile *f, const uint8_t *buf, int size) add_to_iovec(f, f->buf + f->buf_index, l); } f->buf_index += l; - if (f->buf_index == IO_BUF_SIZE) { + if (f->buf_index == QEMUFILE_IO_BUF_SIZE) { qemu_fflush(f); } if (qemu_file_get_error(f)) { @@ -683,7 +661,7 @@ void qemu_put_byte(QEMUFile *f, int v) add_to_iovec(f, f->buf + f->buf_index, 1); } f->buf_index++; - if (f->buf_index == IO_BUF_SIZE) { + if (f->buf_index == QEMUFILE_IO_BUF_SIZE) { qemu_fflush(f); } } @@ -709,8 +687,8 @@ int qemu_peek_buffer(QEMUFile *f, uint8_t *buf, int size, size_t offset) int index; assert(!qemu_file_is_writable(f)); - assert(offset < IO_BUF_SIZE); - assert(size <= IO_BUF_SIZE - offset); + assert(offset < QEMUFILE_IO_BUF_SIZE); + assert(size <= QEMUFILE_IO_BUF_SIZE - offset); /* The 1st byte to read from */ index = f->buf_index + offset; @@ -759,7 +737,7 @@ int qemu_get_buffer(QEMUFile *f, uint8_t *buf, int size) while (pending > 0) { int res; - res = qemu_peek_buffer(f, buf, MIN(pending, IO_BUF_SIZE), 0); + res = qemu_peek_buffer(f, buf, MIN(pending, QEMUFILE_IO_BUF_SIZE), 0); if (res == 0) { return done; } @@ -780,7 +758,7 @@ int qemu_peek_byte(QEMUFile *f, int offset) int index = f->buf_index + offset; assert(!qemu_file_is_writable(f)); - assert(offset < IO_BUF_SIZE); + assert(offset < QEMUFILE_IO_BUF_SIZE); if (index >= f->buf_size) { qemu_fill_buffer(f); -- 1.9.3