VirtualBox

Changeset 37675 in vbox for trunk/src/recompiler/cutils.c


Ignore:
Timestamp:
Jun 29, 2011 7:07:14 AM (13 years ago)
Author:
vboxsync
Message:

rem: Synced with v0.12.5.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/recompiler/cutils.c

    r36175 r37675  
    2626
    2727#ifdef VBOX
    28 #include "osdep.h"
     28# include "osdep.h"
    2929
    3030
     
    612612
    613613#ifndef VBOX
     614/*
     615 * Make sure data goes on disk, but if possible do not bother to
     616 * write out the inode just for timestamp updates.
     617 *
     618 * Unfortunately even in 2009 many operating systems do not support
     619 * fdatasync and have to fall back to fsync.
     620 */
     621int qemu_fdatasync(int fd)
     622{
     623#ifdef CONFIG_FDATASYNC
     624    return fdatasync(fd);
     625#else
     626    return fsync(fd);
     627#endif
     628}
     629
    614630/* io vectors */
    615631
     
    646662    qiov->size += len;
    647663    ++qiov->niov;
     664}
     665
     666/*
     667 * Copies iovecs from src to the end dst until src is completely copied or the
     668 * total size of the copied iovec reaches size. The size of the last copied
     669 * iovec is changed in order to fit the specified total size if it isn't a
     670 * perfect fit already.
     671 */
     672void qemu_iovec_concat(QEMUIOVector *dst, QEMUIOVector *src, size_t size)
     673{
     674    int i;
     675    size_t done;
     676
     677    assert(dst->nalloc != -1);
     678
     679    done = 0;
     680    for (i = 0; (i < src->niov) && (done != size); i++) {
     681        if (done + src->iov[i].iov_len > size) {
     682            qemu_iovec_add(dst, src->iov[i].iov_base, size - done);
     683            break;
     684        } else {
     685            qemu_iovec_add(dst, src->iov[i].iov_base, src->iov[i].iov_len);
     686        }
     687        done += src->iov[i].iov_len;
     688    }
    648689}
    649690
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette