static ssize_t v9fs_synth_pwritev(FsContext *ctx, V9fsFidOpenState *fs,

                                  const struct iovec *iov,

                                  int iovcnt, off_t offset)

{

    int i, count = 0, wcount;

    V9fsSynthOpenState *synth_open = fs->private;

    V9fsSynthNode *node = synth_open->node;

    if (!node->attr->write) {

        errno = EPERM;

        return -1;

    }

    for (i = 0; i < iovcnt; i++) {

        wcount = node->attr->write(iov[i].iov_base, iov[i].iov_len,

                                   offset, node->private);

        offset += wcount;

        count  += wcount;

        /* If we wrote less than requested. we are done */

        if (wcount < iov[i].iov_len) {

            break;

        }

    }

    return count;

}

static ssize_t v9fs_synth_pwritev(FsContext *ctx, V9fsFidOpenState *fs,

                                  const struct iovec *iov,

                                  int iovcnt, off_t offset)

{

    int i, count = 0, wcount;

    V9fsSynthOpenState *synth_open = fs->private;

    V9fsSynthNode *node = synth_open->node;

    if (!node->attr->write) {

        errno = EPERM;

        return -1;

    }

    for (i = 0; i < iovcnt; i++) {

        wcount = node->attr->write(iov[i].iov_base, iov[i].iov_len,

                                   offset, node->private);

        offset += wcount;

        count  += wcount;

        

        if (wcount < iov[i].iov_len) {

            break;

        }

    }

    return count;

}

static ssize_t FUNC_0(FsContext *ctx, V9fsFidOpenState *fs,

                                  const struct iovec *iov,

                                  int iovcnt, off_t offset)

{

    int VAR_0, VAR_1 = 0, VAR_2;

    V9fsSynthOpenState *synth_open = fs->private;

    V9fsSynthNode *node = synth_open->node;

    if (!node->attr->write) {

        errno = EPERM;

        return -1;

    }

    for (VAR_0 = 0; VAR_0 < iovcnt; VAR_0++) {

        VAR_2 = node->attr->write(iov[VAR_0].iov_base, iov[VAR_0].iov_len,

                                   offset, node->private);

        offset += VAR_2;

        VAR_1  += VAR_2;

        

        if (VAR_2 < iov[VAR_0].iov_len) {

            break;

        }

    }

    return VAR_1;

}

static ssize_t FUNC_0(FsContext *ctx, V9fsFidOpenState *fs,
const struct iovec *iov,
int iovcnt, off_t offset)
{ int VAR_0, VAR_1 = 0, VAR_2; V9fsSynthOpenState *synth_open = fs->private; V9fsSynthNode *node = synth_open->node; if (!node->attr->write) { errno = EPERM; return -1; } for (VAR_0 = 0; VAR_0 < iovcnt; VAR_0++) { VAR_2 = node->attr->write(iov[VAR_0].iov_base, iov[VAR_0].iov_len,
offset, node->private); offset += VAR_2; VAR_1  += VAR_2; if (VAR_2 < iov[VAR_0].iov_len) { break; } } return VAR_1; }