[libvirt] [PATCH 4/6] libvirt.c: add 2 spaces of indentation to example code of virStreamSend

Claudio Bley cbley at av-test.de
Wed Sep 25 06:49:07 UTC 2013


See libvirt-libvirt.html#virStreamSend for the effect.

Signed-off-by: Claudio Bley <cbley at av-test.de>
---
 src/libvirt.c |  114 ++++++++++++++++++++++++++++-----------------------------
 1 file changed, 57 insertions(+), 57 deletions(-)

diff --git a/src/libvirt.c b/src/libvirt.c
index 9f579a6..405c13f 100644
--- a/src/libvirt.c
+++ b/src/libvirt.c
@@ -16992,37 +16992,37 @@ virStreamRef(virStreamPtr stream)
  * An example using this with a hypothetical file upload
  * API looks like
  *
- *   virStreamPtr st = virStreamNew(conn, 0);
- *   int fd = open("demo.iso", O_RDONLY)
+ *     virStreamPtr st = virStreamNew(conn, 0);
+ *     int fd = open("demo.iso", O_RDONLY)
  *
- *   virConnectUploadFile(conn, "demo.iso", st);
- *
- *   while (1) {
- *       char buf[1024];
- *       int got = read(fd, buf, 1024);
- *       if (got < 0) {
- *          virStreamAbort(st);
- *          break;
- *       }
- *       if (got == 0) {
- *          virStreamFinish(st);
- *          break;
- *       }
- *       int offset = 0;
- *       while (offset < got) {
- *          int sent = virStreamSend(st, buf+offset, got-offset)
- *          if (sent < 0) {
+ *     virConnectUploadFile(conn, "demo.iso", st);
+ *
+ *     while (1) {
+ *          char buf[1024];
+ *          int got = read(fd, buf, 1024);
+ *          if (got < 0) {
  *             virStreamAbort(st);
- *             goto done;
+ *             break;
  *          }
- *          offset += sent;
- *       }
- *   }
- *   if (virStreamFinish(st) < 0)
- *      ... report an error ....
- * done:
- *   virStreamFree(st);
- *   close(fd);
+ *          if (got == 0) {
+ *             virStreamFinish(st);
+ *             break;
+ *          }
+ *          int offset = 0;
+ *          while (offset < got) {
+ *             int sent = virStreamSend(st, buf+offset, got-offset)
+ *             if (sent < 0) {
+ *                virStreamAbort(st);
+ *                goto done;
+ *             }
+ *             offset += sent;
+ *          }
+ *      }
+ *      if (virStreamFinish(st) < 0)
+ *         ... report an error ....
+ *    done:
+ *      virStreamFree(st);
+ *      close(fd);
  *
  * Returns the number of bytes written, which may be less
  * than requested.
@@ -17086,35 +17086,35 @@ error:
  * An example using this with a hypothetical file download
  * API looks like
  *
- *   virStreamPtr st = virStreamNew(conn, 0);
- *   int fd = open("demo.iso", O_WRONLY, 0600)
- *
- *   virConnectDownloadFile(conn, "demo.iso", st);
- *
- *   while (1) {
- *       char buf[1024];
- *       int got = virStreamRecv(st, buf, 1024);
- *       if (got < 0)
- *          break;
- *       if (got == 0) {
- *          virStreamFinish(st);
- *          break;
- *       }
- *       int offset = 0;
- *       while (offset < got) {
- *          int sent = write(fd, buf+offset, got-offset)
- *          if (sent < 0) {
- *             virStreamAbort(st);
- *             goto done;
- *          }
- *          offset += sent;
- *       }
- *   }
- *   if (virStreamFinish(st) < 0)
- *      ... report an error ....
- * done:
- *   virStreamFree(st);
- *   close(fd);
+ *     virStreamPtr st = virStreamNew(conn, 0);
+ *     int fd = open("demo.iso", O_WRONLY, 0600)
+ *
+ *     virConnectDownloadFile(conn, "demo.iso", st);
+ *
+ *     while (1) {
+ *         char buf[1024];
+ *         int got = virStreamRecv(st, buf, 1024);
+ *         if (got < 0)
+ *            break;
+ *         if (got == 0) {
+ *            virStreamFinish(st);
+ *            break;
+ *         }
+ *         int offset = 0;
+ *         while (offset < got) {
+ *            int sent = write(fd, buf+offset, got-offset)
+ *            if (sent < 0) {
+ *               virStreamAbort(st);
+ *               goto done;
+ *            }
+ *            offset += sent;
+ *         }
+ *     }
+ *     if (virStreamFinish(st) < 0)
+ *        ... report an error ....
+ *   done:
+ *     virStreamFree(st);
+ *     close(fd);
  *
  *
  * Returns the number of bytes read, which may be less
-- 
1.7.9.5




More information about the libvir-list mailing list