mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-08 10:13:56 -06:00
Merge remote-tracking branch 'bonzini/header-dirs' into staging
* bonzini/header-dirs: (45 commits) janitor: move remaining public headers to include/ hw: move executable format header files to hw/ fpu: move public header file to include/fpu softmmu: move remaining include files to include/ subdirectories softmmu: move include files to include/sysemu/ misc: move include files to include/qemu/ qom: move include files to include/qom/ migration: move include files to include/migration/ monitor: move include files to include/monitor/ exec: move include files to include/exec/ block: move include files to include/block/ qapi: move include files to include/qobject/ janitor: add guards to headers qapi: make struct Visitor opaque qapi: remove qapi/qapi-types-core.h qapi: move inclusions of qemu-common.h from headers to .c files ui: move files to ui/ and include/ui/ qemu-ga: move qemu-ga files to qga/ net: reorganize headers net: move net.c to net/ ... Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
This commit is contained in:
commit
27dd773058
1124 changed files with 3156 additions and 3429 deletions
|
@ -1,4 +1,4 @@
|
|||
common-obj-y = queue.o checksum.o util.o hub.o
|
||||
common-obj-y = net.o queue.o checksum.o util.o hub.o
|
||||
common-obj-y += socket.o
|
||||
common-obj-y += dump.o
|
||||
common-obj-$(CONFIG_POSIX) += tap.o
|
||||
|
|
|
@ -1,29 +0,0 @@
|
|||
/*
|
||||
* IP checksumming functions.
|
||||
* (c) 2008 Gerd Hoffmann <kraxel@redhat.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; under version 2 of the License.
|
||||
*
|
||||
* This program 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef QEMU_NET_CHECKSUM_H
|
||||
#define QEMU_NET_CHECKSUM_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
uint32_t net_checksum_add(int len, uint8_t *buf);
|
||||
uint16_t net_checksum_finish(uint32_t sum);
|
||||
uint16_t net_checksum_tcpudp(uint16_t length, uint16_t proto,
|
||||
uint8_t *addrs, uint8_t *buf);
|
||||
void net_checksum_calculate(uint8_t *data, int length);
|
||||
|
||||
#endif /* QEMU_NET_CHECKSUM_H */
|
|
@ -24,7 +24,7 @@
|
|||
#ifndef QEMU_NET_CLIENTS_H
|
||||
#define QEMU_NET_CLIENTS_H
|
||||
|
||||
#include "net.h"
|
||||
#include "net/net.h"
|
||||
#include "qapi-types.h"
|
||||
|
||||
int net_init_dump(const NetClientOptions *opts, const char *name,
|
||||
|
|
|
@ -24,9 +24,9 @@
|
|||
|
||||
#include "clients.h"
|
||||
#include "qemu-common.h"
|
||||
#include "qemu-error.h"
|
||||
#include "qemu-log.h"
|
||||
#include "qemu-timer.h"
|
||||
#include "qemu/error-report.h"
|
||||
#include "qemu/log.h"
|
||||
#include "qemu/timer.h"
|
||||
#include "hub.h"
|
||||
|
||||
typedef struct DumpState {
|
||||
|
|
|
@ -12,11 +12,11 @@
|
|||
*
|
||||
*/
|
||||
|
||||
#include "monitor.h"
|
||||
#include "net.h"
|
||||
#include "monitor/monitor.h"
|
||||
#include "net/net.h"
|
||||
#include "clients.h"
|
||||
#include "hub.h"
|
||||
#include "iov.h"
|
||||
#include "qemu/iov.h"
|
||||
|
||||
/*
|
||||
* A hub broadcasts incoming packets to all its ports except the source port.
|
||||
|
|
|
@ -20,8 +20,6 @@
|
|||
NetClientState *net_hub_add_port(int hub_id, const char *name);
|
||||
NetClientState *net_hub_find_client_by_name(int hub_id, const char *name);
|
||||
void net_hub_info(Monitor *mon);
|
||||
int net_hub_id_for_client(NetClientState *nc, int *id);
|
||||
void net_hub_check_clients(void);
|
||||
NetClientState *net_hub_port_find(int hub_id);
|
||||
|
||||
#endif /* NET_HUB_H */
|
||||
|
|
|
@ -22,8 +22,8 @@
|
|||
*/
|
||||
|
||||
#include "net/queue.h"
|
||||
#include "qemu-queue.h"
|
||||
#include "net.h"
|
||||
#include "qemu/queue.h"
|
||||
#include "net/net.h"
|
||||
|
||||
/* The delivery handler may only return zero if it will call
|
||||
* qemu_net_queue_flush() when it determines that it is once again able
|
||||
|
|
58
net/queue.h
58
net/queue.h
|
@ -1,58 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2003-2008 Fabrice Bellard
|
||||
* Copyright (c) 2009 Red Hat, Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef QEMU_NET_QUEUE_H
|
||||
#define QEMU_NET_QUEUE_H
|
||||
|
||||
#include "qemu-common.h"
|
||||
|
||||
typedef struct NetPacket NetPacket;
|
||||
typedef struct NetQueue NetQueue;
|
||||
|
||||
typedef void (NetPacketSent) (NetClientState *sender, ssize_t ret);
|
||||
|
||||
#define QEMU_NET_PACKET_FLAG_NONE 0
|
||||
#define QEMU_NET_PACKET_FLAG_RAW (1<<0)
|
||||
|
||||
NetQueue *qemu_new_net_queue(void *opaque);
|
||||
|
||||
void qemu_del_net_queue(NetQueue *queue);
|
||||
|
||||
ssize_t qemu_net_queue_send(NetQueue *queue,
|
||||
NetClientState *sender,
|
||||
unsigned flags,
|
||||
const uint8_t *data,
|
||||
size_t size,
|
||||
NetPacketSent *sent_cb);
|
||||
|
||||
ssize_t qemu_net_queue_send_iov(NetQueue *queue,
|
||||
NetClientState *sender,
|
||||
unsigned flags,
|
||||
const struct iovec *iov,
|
||||
int iovcnt,
|
||||
NetPacketSent *sent_cb);
|
||||
|
||||
void qemu_net_queue_purge(NetQueue *queue, NetClientState *from);
|
||||
bool qemu_net_queue_flush(NetQueue *queue);
|
||||
|
||||
#endif /* QEMU_NET_QUEUE_H */
|
|
@ -29,12 +29,13 @@
|
|||
#include <pwd.h>
|
||||
#include <sys/wait.h>
|
||||
#endif
|
||||
#include "net.h"
|
||||
#include "net/net.h"
|
||||
#include "clients.h"
|
||||
#include "hub.h"
|
||||
#include "monitor.h"
|
||||
#include "qemu_socket.h"
|
||||
#include "monitor/monitor.h"
|
||||
#include "qemu/sockets.h"
|
||||
#include "slirp/libslirp.h"
|
||||
#include "char/char.h"
|
||||
|
||||
static int get_str_sep(char *buf, int buf_size, const char **pp, int sep)
|
||||
{
|
||||
|
|
47
net/slirp.h
47
net/slirp.h
|
@ -1,47 +0,0 @@
|
|||
/*
|
||||
* QEMU System Emulator
|
||||
*
|
||||
* Copyright (c) 2003-2008 Fabrice Bellard
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
#ifndef QEMU_NET_SLIRP_H
|
||||
#define QEMU_NET_SLIRP_H
|
||||
|
||||
#include "qemu-common.h"
|
||||
#include "qdict.h"
|
||||
#include "qemu-option.h"
|
||||
#include "qapi-types.h"
|
||||
|
||||
#ifdef CONFIG_SLIRP
|
||||
|
||||
void net_slirp_hostfwd_add(Monitor *mon, const QDict *qdict);
|
||||
void net_slirp_hostfwd_remove(Monitor *mon, const QDict *qdict);
|
||||
|
||||
int net_slirp_redir(const char *redir_str);
|
||||
|
||||
int net_slirp_parse_legacy(QemuOptsList *opts_list, const char *optarg, int *ret);
|
||||
|
||||
int net_slirp_smb(const char *exported_dir);
|
||||
|
||||
void do_info_usernet(Monitor *mon);
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* QEMU_NET_SLIRP_H */
|
13
net/socket.c
13
net/socket.c
|
@ -23,15 +23,14 @@
|
|||
*/
|
||||
#include "config-host.h"
|
||||
|
||||
#include "net.h"
|
||||
#include "net/net.h"
|
||||
#include "clients.h"
|
||||
#include "monitor.h"
|
||||
#include "qemu-char.h"
|
||||
#include "monitor/monitor.h"
|
||||
#include "qemu-common.h"
|
||||
#include "qemu-error.h"
|
||||
#include "qemu-option.h"
|
||||
#include "qemu_socket.h"
|
||||
#include "iov.h"
|
||||
#include "qemu/error-report.h"
|
||||
#include "qemu/option.h"
|
||||
#include "qemu/sockets.h"
|
||||
#include "qemu/iov.h"
|
||||
|
||||
typedef struct NetSocketState {
|
||||
NetClientState nc;
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "net/tap.h"
|
||||
#include "tap_int.h"
|
||||
#include <stdio.h>
|
||||
|
||||
int tap_open(char *ifname, int ifname_size, int *vnet_hdr, int vnet_hdr_required)
|
||||
|
|
|
@ -22,10 +22,10 @@
|
|||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "net/tap.h"
|
||||
#include "tap_int.h"
|
||||
#include "qemu-common.h"
|
||||
#include "sysemu.h"
|
||||
#include "qemu-error.h"
|
||||
#include "sysemu/sysemu.h"
|
||||
#include "qemu/error-report.h"
|
||||
|
||||
#ifdef __NetBSD__
|
||||
#include <sys/ioctl.h>
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "net/tap.h"
|
||||
#include "tap_int.h"
|
||||
#include <stdio.h>
|
||||
|
||||
int tap_open(char *ifname, int ifname_size, int *vnet_hdr, int vnet_hdr_required)
|
||||
|
|
|
@ -23,15 +23,16 @@
|
|||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "tap_int.h"
|
||||
#include "tap-linux.h"
|
||||
#include "net/tap.h"
|
||||
#include "net/tap-linux.h"
|
||||
|
||||
#include <net/if.h>
|
||||
#include <sys/ioctl.h>
|
||||
|
||||
#include "sysemu.h"
|
||||
#include "sysemu/sysemu.h"
|
||||
#include "qemu-common.h"
|
||||
#include "qemu-error.h"
|
||||
#include "qemu/error-report.h"
|
||||
|
||||
#define PATH_NET_TUN "/dev/net/tun"
|
||||
|
||||
|
@ -39,6 +40,7 @@ int tap_open(char *ifname, int ifname_size, int *vnet_hdr, int vnet_hdr_required
|
|||
{
|
||||
struct ifreq ifr;
|
||||
int fd, ret;
|
||||
int len = sizeof(struct virtio_net_hdr);
|
||||
|
||||
TFR(fd = open(PATH_NET_TUN, O_RDWR));
|
||||
if (fd < 0) {
|
||||
|
@ -65,6 +67,13 @@ int tap_open(char *ifname, int ifname_size, int *vnet_hdr, int vnet_hdr_required
|
|||
close(fd);
|
||||
return -1;
|
||||
}
|
||||
/*
|
||||
* Make sure vnet header size has the default value: for a persistent
|
||||
* tap it might have been modified e.g. by another instance of qemu.
|
||||
* Ignore errors since old kernels do not support this ioctl: in this
|
||||
* case the header size implicitly has the correct value.
|
||||
*/
|
||||
ioctl(fd, TUNSETVNETHDRSZ, &len);
|
||||
}
|
||||
|
||||
if (ifname[0] != '\0')
|
||||
|
|
|
@ -13,8 +13,8 @@
|
|||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#ifndef QEMU_TAP_H
|
||||
#define QEMU_TAP_H
|
||||
#ifndef QEMU_TAP_LINUX_H
|
||||
#define QEMU_TAP_LINUX_H
|
||||
|
||||
#include <stdint.h>
|
||||
#ifdef __linux__
|
||||
|
@ -44,20 +44,4 @@
|
|||
#define TUN_F_TSO_ECN 0x08 /* I can handle TSO with ECN bits. */
|
||||
#define TUN_F_UFO 0x10 /* I can handle UFO packets */
|
||||
|
||||
struct virtio_net_hdr
|
||||
{
|
||||
uint8_t flags;
|
||||
uint8_t gso_type;
|
||||
uint16_t hdr_len;
|
||||
uint16_t gso_size;
|
||||
uint16_t csum_start;
|
||||
uint16_t csum_offset;
|
||||
};
|
||||
|
||||
struct virtio_net_hdr_mrg_rxbuf
|
||||
{
|
||||
struct virtio_net_hdr hdr;
|
||||
uint16_t num_buffers; /* Number of merged rx buffers */
|
||||
};
|
||||
|
||||
#endif /* QEMU_TAP_H */
|
||||
|
|
|
@ -22,8 +22,8 @@
|
|||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "net/tap.h"
|
||||
#include "sysemu.h"
|
||||
#include "tap_int.h"
|
||||
#include "sysemu/sysemu.h"
|
||||
|
||||
#include <sys/stat.h>
|
||||
#include <sys/ethernet.h>
|
||||
|
@ -38,7 +38,7 @@
|
|||
#include <net/if.h>
|
||||
#include <syslog.h>
|
||||
#include <stropts.h>
|
||||
#include "qemu-error.h"
|
||||
#include "qemu/error-report.h"
|
||||
|
||||
ssize_t tap_read_packet(int tapfd, uint8_t *buf, int maxlen)
|
||||
{
|
||||
|
|
|
@ -26,13 +26,13 @@
|
|||
* distribution); if not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "tap.h"
|
||||
#include "tap_int.h"
|
||||
|
||||
#include "qemu-common.h"
|
||||
#include "clients.h" /* net_init_tap */
|
||||
#include "net.h"
|
||||
#include "sysemu.h"
|
||||
#include "qemu-error.h"
|
||||
#include "net/net.h"
|
||||
#include "sysemu/sysemu.h"
|
||||
#include "qemu/error-report.h"
|
||||
#include <stdio.h>
|
||||
#include <windows.h>
|
||||
#include <winioctl.h>
|
||||
|
|
13
net/tap.c
13
net/tap.c
|
@ -23,7 +23,7 @@
|
|||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "tap.h"
|
||||
#include "tap_int.h"
|
||||
|
||||
#include "config-host.h"
|
||||
|
||||
|
@ -33,15 +33,14 @@
|
|||
#include <sys/socket.h>
|
||||
#include <net/if.h>
|
||||
|
||||
#include "net.h"
|
||||
#include "net/net.h"
|
||||
#include "clients.h"
|
||||
#include "monitor.h"
|
||||
#include "sysemu.h"
|
||||
#include "qemu-char.h"
|
||||
#include "monitor/monitor.h"
|
||||
#include "sysemu/sysemu.h"
|
||||
#include "qemu-common.h"
|
||||
#include "qemu-error.h"
|
||||
#include "qemu/error-report.h"
|
||||
|
||||
#include "net/tap-linux.h"
|
||||
#include "net/tap.h"
|
||||
|
||||
#include "hw/vhost_net.h"
|
||||
|
||||
|
|
|
@ -23,8 +23,8 @@
|
|||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef QEMU_NET_TAP_H
|
||||
#define QEMU_NET_TAP_H
|
||||
#ifndef QEMU_TAP_H
|
||||
#define QEMU_TAP_H
|
||||
|
||||
#include "qemu-common.h"
|
||||
#include "qapi-types.h"
|
||||
|
@ -36,13 +36,6 @@ int tap_open(char *ifname, int ifname_size, int *vnet_hdr, int vnet_hdr_required
|
|||
|
||||
ssize_t tap_read_packet(int tapfd, uint8_t *buf, int maxlen);
|
||||
|
||||
int tap_has_ufo(NetClientState *nc);
|
||||
int tap_has_vnet_hdr(NetClientState *nc);
|
||||
int tap_has_vnet_hdr_len(NetClientState *nc, int len);
|
||||
void tap_using_vnet_hdr(NetClientState *nc, int using_vnet_hdr);
|
||||
void tap_set_offload(NetClientState *nc, int csum, int tso4, int tso6, int ecn, int ufo);
|
||||
void tap_set_vnet_hdr_len(NetClientState *nc, int len);
|
||||
|
||||
int tap_set_sndbuf(int fd, const NetdevTapOptions *tap);
|
||||
int tap_probe_vnet_hdr(int fd);
|
||||
int tap_probe_vnet_hdr_len(int fd, int len);
|
||||
|
@ -50,9 +43,4 @@ int tap_probe_has_ufo(int fd);
|
|||
void tap_fd_set_offload(int fd, int csum, int tso4, int tso6, int ecn, int ufo);
|
||||
void tap_fd_set_vnet_hdr_len(int fd, int len);
|
||||
|
||||
int tap_get_fd(NetClientState *nc);
|
||||
|
||||
struct vhost_net;
|
||||
struct vhost_net *tap_get_vhost_net(NetClientState *nc);
|
||||
|
||||
#endif /* QEMU_NET_TAP_H */
|
||||
#endif /* QEMU_TAP_H */
|
|
@ -22,7 +22,7 @@
|
|||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "net/util.h"
|
||||
#include "util.h"
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
|
|
|
@ -25,11 +25,10 @@
|
|||
|
||||
#include <libvdeplug.h>
|
||||
|
||||
#include "net.h"
|
||||
#include "net/net.h"
|
||||
#include "clients.h"
|
||||
#include "qemu-char.h"
|
||||
#include "qemu-common.h"
|
||||
#include "qemu-option.h"
|
||||
#include "qemu/option.h"
|
||||
|
||||
typedef struct VDEState {
|
||||
NetClientState nc;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue