mirror of
https://github.com/izzy2lost/xemu.git
synced 2026-07-06 00:20:22 -07:00
Merge remote-tracking branch 'remotes/berrange/tags/io-channel-3-for-upstream' into staging
Merge io-channels-3 partial branch # gpg: Signature made Tue 20 Oct 2015 16:36:10 BST using RSA key ID 15104FDF # gpg: Good signature from "Daniel P. Berrange <dan@berrange.com>" # gpg: aka "Daniel P. Berrange <berrange@redhat.com>" * remotes/berrange/tags/io-channel-3-for-upstream: util: pull Buffer code out of VNC module coroutine: move into libqemuutil.a library osdep: add qemu_fork() wrapper for safely handling signals ui: convert VNC startup code to use SocketAddress sockets: allow port to be NULL when listening on IP address sockets: move qapi_copy_SocketAddress into qemu-sockets.c sockets: add helpers for creating SocketAddress from a socket Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
+13
@@ -1193,6 +1193,19 @@ F: crypto/
|
||||
F: include/crypto/
|
||||
F: tests/test-crypto-*
|
||||
|
||||
Coroutines
|
||||
M: Stefan Hajnoczi <stefanha@redhat.com>
|
||||
M: Kevin Wolf <kwolf@redhat.com>
|
||||
F: util/*coroutine*
|
||||
F: include/qemu/coroutine*
|
||||
F: tests/test-coroutine.c
|
||||
|
||||
Buffers
|
||||
M: Daniel P. Berrange <berrange@redhat.com>
|
||||
S: Odd fixes
|
||||
F: util/buffer.c
|
||||
F: include/qemu/buffer.h
|
||||
|
||||
Usermode Emulation
|
||||
------------------
|
||||
Overall
|
||||
|
||||
@@ -15,10 +15,6 @@ block-obj-$(CONFIG_WIN32) += aio-win32.o
|
||||
block-obj-y += block/
|
||||
block-obj-y += qemu-io-cmds.o
|
||||
|
||||
block-obj-y += qemu-coroutine.o qemu-coroutine-lock.o qemu-coroutine-io.o
|
||||
block-obj-y += qemu-coroutine-sleep.o
|
||||
block-obj-y += coroutine-$(CONFIG_COROUTINE_BACKEND).o
|
||||
|
||||
block-obj-m = block/
|
||||
|
||||
#######################################################################
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
#include "sysemu/block-backend.h"
|
||||
#include "sysemu/sysemu.h"
|
||||
#include "qemu/notify.h"
|
||||
#include "block/coroutine.h"
|
||||
#include "qemu/coroutine.h"
|
||||
#include "block/qapi.h"
|
||||
#include "qmp-commands.h"
|
||||
#include "qemu/timer.h"
|
||||
|
||||
+1
-1
@@ -26,7 +26,7 @@
|
||||
#define BLOCK_QCOW2_H
|
||||
|
||||
#include "crypto/cipher.h"
|
||||
#include "block/coroutine.h"
|
||||
#include "qemu/coroutine.h"
|
||||
|
||||
//#define DEBUG_ALLOC
|
||||
//#define DEBUG_ALLOC2
|
||||
|
||||
+1
-1
@@ -53,7 +53,7 @@
|
||||
#include "block/block_int.h"
|
||||
#include "qemu/module.h"
|
||||
#include "migration/migration.h"
|
||||
#include "block/coroutine.h"
|
||||
#include "qemu/coroutine.h"
|
||||
|
||||
#if defined(CONFIG_UUID)
|
||||
#include <uuid/uuid.h>
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
*/
|
||||
|
||||
#include "block/block_int.h"
|
||||
#include "block/coroutine.h"
|
||||
#include "qemu/coroutine.h"
|
||||
#include "block/write-threshold.h"
|
||||
#include "qemu/notify.h"
|
||||
#include "qapi-event.h"
|
||||
|
||||
+1
-1
@@ -31,7 +31,7 @@
|
||||
#include "block/block_int.h"
|
||||
#include "qapi/qmp/qerror.h"
|
||||
#include "qapi/qmp/qjson.h"
|
||||
#include "block/coroutine.h"
|
||||
#include "qemu/coroutine.h"
|
||||
#include "qmp-commands.h"
|
||||
#include "qemu/timer.h"
|
||||
#include "qapi-event.h"
|
||||
|
||||
+1
-1
@@ -14,7 +14,7 @@
|
||||
|
||||
#include "fsdev/qemu-fsdev.h"
|
||||
#include "qemu/thread.h"
|
||||
#include "block/coroutine.h"
|
||||
#include "qemu/coroutine.h"
|
||||
#include "virtio-9p-coth.h"
|
||||
|
||||
int v9fs_co_readdir_r(V9fsPDU *pdu, V9fsFidState *fidp, struct dirent *dent,
|
||||
|
||||
+1
-1
@@ -14,7 +14,7 @@
|
||||
|
||||
#include "fsdev/qemu-fsdev.h"
|
||||
#include "qemu/thread.h"
|
||||
#include "block/coroutine.h"
|
||||
#include "qemu/coroutine.h"
|
||||
#include "virtio-9p-coth.h"
|
||||
|
||||
int v9fs_co_st_gen(V9fsPDU *pdu, V9fsPath *path, mode_t st_mode,
|
||||
|
||||
+1
-1
@@ -14,7 +14,7 @@
|
||||
|
||||
#include "fsdev/qemu-fsdev.h"
|
||||
#include "qemu/thread.h"
|
||||
#include "block/coroutine.h"
|
||||
#include "qemu/coroutine.h"
|
||||
#include "virtio-9p-coth.h"
|
||||
|
||||
static ssize_t __readlink(V9fsState *s, V9fsPath *path, V9fsString *buf)
|
||||
|
||||
+1
-1
@@ -14,7 +14,7 @@
|
||||
|
||||
#include "fsdev/qemu-fsdev.h"
|
||||
#include "qemu/thread.h"
|
||||
#include "block/coroutine.h"
|
||||
#include "qemu/coroutine.h"
|
||||
#include "virtio-9p-coth.h"
|
||||
|
||||
int v9fs_co_llistxattr(V9fsPDU *pdu, V9fsPath *path, void *value, size_t size)
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
#include "fsdev/qemu-fsdev.h"
|
||||
#include "qemu/thread.h"
|
||||
#include "qemu/event_notifier.h"
|
||||
#include "block/coroutine.h"
|
||||
#include "qemu/coroutine.h"
|
||||
#include "virtio-9p-coth.h"
|
||||
|
||||
/* v9fs glib thread pool */
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
#define _QEMU_VIRTIO_9P_COTH_H
|
||||
|
||||
#include "qemu/thread.h"
|
||||
#include "block/coroutine.h"
|
||||
#include "qemu/coroutine.h"
|
||||
#include "virtio-9p.h"
|
||||
#include <glib.h>
|
||||
|
||||
|
||||
+1
-1
@@ -13,7 +13,7 @@
|
||||
#include "fsdev/file-op-9p.h"
|
||||
#include "fsdev/virtio-9p-marshal.h"
|
||||
#include "qemu/thread.h"
|
||||
#include "block/coroutine.h"
|
||||
#include "qemu/coroutine.h"
|
||||
|
||||
enum {
|
||||
P9_TLERROR = 6,
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#include "block/aio.h"
|
||||
#include "qemu-common.h"
|
||||
#include "qemu/option.h"
|
||||
#include "block/coroutine.h"
|
||||
#include "qemu/coroutine.h"
|
||||
#include "block/accounting.h"
|
||||
#include "qapi/qmp/qobject.h"
|
||||
#include "qapi-types.h"
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
#include "block/block.h"
|
||||
#include "qemu/option.h"
|
||||
#include "qemu/queue.h"
|
||||
#include "block/coroutine.h"
|
||||
#include "qemu/coroutine.h"
|
||||
#include "qemu/timer.h"
|
||||
#include "qapi-types.h"
|
||||
#include "qemu/hbitmap.h"
|
||||
|
||||
@@ -0,0 +1,118 @@
|
||||
/*
|
||||
* QEMU generic buffers
|
||||
*
|
||||
* Copyright (c) 2015 Red Hat, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef QEMU_BUFFER_H__
|
||||
#define QEMU_BUFFER_H__
|
||||
|
||||
#include "qemu-common.h"
|
||||
|
||||
typedef struct Buffer Buffer;
|
||||
|
||||
/**
|
||||
* Buffer:
|
||||
*
|
||||
* The Buffer object provides a simple dynamically resizing
|
||||
* array, with separate tracking of capacity and usage. This
|
||||
* is typically useful when buffering I/O or processing data.
|
||||
*/
|
||||
|
||||
struct Buffer {
|
||||
size_t capacity;
|
||||
size_t offset;
|
||||
uint8_t *buffer;
|
||||
};
|
||||
|
||||
/**
|
||||
* buffer_reserve:
|
||||
* @buffer: the buffer object
|
||||
* @len: the minimum required free space
|
||||
*
|
||||
* Ensure that the buffer has space allocated for at least
|
||||
* @len bytes. If the current buffer is too small, it will
|
||||
* be reallocated, possibly to a larger size than requested.
|
||||
*/
|
||||
void buffer_reserve(Buffer *buffer, size_t len);
|
||||
|
||||
/**
|
||||
* buffer_reset:
|
||||
* @buffer: the buffer object
|
||||
*
|
||||
* Reset the length of the stored data to zero, but do
|
||||
* not free / reallocate the memory buffer
|
||||
*/
|
||||
void buffer_reset(Buffer *buffer);
|
||||
|
||||
/**
|
||||
* buffer_free:
|
||||
* @buffer: the buffer object
|
||||
*
|
||||
* Reset the length of the stored data to zero and also
|
||||
* free the internal memory buffer
|
||||
*/
|
||||
void buffer_free(Buffer *buffer);
|
||||
|
||||
/**
|
||||
* buffer_append:
|
||||
* @buffer: the buffer object
|
||||
* @data: the data block to append
|
||||
* @len: the length of @data in bytes
|
||||
*
|
||||
* Append the contents of @data to the end of the buffer.
|
||||
* The caller must ensure that the buffer has sufficient
|
||||
* free space for @len bytes, typically by calling the
|
||||
* buffer_reserve() method prior to appending.
|
||||
*/
|
||||
void buffer_append(Buffer *buffer, const void *data, size_t len);
|
||||
|
||||
/**
|
||||
* buffer_advance:
|
||||
* @buffer: the buffer object
|
||||
* @len: the number of bytes to skip
|
||||
*
|
||||
* Remove @len bytes of data from the head of the buffer.
|
||||
* The internal buffer will not be reallocated, so will
|
||||
* have at least @len bytes of free space after this
|
||||
* call completes
|
||||
*/
|
||||
void buffer_advance(Buffer *buffer, size_t len);
|
||||
|
||||
/**
|
||||
* buffer_end:
|
||||
* @buffer: the buffer object
|
||||
*
|
||||
* Get a pointer to the tail end of the internal buffer
|
||||
* The returned pointer is only valid until the next
|
||||
* call to buffer_reserve().
|
||||
*
|
||||
* Returns: the tail of the buffer
|
||||
*/
|
||||
uint8_t *buffer_end(Buffer *buffer);
|
||||
|
||||
/**
|
||||
* buffer_empty:
|
||||
* @buffer: the buffer object
|
||||
*
|
||||
* Determine if the buffer contains any current data
|
||||
*
|
||||
* Returns: true if the buffer holds data, false otherwise
|
||||
*/
|
||||
gboolean buffer_empty(Buffer *buffer);
|
||||
|
||||
#endif /* QEMU_BUFFER_H__ */
|
||||
@@ -26,7 +26,7 @@
|
||||
#define QEMU_COROUTINE_INT_H
|
||||
|
||||
#include "qemu/queue.h"
|
||||
#include "block/coroutine.h"
|
||||
#include "qemu/coroutine.h"
|
||||
|
||||
typedef enum {
|
||||
COROUTINE_YIELD = 1,
|
||||
@@ -69,6 +69,8 @@
|
||||
#include "sysemu/os-posix.h"
|
||||
#endif
|
||||
|
||||
#include "qapi/error.h"
|
||||
|
||||
#if defined(CONFIG_SOLARIS) && CONFIG_SOLARIS_VERSION < 10
|
||||
/* [u]int_fast*_t not in <sys/int_types.h> */
|
||||
typedef unsigned char uint_fast8_t;
|
||||
@@ -286,4 +288,18 @@ void os_mem_prealloc(int fd, char *area, size_t sz);
|
||||
|
||||
int qemu_read_password(char *buf, int buf_size);
|
||||
|
||||
/**
|
||||
* qemu_fork:
|
||||
*
|
||||
* A version of fork that avoids signal handler race
|
||||
* conditions that can lead to child process getting
|
||||
* signals that are otherwise only expected by the
|
||||
* parent. It also resets all signal handlers to the
|
||||
* default settings.
|
||||
*
|
||||
* Returns 0 to child process, pid number to parent
|
||||
* or -1 on failure.
|
||||
*/
|
||||
pid_t qemu_fork(Error **errp);
|
||||
|
||||
#endif
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user