qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [RFC 12/12] Bye Bye put_buffer


From: Orit Wasserman
Subject: [Qemu-devel] [RFC 12/12] Bye Bye put_buffer
Date: Thu, 21 Mar 2013 11:09:31 +0200

Removed all unused put_buffer code

Signed-off-by: Orit Wasserman <address@hidden>
---
 include/migration/qemu-file.h |  8 --------
 savevm.c                      | 29 -----------------------------
 2 files changed, 37 deletions(-)

diff --git a/include/migration/qemu-file.h b/include/migration/qemu-file.h
index 5168be2..c76c61b 100644
--- a/include/migration/qemu-file.h
+++ b/include/migration/qemu-file.h
@@ -24,13 +24,6 @@
 #ifndef QEMU_FILE_H
 #define QEMU_FILE_H 1
 
-/* This function writes a chunk of data to a file at the given position.
- * The pos argument can be ignored if the file is only being used for
- * streaming.  The handler should try to write all of the data it can.
- */
-typedef int (QEMUFilePutBufferFunc)(void *opaque, const uint8_t *buf,
-                                    int64_t pos, int size);
-
 /* Read a chunk of data from a file at the given position.  The pos argument
  * can be ignored if the file is only be used for streaming.  The number of
  * bytes actually read should be returned.
@@ -58,7 +51,6 @@ typedef int (QEMUFileWritevBufferFunc)(void *opaque, struct 
iovec *iov,
                                        int iovcnt);
 
 typedef struct QEMUFileOps {
-    QEMUFilePutBufferFunc *put_buffer;
     QEMUFileGetBufferFunc *get_buffer;
     QEMUFileCloseFunc *close;
     QEMUFileGetFD *get_fd;
diff --git a/savevm.c b/savevm.c
index 32a506e..b8d94cf 100644
--- a/savevm.c
+++ b/savevm.c
@@ -218,18 +218,6 @@ static int socket_get_buffer(void *opaque, uint8_t *buf, 
int64_t pos, int size)
     return len;
 }
 
-static int socket_put_buffer(void *opaque, const uint8_t *buf, int64_t pos, 
int size)
-{
-    QEMUFileSocket *s = opaque;
-    ssize_t len;
-
-    len = qemu_send_full(s->fd, buf, size, 0);
-    if (len < size) {
-        len = -socket_error();
-    }
-    return len;
-}
-
 static int socket_close(void *opaque)
 {
     QEMUFileSocket *s = opaque;
@@ -250,12 +238,6 @@ static int stdio_writev_buffer(void *opaque, struct iovec 
*iov, int iovcnt)
     return iov_writev(stdio_get_fd(opaque), iov, iovcnt);
 }
 
-static int stdio_put_buffer(void *opaque, const uint8_t *buf, int64_t pos, int 
size)
-{
-    QEMUFileStdio *s = opaque;
-    return fwrite(buf, 1, size, s->stdio_file);
-}
-
 static int stdio_get_buffer(void *opaque, uint8_t *buf, int64_t pos, int size)
 {
     QEMUFileStdio *s = opaque;
@@ -329,7 +311,6 @@ static const QEMUFileOps stdio_pipe_read_ops = {
 
 static const QEMUFileOps stdio_pipe_write_ops = {
     .get_fd =     stdio_get_fd,
-    .put_buffer = stdio_put_buffer,
     .writev_buffer = stdio_writev_buffer,
     .close =      stdio_pclose
 };
@@ -369,7 +350,6 @@ static const QEMUFileOps stdio_file_read_ops = {
 
 static const QEMUFileOps stdio_file_write_ops = {
     .get_fd =     stdio_get_fd,
-    .put_buffer = stdio_put_buffer,
     .close =      stdio_fclose
 };
 
@@ -409,7 +389,6 @@ static const QEMUFileOps socket_read_ops = {
 
 static const QEMUFileOps socket_write_ops = {
     .get_fd =     socket_get_fd,
-    .put_buffer = socket_put_buffer,
     .writev_buffer = socket_writev_buffer,
     .close =      socket_close
 };
@@ -475,13 +454,6 @@ static int block_writev_buffer(void *opaque, struct iovec 
*iov, int iovcnt)
     return size;
 }
 
-static int block_put_buffer(void *opaque, const uint8_t *buf,
-                           int64_t pos, int size)
-{
-    bdrv_save_vmstate(opaque, buf, pos, size);
-    return size;
-}
-
 static int block_get_buffer(void *opaque, uint8_t *buf, int64_t pos, int size)
 {
     return bdrv_load_vmstate(opaque, buf, pos, size);
@@ -498,7 +470,6 @@ static const QEMUFileOps bdrv_read_ops = {
 };
 
 static const QEMUFileOps bdrv_write_ops = {
-    .put_buffer = block_put_buffer,
     .writev_buffer = block_writev_buffer,
     .close =      bdrv_fclose
 };
-- 
1.7.11.7




reply via email to

[Prev in Thread] Current Thread [Next in Thread]