* [PATCH 1/5] kvm tools: Abolishment of uint*_t types
@ 2011-05-05 18:34 Sasha Levin
2011-05-05 18:34 ` [PATCH 2/5] kvm tools: virtio-blk code cleanup Sasha Levin
` (4 more replies)
0 siblings, 5 replies; 7+ messages in thread
From: Sasha Levin @ 2011-05-05 18:34 UTC (permalink / raw)
To: penberg; +Cc: mingo, asias.hejun, gorcunov, prasadjoshi124, kvm, Sasha Levin
Clean uint*_t type from the code.
Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
---
tools/kvm/8250-serial.c | 41 ++++++++++++-----------
tools/kvm/bios/e820.c | 16 +++++-----
tools/kvm/disk-image.c | 24 +++++++-------
tools/kvm/include/kvm/cpufeature.h | 8 ++--
tools/kvm/include/kvm/disk-image.h | 24 +++++++-------
tools/kvm/include/kvm/e820.h | 18 +++++-----
tools/kvm/include/kvm/interrupt.h | 6 ++--
tools/kvm/include/kvm/ioport.h | 21 ++++++------
tools/kvm/include/kvm/kvm-cpu.h | 1 -
tools/kvm/include/kvm/kvm.h | 20 ++++++------
tools/kvm/include/kvm/pci.h | 62 ++++++++++++++++++------------------
tools/kvm/include/kvm/qcow.h | 2 +-
tools/kvm/include/kvm/segment.h | 6 ++--
tools/kvm/include/kvm/threadpool.h | 2 -
tools/kvm/include/kvm/virtio.h | 16 +++++-----
tools/kvm/include/linux/types.h | 14 +-------
tools/kvm/ioport.c | 15 +++++----
tools/kvm/kvm-cpu.c | 46 +++++++++++++-------------
tools/kvm/kvm-run.c | 4 +--
tools/kvm/kvm.c | 3 +-
tools/kvm/mmio.c | 7 ++--
tools/kvm/pci.c | 17 +++++-----
tools/kvm/qcow.c | 6 ++--
tools/kvm/rtc.c | 10 +++---
tools/kvm/util/parse-options.c | 1 -
tools/kvm/virtio/blk.c | 26 +++++++-------
tools/kvm/virtio/console.c | 43 ++++++++++++-------------
tools/kvm/virtio/core.c | 8 ++--
tools/kvm/virtio/net.c | 30 +++++++++---------
tools/kvm/virtio/rng.c | 15 ++++-----
30 files changed, 247 insertions(+), 265 deletions(-)
diff --git a/tools/kvm/8250-serial.c b/tools/kvm/8250-serial.c
index 6d4b216..4892599 100644
--- a/tools/kvm/8250-serial.c
+++ b/tools/kvm/8250-serial.c
@@ -7,6 +7,7 @@
#include "kvm/term.h"
#include "kvm/kvm.h"
+#include <linux/types.h>
#include <linux/serial_reg.h>
#include <pthread.h>
@@ -14,20 +15,20 @@
struct serial8250_device {
pthread_mutex_t mutex;
- uint16_t iobase;
- uint8_t irq;
-
- uint8_t rbr; /* receive buffer */
- uint8_t dll;
- uint8_t dlm;
- uint8_t iir;
- uint8_t ier;
- uint8_t fcr;
- uint8_t lcr;
- uint8_t mcr;
- uint8_t lsr;
- uint8_t msr;
- uint8_t scr;
+ u16 iobase;
+ u8 irq;
+
+ u8 rbr; /* receive buffer */
+ u8 dll;
+ u8 dlm;
+ u8 iir;
+ u8 ier;
+ u8 fcr;
+ u8 lcr;
+ u8 mcr;
+ u8 lsr;
+ u8 msr;
+ u8 scr;
};
static struct serial8250_device devices[] = {
@@ -141,7 +142,7 @@ void serial8250__inject_sysrq(struct kvm *self)
sysrq_pending = SYSRQ_PENDING_BREAK;
}
-static struct serial8250_device *find_device(uint16_t port)
+static struct serial8250_device *find_device(u16 port)
{
unsigned int i;
@@ -154,10 +155,10 @@ static struct serial8250_device *find_device(uint16_t port)
return NULL;
}
-static bool serial8250_out(struct kvm *self, uint16_t port, void *data, int size, uint32_t count)
+static bool serial8250_out(struct kvm *self, u16 port, void *data, int size, u32 count)
{
struct serial8250_device *dev;
- uint16_t offset;
+ u16 offset;
bool ret = true;
dev = find_device(port);
@@ -242,10 +243,10 @@ out_unlock:
return ret;
}
-static bool serial8250_in(struct kvm *self, uint16_t port, void *data, int size, uint32_t count)
+static bool serial8250_in(struct kvm *self, u16 port, void *data, int size, u32 count)
{
struct serial8250_device *dev;
- uint16_t offset;
+ u16 offset;
bool ret = true;
dev = find_device(port);
@@ -288,7 +289,7 @@ static bool serial8250_in(struct kvm *self, uint16_t port, void *data, int size,
switch (offset) {
case UART_IIR: {
- uint8_t iir = dev->iir;
+ u8 iir = dev->iir;
if (dev->fcr & UART_FCR_ENABLE_FIFO)
iir |= 0xc0;
diff --git a/tools/kvm/bios/e820.c b/tools/kvm/bios/e820.c
index baa2c5b..e4d8354 100644
--- a/tools/kvm/bios/e820.c
+++ b/tools/kvm/bios/e820.c
@@ -4,25 +4,25 @@
#include "kvm/bios.h"
#include "kvm/util.h"
-static inline void set_fs(uint16_t seg)
+static inline void set_fs(u16 seg)
{
asm volatile("movw %0,%%fs" : : "rm" (seg));
}
-static inline uint8_t rdfs8(unsigned long addr)
+static inline u8 rdfs8(unsigned long addr)
{
- uint8_t v;
+ u8 v;
- asm volatile("addr32 movb %%fs:%1,%0" : "=q" (v) : "m" (*(uint8_t *)addr));
+ asm volatile("addr32 movb %%fs:%1,%0" : "=q" (v) : "m" (*(u8 *)addr));
return v;
}
bioscall void e820_query_map(struct e820_query *query)
{
- uint8_t map_size;
- uint16_t fs_seg;
- uint32_t ndx;
+ u8 map_size;
+ u16 fs_seg;
+ u32 ndx;
fs_seg = flat_to_seg16(E820_MAP_SIZE);
set_fs(fs_seg);
@@ -34,7 +34,7 @@ bioscall void e820_query_map(struct e820_query *query)
if (ndx < map_size) {
unsigned long start;
unsigned int i;
- uint8_t *p;
+ u8 *p;
fs_seg = flat_to_seg16(E820_MAP_START);
set_fs(fs_seg);
diff --git a/tools/kvm/disk-image.c b/tools/kvm/disk-image.c
index 0fb2083..e44ee02 100644
--- a/tools/kvm/disk-image.c
+++ b/tools/kvm/disk-image.c
@@ -8,7 +8,7 @@
#include <sys/ioctl.h>
#include <sys/types.h>
-#include <inttypes.h>
+#include <linux/types.h>
#include <sys/mman.h>
#include <sys/stat.h>
#include <stdbool.h>
@@ -17,7 +17,7 @@
#include <unistd.h>
#include <fcntl.h>
-struct disk_image *disk_image__new(int fd, uint64_t size, struct disk_image_operations *ops)
+struct disk_image *disk_image__new(int fd, u64 size, struct disk_image_operations *ops)
{
struct disk_image *self;
@@ -31,7 +31,7 @@ struct disk_image *disk_image__new(int fd, uint64_t size, struct disk_image_oper
return self;
}
-struct disk_image *disk_image__new_readonly(int fd, uint64_t size, struct disk_image_operations *ops)
+struct disk_image *disk_image__new_readonly(int fd, u64 size, struct disk_image_operations *ops)
{
struct disk_image *self;
@@ -45,23 +45,23 @@ struct disk_image *disk_image__new_readonly(int fd, uint64_t size, struct disk_i
return self;
}
-static ssize_t raw_image__read_sector_iov(struct disk_image *self, uint64_t sector, const struct iovec *iov, int iovcount)
+static ssize_t raw_image__read_sector_iov(struct disk_image *self, u64 sector, const struct iovec *iov, int iovcount)
{
- uint64_t offset = sector << SECTOR_SHIFT;
+ u64 offset = sector << SECTOR_SHIFT;
return preadv_in_full(self->fd, iov, iovcount, offset);
}
-static ssize_t raw_image__write_sector_iov(struct disk_image *self, uint64_t sector, const struct iovec *iov, int iovcount)
+static ssize_t raw_image__write_sector_iov(struct disk_image *self, u64 sector, const struct iovec *iov, int iovcount)
{
- uint64_t offset = sector << SECTOR_SHIFT;
+ u64 offset = sector << SECTOR_SHIFT;
return pwritev_in_full(self->fd, iov, iovcount, offset);
}
-static int raw_image__read_sector_ro_mmap(struct disk_image *self, uint64_t sector, void *dst, uint32_t dst_len)
+static int raw_image__read_sector_ro_mmap(struct disk_image *self, u64 sector, void *dst, u32 dst_len)
{
- uint64_t offset = sector << SECTOR_SHIFT;
+ u64 offset = sector << SECTOR_SHIFT;
if (offset + dst_len > self->size)
return -1;
@@ -71,9 +71,9 @@ static int raw_image__read_sector_ro_mmap(struct disk_image *self, uint64_t sect
return 0;
}
-static int raw_image__write_sector_ro_mmap(struct disk_image *self, uint64_t sector, void *src, uint32_t src_len)
+static int raw_image__write_sector_ro_mmap(struct disk_image *self, u64 sector, void *src, u32 src_len)
{
- uint64_t offset = sector << SECTOR_SHIFT;
+ u64 offset = sector << SECTOR_SHIFT;
if (offset + src_len > self->size)
return -1;
@@ -110,7 +110,7 @@ static struct disk_image *raw_image__probe(int fd, struct stat *st, bool readonl
static struct disk_image *blkdev__probe(const char *filename, struct stat *st)
{
- uint64_t size;
+ u64 size;
int fd;
if (!S_ISBLK(st->st_mode))
diff --git a/tools/kvm/include/kvm/cpufeature.h b/tools/kvm/include/kvm/cpufeature.h
index 92abb87..bc4abbb 100644
--- a/tools/kvm/include/kvm/cpufeature.h
+++ b/tools/kvm/include/kvm/cpufeature.h
@@ -22,10 +22,10 @@
((reg) | (1 << (feature)))
struct cpuid_regs {
- uint32_t eax;
- uint32_t ebx;
- uint32_t ecx;
- uint32_t edx;
+ u32 eax;
+ u32 ebx;
+ u32 ecx;
+ u32 edx;
};
static inline void host_cpuid(struct cpuid_regs *regs)
diff --git a/tools/kvm/include/kvm/disk-image.h b/tools/kvm/include/kvm/disk-image.h
index 11823c6..660a539 100644
--- a/tools/kvm/include/kvm/disk-image.h
+++ b/tools/kvm/include/kvm/disk-image.h
@@ -1,7 +1,7 @@
#ifndef KVM__DISK_IMAGE_H
#define KVM__DISK_IMAGE_H
-#include <stdint.h>
+#include <linux/types.h>
#include <stdbool.h>
#include <sys/uio.h>
@@ -11,36 +11,36 @@
struct disk_image;
struct disk_image_operations {
- int (*read_sector)(struct disk_image *self, uint64_t sector, void *dst, uint32_t dst_len);
- int (*write_sector)(struct disk_image *self, uint64_t sector, void *src, uint32_t src_len);
- ssize_t (*read_sector_iov)(struct disk_image *self, uint64_t sector, const struct iovec *iov, int iovcount);
- ssize_t (*write_sector_iov)(struct disk_image *self, uint64_t sector, const struct iovec *iov, int iovcount);
+ int (*read_sector)(struct disk_image *self, u64 sector, void *dst, u32 dst_len);
+ int (*write_sector)(struct disk_image *self, u64 sector, void *src, u32 src_len);
+ ssize_t (*read_sector_iov)(struct disk_image *self, u64 sector, const struct iovec *iov, int iovcount);
+ ssize_t (*write_sector_iov)(struct disk_image *self, u64 sector, const struct iovec *iov, int iovcount);
void (*close)(struct disk_image *self);
};
struct disk_image {
int fd;
- uint64_t size;
+ u64 size;
struct disk_image_operations *ops;
void *priv;
};
struct disk_image *disk_image__open(const char *filename, bool readonly);
-struct disk_image *disk_image__new(int fd, uint64_t size, struct disk_image_operations *ops);
-struct disk_image *disk_image__new_readonly(int fd, uint64_t size, struct disk_image_operations *ops);
+struct disk_image *disk_image__new(int fd, u64 size, struct disk_image_operations *ops);
+struct disk_image *disk_image__new_readonly(int fd, u64 size, struct disk_image_operations *ops);
void disk_image__close(struct disk_image *self);
-static inline int disk_image__read_sector(struct disk_image *self, uint64_t sector, void *dst, uint32_t dst_len)
+static inline int disk_image__read_sector(struct disk_image *self, u64 sector, void *dst, u32 dst_len)
{
return self->ops->read_sector(self, sector, dst, dst_len);
}
-static inline int disk_image__write_sector(struct disk_image *self, uint64_t sector, void *src, uint32_t src_len)
+static inline int disk_image__write_sector(struct disk_image *self, u64 sector, void *src, u32 src_len)
{
return self->ops->write_sector(self, sector, src, src_len);
}
-static inline ssize_t disk_image__read_sector_iov(struct disk_image *self, uint64_t sector, const struct iovec *iov, int iovcount)
+static inline ssize_t disk_image__read_sector_iov(struct disk_image *self, u64 sector, const struct iovec *iov, int iovcount)
{
if (self->ops->read_sector_iov)
return self->ops->read_sector_iov(self, sector, iov, iovcount);
@@ -54,7 +54,7 @@ static inline ssize_t disk_image__read_sector_iov(struct disk_image *self, uint6
return sector << SECTOR_SHIFT;
}
-static inline ssize_t disk_image__write_sector_iov(struct disk_image *self, uint64_t sector, const struct iovec *iov, int iovcount)
+static inline ssize_t disk_image__write_sector_iov(struct disk_image *self, u64 sector, const struct iovec *iov, int iovcount)
{
if (self->ops->write_sector_iov)
return self->ops->write_sector_iov(self, sector, iov, iovcount);
diff --git a/tools/kvm/include/kvm/e820.h b/tools/kvm/include/kvm/e820.h
index 7482eb5..252ae1f 100644
--- a/tools/kvm/include/kvm/e820.h
+++ b/tools/kvm/include/kvm/e820.h
@@ -1,7 +1,7 @@
#ifndef KVM_E820_H
#define KVM_E820_H
-#include <stdint.h>
+#include <linux/types.h>
#define SMAP 0x534d4150 /* ASCII "SMAP" */
@@ -11,17 +11,17 @@
#define E820_MEM_AREAS 4
struct e820_entry {
- uint64_t addr; /* start of memory segment */
- uint64_t size; /* size of memory segment */
- uint32_t type; /* type of memory segment */
+ u64 addr; /* start of memory segment */
+ u64 size; /* size of memory segment */
+ u32 type; /* type of memory segment */
} __attribute__((packed));
struct e820_query {
- uint32_t eax;
- uint32_t ebx;
- uint32_t edi;
- uint32_t ecx;
- uint32_t edx;
+ u32 eax;
+ u32 ebx;
+ u32 edi;
+ u32 ecx;
+ u32 edx;
};
void e820_query_map(struct e820_query *query);
diff --git a/tools/kvm/include/kvm/interrupt.h b/tools/kvm/include/kvm/interrupt.h
index 0169bba..b9610ea 100644
--- a/tools/kvm/include/kvm/interrupt.h
+++ b/tools/kvm/include/kvm/interrupt.h
@@ -1,13 +1,13 @@
#ifndef KVM__INTERRUPT_H
#define KVM__INTERRUPT_H
-#include <inttypes.h>
+#include <linux/types.h>
#include "kvm/bios.h"
#include "kvm/bios-export.h"
struct real_intr_desc {
- uint16_t offset;
- uint16_t segment;
+ u16 offset;
+ u16 segment;
} __attribute__((packed));
#define REAL_SEGMENT_SHIFT 4
diff --git a/tools/kvm/include/kvm/ioport.h b/tools/kvm/include/kvm/ioport.h
index 98a880f..aa5d73f 100644
--- a/tools/kvm/include/kvm/ioport.h
+++ b/tools/kvm/include/kvm/ioport.h
@@ -2,7 +2,8 @@
#define KVM__IOPORT_H
#include <stdbool.h>
-#include <stdint.h>
+#include <asm/types.h>
+#include <linux/types.h>
/* some ports we reserve for own use */
#define IOPORT_DBG 0xe0
@@ -18,40 +19,40 @@
struct kvm;
struct ioport_operations {
- bool (*io_in)(struct kvm *self, uint16_t port, void *data, int size, uint32_t count);
- bool (*io_out)(struct kvm *self, uint16_t port, void *data, int size, uint32_t count);
+ bool (*io_in)(struct kvm *self, u16 port, void *data, int size, u32 count);
+ bool (*io_out)(struct kvm *self, u16 port, void *data, int size, u32 count);
};
void ioport__setup_legacy(void);
-void ioport__register(uint16_t port, struct ioport_operations *ops, int count);
+void ioport__register(u16 port, struct ioport_operations *ops, int count);
-static inline uint8_t ioport__read8(uint8_t *data)
+static inline u8 ioport__read8(u8 *data)
{
return *data;
}
-static inline uint16_t ioport__read16(uint16_t *data)
+static inline u16 ioport__read16(u16 *data)
{
return *data;
}
-static inline uint32_t ioport__read32(uint32_t *data)
+static inline u32 ioport__read32(u32 *data)
{
return *data;
}
-static inline void ioport__write8(uint8_t *data, uint8_t value)
+static inline void ioport__write8(u8 *data, u8 value)
{
*data = value;
}
-static inline void ioport__write16(uint16_t *data, uint16_t value)
+static inline void ioport__write16(u16 *data, u16 value)
{
*data = value;
}
-static inline void ioport__write32(uint32_t *data, uint32_t value)
+static inline void ioport__write32(u32 *data, u32 value)
{
*data = value;
}
diff --git a/tools/kvm/include/kvm/kvm-cpu.h b/tools/kvm/include/kvm/kvm-cpu.h
index 0d0881e..18d787f 100644
--- a/tools/kvm/include/kvm/kvm-cpu.h
+++ b/tools/kvm/include/kvm/kvm-cpu.h
@@ -4,7 +4,6 @@
#include <linux/kvm.h> /* for struct kvm_regs */
#include <pthread.h>
-#include <stdint.h>
struct kvm;
diff --git a/tools/kvm/include/kvm/kvm.h b/tools/kvm/include/kvm/kvm.h
index d239f49..f697579 100644
--- a/tools/kvm/include/kvm/kvm.h
+++ b/tools/kvm/include/kvm/kvm.h
@@ -4,7 +4,7 @@
#include "kvm/interrupt.h"
#include <stdbool.h>
-#include <stdint.h>
+#include <linux/types.h>
#include <time.h>
#define KVM_NR_CPUS (255)
@@ -16,14 +16,14 @@ struct kvm {
int nrcpus; /* Number of cpus to run */
- uint64_t ram_size;
+ u64 ram_size;
void *ram_start;
bool nmi_disabled;
- uint16_t boot_selector;
- uint16_t boot_ip;
- uint16_t boot_sp;
+ u16 boot_selector;
+ u16 boot_ip;
+ u16 boot_sp;
struct interrupt_table interrupt_table;
};
@@ -37,8 +37,8 @@ void kvm__setup_bios(struct kvm *self);
void kvm__start_timer(struct kvm *self);
void kvm__stop_timer(struct kvm *self);
void kvm__irq_line(struct kvm *self, int irq, int level);
-bool kvm__emulate_io(struct kvm *self, uint16_t port, void *data, int direction, int size, uint32_t count);
-bool kvm__emulate_mmio(struct kvm *self, uint64_t phys_addr, uint8_t *data, uint32_t len, uint8_t is_write);
+bool kvm__emulate_io(struct kvm *self, u16 port, void *data, int direction, int size, u32 count);
+bool kvm__emulate_mmio(struct kvm *self, u64 phys_addr, u8 *data, u32 len, u8 is_write);
/*
* Debugging
@@ -52,9 +52,9 @@ static inline bool host_ptr_in_ram(struct kvm *self, void *p)
return self->ram_start <= p && p < (self->ram_start + self->ram_size);
}
-static inline uint32_t segment_to_flat(uint16_t selector, uint16_t offset)
+static inline u32 segment_to_flat(u16 selector, u16 offset)
{
- return ((uint32_t)selector << 4) + (uint32_t) offset;
+ return ((u32)selector << 4) + (u32) offset;
}
static inline void *guest_flat_to_host(struct kvm *self, unsigned long offset)
@@ -62,7 +62,7 @@ static inline void *guest_flat_to_host(struct kvm *self, unsigned long offset)
return self->ram_start + offset;
}
-static inline void *guest_real_to_host(struct kvm *self, uint16_t selector, uint16_t offset)
+static inline void *guest_real_to_host(struct kvm *self, u16 selector, u16 offset)
{
unsigned long flat = segment_to_flat(selector, offset);
diff --git a/tools/kvm/include/kvm/pci.h b/tools/kvm/include/kvm/pci.h
index c352803..6ad4426 100644
--- a/tools/kvm/include/kvm/pci.h
+++ b/tools/kvm/include/kvm/pci.h
@@ -1,7 +1,7 @@
#ifndef KVM__PCI_H
#define KVM__PCI_H
-#include <inttypes.h>
+#include <linux/types.h>
#include <linux/pci_regs.h>
@@ -15,41 +15,41 @@
#define PCI_CONFIG_BUS_FORWARD 0xcfa
struct pci_config_address {
- unsigned zeros : 2; /* 1 .. 0 */
- unsigned register_number : 6; /* 7 .. 2 */
- unsigned function_number : 3; /* 10 .. 8 */
- unsigned device_number : 5; /* 15 .. 11 */
- unsigned bus_number : 8; /* 23 .. 16 */
- unsigned reserved : 7; /* 30 .. 24 */
- unsigned enable_bit : 1; /* 31 */
+ unsigned zeros : 2; /* 1 .. 0 */
+ unsigned register_number : 6; /* 7 .. 2 */
+ unsigned function_number : 3; /* 10 .. 8 */
+ unsigned device_number : 5; /* 15 .. 11 */
+ unsigned bus_number : 8; /* 23 .. 16 */
+ unsigned reserved : 7; /* 30 .. 24 */
+ unsigned enable_bit : 1; /* 31 */
};
struct pci_device_header {
- uint16_t vendor_id;
- uint16_t device_id;
- uint16_t command;
- uint16_t status;
- uint16_t revision_id : 8;
- uint32_t class : 24;
- uint8_t cacheline_size;
- uint8_t latency_timer;
- uint8_t header_type;
- uint8_t bist;
- uint32_t bar[6];
- uint32_t card_bus;
- uint16_t subsys_vendor_id;
- uint16_t subsys_id;
- uint32_t exp_rom_bar;
- uint32_t capabilities : 8;
- uint32_t reserved1 : 24;
- uint32_t reserved2;
- uint8_t irq_line;
- uint8_t irq_pin;
- uint8_t min_gnt;
- uint8_t max_lat;
+ u16 vendor_id;
+ u16 device_id;
+ u16 command;
+ u16 status;
+ u16 revision_id : 8;
+ u32 class : 24;
+ u8 cacheline_size;
+ u8 latency_timer;
+ u8 header_type;
+ u8 bist;
+ u32 bar[6];
+ u32 card_bus;
+ u16 subsys_vendor_id;
+ u16 subsys_id;
+ u32 exp_rom_bar;
+ u32 capabilities : 8;
+ u32 reserved1 : 24;
+ u32 reserved2;
+ u8 irq_line;
+ u8 irq_pin;
+ u8 min_gnt;
+ u8 max_lat;
};
void pci__init(void);
-void pci__register(struct pci_device_header *dev, uint8_t dev_num);
+void pci__register(struct pci_device_header *dev, u8 dev_num);
#endif /* KVM__PCI_H */
diff --git a/tools/kvm/include/kvm/qcow.h b/tools/kvm/include/kvm/qcow.h
index afd776d8..3d84aad 100644
--- a/tools/kvm/include/kvm/qcow.h
+++ b/tools/kvm/include/kvm/qcow.h
@@ -33,7 +33,7 @@ struct qcow_header {
u32 l1_size;
u8 cluster_bits;
u8 l2_bits;
- uint64_t oflag_mask;
+ u64 oflag_mask;
};
struct qcow1_header_disk {
diff --git a/tools/kvm/include/kvm/segment.h b/tools/kvm/include/kvm/segment.h
index 0701cd7..362e46d 100644
--- a/tools/kvm/include/kvm/segment.h
+++ b/tools/kvm/include/kvm/segment.h
@@ -1,14 +1,14 @@
#ifndef KVM_SEGMENT_H
#define KVM_SEGMENT_H
-#include <stdint.h>
+#include <linux/types.h>
-static inline uint16_t flat_to_seg16(uint32_t address)
+static inline u16 flat_to_seg16(u32 address)
{
return address >> 4;
}
-static inline uint16_t flat_to_off16(uint32_t address, uint32_t segment)
+static inline u16 flat_to_off16(u32 address, u32 segment)
{
return address - (segment << 4);
}
diff --git a/tools/kvm/include/kvm/threadpool.h b/tools/kvm/include/kvm/threadpool.h
index 4716411..62826a6 100644
--- a/tools/kvm/include/kvm/threadpool.h
+++ b/tools/kvm/include/kvm/threadpool.h
@@ -1,8 +1,6 @@
#ifndef KVM__THREADPOOL_H
#define KVM__THREADPOOL_H
-#include <stdint.h>
-
struct kvm;
typedef void (*kvm_thread_callback_fn_t)(struct kvm *kvm, void *data);
diff --git a/tools/kvm/include/kvm/virtio.h b/tools/kvm/include/kvm/virtio.h
index 7903a74..e8df8eb 100644
--- a/tools/kvm/include/kvm/virtio.h
+++ b/tools/kvm/include/kvm/virtio.h
@@ -3,25 +3,25 @@
#include <linux/virtio_ring.h>
-#include <stdint.h>
+#include <linux/types.h>
#include <sys/uio.h>
#include "kvm/kvm.h"
struct virt_queue {
- struct vring vring;
- uint32_t pfn;
+ struct vring vring;
+ u32 pfn;
/* The last_avail_idx field is an index to ->ring of struct vring_avail.
It's where we assume the next request index is at. */
- uint16_t last_avail_idx;
+ u16 last_avail_idx;
};
-static inline uint16_t virt_queue__pop(struct virt_queue *queue)
+static inline u16 virt_queue__pop(struct virt_queue *queue)
{
return queue->vring.avail->ring[queue->last_avail_idx++ % queue->vring.num];
}
-static inline struct vring_desc *virt_queue__get_desc(struct virt_queue *queue, uint16_t desc_ndx)
+static inline struct vring_desc *virt_queue__get_desc(struct virt_queue *queue, u16 desc_ndx)
{
return &queue->vring.desc[desc_ndx];
}
@@ -33,8 +33,8 @@ static inline bool virt_queue__available(struct virt_queue *vq)
return vq->vring.avail->idx != vq->last_avail_idx;
}
-struct vring_used_elem *virt_queue__set_used_elem(struct virt_queue *queue, uint32_t head, uint32_t len);
+struct vring_used_elem *virt_queue__set_used_elem(struct virt_queue *queue, u32 head, u32 len);
-uint16_t virt_queue__get_iov(struct virt_queue *queue, struct iovec iov[], uint16_t *out, uint16_t *in, struct kvm *kvm);
+u16 virt_queue__get_iov(struct virt_queue *queue, struct iovec iov[], u16 *out, u16 *in, struct kvm *kvm);
#endif /* KVM__VIRTIO_H */
diff --git a/tools/kvm/include/linux/types.h b/tools/kvm/include/linux/types.h
index c7c444e..6feb6da 100644
--- a/tools/kvm/include/linux/types.h
+++ b/tools/kvm/include/linux/types.h
@@ -1,19 +1,7 @@
#ifndef LINUX_TYPES_H
#define LINUX_TYPES_H
-#include <stdint.h>
-
-#define __s8 int8_t
-#define __u8 uint8_t
-
-#define __s16 int16_t
-#define __u16 uint16_t
-
-#define __s32 int32_t
-#define __u32 uint32_t
-
-#define __s64 long long
-#define __u64 unsigned long long
+#include <asm/types.h>
typedef __u64 u64;
typedef __s64 s64;
diff --git a/tools/kvm/ioport.c b/tools/kvm/ioport.c
index a38d2d1..8b96518 100644
--- a/tools/kvm/ioport.c
+++ b/tools/kvm/ioport.c
@@ -3,6 +3,7 @@
#include "kvm/kvm.h"
#include <linux/kvm.h> /* for KVM_EXIT_* */
+#include <linux/types.h>
#include <stdbool.h>
#include <assert.h>
@@ -12,7 +13,7 @@
bool ioport_debug;
-static bool debug_io_out(struct kvm *self, uint16_t port, void *data, int size, uint32_t count)
+static bool debug_io_out(struct kvm *self, u16 port, void *data, int size, u32 count)
{
exit(EXIT_SUCCESS);
}
@@ -21,12 +22,12 @@ static struct ioport_operations debug_ops = {
.io_out = debug_io_out,
};
-static bool dummy_io_in(struct kvm *self, uint16_t port, void *data, int size, uint32_t count)
+static bool dummy_io_in(struct kvm *self, u16 port, void *data, int size, u32 count)
{
return true;
}
-static bool dummy_io_out(struct kvm *self, uint16_t port, void *data, int size, uint32_t count)
+static bool dummy_io_out(struct kvm *self, u16 port, void *data, int size, u32 count)
{
return true;
}
@@ -42,7 +43,7 @@ static struct ioport_operations dummy_write_only_ioport_ops = {
static struct ioport_operations *ioport_ops[USHRT_MAX];
-void ioport__register(uint16_t port, struct ioport_operations *ops, int count)
+void ioport__register(u16 port, struct ioport_operations *ops, int count)
{
int i;
@@ -58,12 +59,12 @@ static const char *to_direction(int direction)
return "OUT";
}
-static void ioport_error(uint16_t port, void *data, int direction, int size, uint32_t count)
+static void ioport_error(u16 port, void *data, int direction, int size, u32 count)
{
- fprintf(stderr, "IO error: %s port=%x, size=%d, count=%" PRIu32 "\n", to_direction(direction), port, size, count);
+ fprintf(stderr, "IO error: %s port=%x, size=%d, count=%u\n", to_direction(direction), port, size, count);
}
-bool kvm__emulate_io(struct kvm *self, uint16_t port, void *data, int direction, int size, uint32_t count)
+bool kvm__emulate_io(struct kvm *self, u16 port, void *data, int direction, int size, u32 count)
{
struct ioport_operations *ops = ioport_ops[port];
bool ret;
diff --git a/tools/kvm/kvm-cpu.c b/tools/kvm/kvm-cpu.c
index 3f4007c..e66f03e 100644
--- a/tools/kvm/kvm-cpu.c
+++ b/tools/kvm/kvm-cpu.c
@@ -17,9 +17,9 @@ static inline bool is_in_protected_mode(struct kvm_cpu *self)
return self->sregs.cr0 & 0x01;
}
-static inline uint64_t ip_to_flat(struct kvm_cpu *self, uint64_t ip)
+static inline u64 ip_to_flat(struct kvm_cpu *self, u64 ip)
{
- uint64_t cs;
+ u64 cs;
/*
* NOTE! We should take code segment base address into account here.
@@ -33,12 +33,12 @@ static inline uint64_t ip_to_flat(struct kvm_cpu *self, uint64_t ip)
return ip + (cs << 4);
}
-static inline uint32_t selector_to_base(uint16_t selector)
+static inline u32 selector_to_base(u16 selector)
{
/*
* KVM on Intel requires 'base' to be 'selector * 16' in real mode.
*/
- return (uint32_t)selector * 16;
+ return (u32)selector * 16;
}
static struct kvm_cpu *kvm_cpu__new(struct kvm *kvm)
@@ -158,7 +158,7 @@ static void kvm_cpu__setup_regs(struct kvm_cpu *self)
};
if (self->regs.rip > USHRT_MAX)
- die("ip 0x%" PRIx64 " is too high for real mode", (uint64_t) self->regs.rip);
+ die("ip 0x%llx is too high for real mode", (u64) self->regs.rip);
if (ioctl(self->vcpu_fd, KVM_SET_REGS, &self->regs) < 0)
die_perror("KVM_SET_REGS failed");
@@ -200,15 +200,15 @@ void kvm_cpu__reset_vcpu(struct kvm_cpu *self)
static void print_dtable(const char *name, struct kvm_dtable *dtable)
{
- printf(" %s %016" PRIx64 " %08" PRIx16 "\n",
- name, (uint64_t) dtable->base, (uint16_t) dtable->limit);
+ printf(" %s %016llx %08hx\n",
+ name, (u64) dtable->base, (u16) dtable->limit);
}
static void print_segment(const char *name, struct kvm_segment *seg)
{
- printf(" %s %04" PRIx16 " %016" PRIx64 " %08" PRIx32 " %02" PRIx8 " %x %x %x %x %x %x %x\n",
- name, (uint16_t) seg->selector, (uint64_t) seg->base, (uint32_t) seg->limit,
- (uint8_t) seg->type, seg->present, seg->dpl, seg->db, seg->s, seg->l, seg->g, seg->avl);
+ printf(" %s %04hx %016llx %08x %02hhx %x %x %x %x %x %x %x\n",
+ name, (u16) seg->selector, (u64) seg->base, (u32) seg->limit,
+ (u8) seg->type, seg->present, seg->dpl, seg->db, seg->s, seg->l, seg->g, seg->avl);
}
void kvm_cpu__show_registers(struct kvm_cpu *self)
@@ -266,13 +266,13 @@ void kvm_cpu__show_registers(struct kvm_cpu *self)
print_segment("ldt", &sregs.ldt);
print_dtable("gdt", &sregs.gdt);
print_dtable("idt", &sregs.idt);
- printf(" [ efer: %016" PRIx64 " apic base: %016" PRIx64 " nmi: %s ]\n",
- (uint64_t) sregs.efer, (uint64_t) sregs.apic_base,
+ printf(" [ efer: %016llx apic base: %016llx nmi: %s ]\n",
+ (u64) sregs.efer, (u64) sregs.apic_base,
(self->kvm->nmi_disabled ? "disabled" : "enabled"));
printf("Interrupt bitmap:\n");
printf(" ");
for (i = 0; i < (KVM_NR_INTERRUPTS + 63) / 64; i++)
- printf("%016" PRIx64 " ", (uint64_t) sregs.interrupt_bitmap[i]);
+ printf("%016llx ", (u64) sregs.interrupt_bitmap[i]);
printf("\n");
}
@@ -283,7 +283,7 @@ void kvm_cpu__show_code(struct kvm_cpu *self)
unsigned int code_len = code_bytes;
unsigned char c;
unsigned int i;
- uint8_t *ip;
+ u8 *ip;
if (ioctl(self->vcpu_fd, KVM_GET_REGS, &self->regs) < 0)
die("KVM_GET_REGS failed");
@@ -315,10 +315,10 @@ void kvm_cpu__show_code(struct kvm_cpu *self)
void kvm_cpu__show_page_tables(struct kvm_cpu *self)
{
- uint64_t *pte1;
- uint64_t *pte2;
- uint64_t *pte3;
- uint64_t *pte4;
+ u64 *pte1;
+ u64 *pte2;
+ u64 *pte3;
+ u64 *pte4;
if (!is_in_protected_mode(self))
return;
@@ -344,12 +344,12 @@ void kvm_cpu__show_page_tables(struct kvm_cpu *self)
printf("Page Tables:\n");
if (*pte2 & (1 << 7))
- printf(" pte4: %016" PRIx64 " pte3: %016" PRIx64
- " pte2: %016" PRIx64 "\n",
+ printf(" pte4: %016llx pte3: %016llx"
+ " pte2: %016llx\n",
*pte4, *pte3, *pte2);
else
- printf(" pte4: %016" PRIx64 " pte3: %016" PRIx64 " pte2: %016"
- PRIx64 " pte1: %016" PRIx64 "\n",
+ printf(" pte4: %016llx pte3: %016llx pte2: %016"
+ "llx pte1: %016llx\n",
*pte4, *pte3, *pte2, *pte1);
}
@@ -387,7 +387,7 @@ int kvm_cpu__start(struct kvm_cpu *cpu)
ret = kvm__emulate_io(cpu->kvm,
cpu->kvm_run->io.port,
- (uint8_t *)cpu->kvm_run +
+ (u8 *)cpu->kvm_run +
cpu->kvm_run->io.data_offset,
cpu->kvm_run->io.direction,
cpu->kvm_run->io.size,
diff --git a/tools/kvm/kvm-run.c b/tools/kvm/kvm-run.c
index 2182dc5..2ff13d3 100644
--- a/tools/kvm/kvm-run.c
+++ b/tools/kvm/kvm-run.c
@@ -1,9 +1,7 @@
#include <stdio.h>
#include <string.h>
#include <signal.h>
-#include <stdint.h>
#include <unistd.h>
-#include <inttypes.h>
#include <stdlib.h>
#include <termios.h>
#include <sys/utsname.h>
@@ -162,7 +160,7 @@ static void *kvm_cpu_thread(void *arg)
return (void *) (intptr_t) 0;
panic_kvm:
- fprintf(stderr, "KVM exit reason: %" PRIu32 " (\"%s\")\n",
+ fprintf(stderr, "KVM exit reason: %u (\"%s\")\n",
current_kvm_cpu->kvm_run->exit_reason,
kvm_exit_reasons[current_kvm_cpu->kvm_run->exit_reason]);
if (current_kvm_cpu->kvm_run->exit_reason == KVM_EXIT_UNKNOWN)
diff --git a/tools/kvm/kvm.c b/tools/kvm/kvm.c
index df88d37..b3adb6b 100644
--- a/tools/kvm/kvm.c
+++ b/tools/kvm/kvm.c
@@ -11,7 +11,6 @@
#include <asm/bootparam.h>
#include <sys/ioctl.h>
-#include <inttypes.h>
#include <sys/mman.h>
#include <sys/stat.h>
#include <stdbool.h>
@@ -115,7 +114,7 @@ void kvm__delete(struct kvm *self)
static bool kvm__cpu_supports_vm(void)
{
struct cpuid_regs regs;
- uint32_t eax_base;
+ u32 eax_base;
int feature;
regs = (struct cpuid_regs) {
diff --git a/tools/kvm/mmio.c b/tools/kvm/mmio.c
index 095d2c9..6dd0645 100644
--- a/tools/kvm/mmio.c
+++ b/tools/kvm/mmio.c
@@ -1,8 +1,9 @@
#include "kvm/kvm.h"
#include <stdio.h>
+#include <linux/types.h>
-static const char *to_direction(uint8_t is_write)
+static const char *to_direction(u8 is_write)
{
if (is_write)
return "write";
@@ -10,9 +11,9 @@ static const char *to_direction(uint8_t is_write)
return "read";
}
-bool kvm__emulate_mmio(struct kvm *self, uint64_t phys_addr, uint8_t *data, uint32_t len, uint8_t is_write)
+bool kvm__emulate_mmio(struct kvm *self, u64 phys_addr, u8 *data, u32 len, u8 is_write)
{
- fprintf(stderr, "Warning: Ignoring MMIO %s at %016" PRIx64 " (length %" PRIu32 ")\n",
+ fprintf(stderr, "Warning: Ignoring MMIO %s at %016llx (length %u)\n",
to_direction(is_write), phys_addr, len);
return true;
diff --git a/tools/kvm/pci.c b/tools/kvm/pci.c
index 0b96990..11457ef 100644
--- a/tools/kvm/pci.c
+++ b/tools/kvm/pci.c
@@ -3,7 +3,6 @@
#include "kvm/util.h"
#include <assert.h>
-#include <stdint.h>
#define PCI_MAX_DEVICES 256
@@ -11,7 +10,7 @@ static struct pci_device_header *pci_devices[PCI_MAX_DEVICES];
static struct pci_config_address pci_config_address;
-static void *pci_config_address_ptr(uint16_t port)
+static void *pci_config_address_ptr(u16 port)
{
unsigned long offset;
void *base;
@@ -22,7 +21,7 @@ static void *pci_config_address_ptr(uint16_t port)
return base + offset;
}
-static bool pci_config_address_out(struct kvm *self, uint16_t port, void *data, int size, uint32_t count)
+static bool pci_config_address_out(struct kvm *self, u16 port, void *data, int size, u32 count)
{
void *p = pci_config_address_ptr(port);
@@ -31,7 +30,7 @@ static bool pci_config_address_out(struct kvm *self, uint16_t port, void *data,
return true;
}
-static bool pci_config_address_in(struct kvm *self, uint16_t port, void *data, int size, uint32_t count)
+static bool pci_config_address_in(struct kvm *self, u16 port, void *data, int size, u32 count)
{
void *p = pci_config_address_ptr(port);
@@ -45,12 +44,12 @@ static struct ioport_operations pci_config_address_ops = {
.io_out = pci_config_address_out,
};
-static bool pci_config_data_out(struct kvm *self, uint16_t port, void *data, int size, uint32_t count)
+static bool pci_config_data_out(struct kvm *self, u16 port, void *data, int size, u32 count)
{
return true;
}
-static bool pci_device_exists(uint8_t bus_number, uint8_t device_number, uint8_t function_number)
+static bool pci_device_exists(u8 bus_number, u8 device_number, u8 function_number)
{
struct pci_device_header *dev;
@@ -68,10 +67,10 @@ static bool pci_device_exists(uint8_t bus_number, uint8_t device_number, uint8_t
return dev != NULL;
}
-static bool pci_config_data_in(struct kvm *self, uint16_t port, void *data, int size, uint32_t count)
+static bool pci_config_data_in(struct kvm *self, u16 port, void *data, int size, u32 count)
{
unsigned long start;
- uint8_t dev_num;
+ u8 dev_num;
/*
* If someone accesses PCI configuration space offsets that are not
@@ -102,7 +101,7 @@ static struct ioport_operations pci_config_data_ops = {
.io_out = pci_config_data_out,
};
-void pci__register(struct pci_device_header *dev, uint8_t dev_num)
+void pci__register(struct pci_device_header *dev, u8 dev_num)
{
assert(dev_num < PCI_MAX_DEVICES);
diff --git a/tools/kvm/qcow.c b/tools/kvm/qcow.c
index f628736..fd29dee 100644
--- a/tools/kvm/qcow.c
+++ b/tools/kvm/qcow.c
@@ -101,8 +101,8 @@ out_error:
goto out;
}
-static int qcow1_read_sector(struct disk_image *self, uint64_t sector,
- void *dst, uint32_t dst_len)
+static int qcow1_read_sector(struct disk_image *self, u64 sector,
+ void *dst, u32 dst_len)
{
struct qcow *q = self->priv;
struct qcow_header *header = q->header;
@@ -130,7 +130,7 @@ out_error:
return -1;
}
-static int qcow1_write_sector(struct disk_image *self, uint64_t sector, void *src, uint32_t src_len)
+static int qcow1_write_sector(struct disk_image *self, u64 sector, void *src, u32 src_len)
{
return -1;
}
diff --git a/tools/kvm/rtc.c b/tools/kvm/rtc.c
index b9c09b9..719198f 100644
--- a/tools/kvm/rtc.c
+++ b/tools/kvm/rtc.c
@@ -5,7 +5,7 @@
#include <time.h>
-static uint8_t cmos_index;
+static u8 cmos_index;
#define CMOS_RTC_SECONDS 0x00
#define CMOS_RTC_MINUTES 0x02
@@ -19,7 +19,7 @@ static inline unsigned char bin2bcd(unsigned val)
return ((val / 10) << 4) + val % 10;
}
-static bool cmos_ram_data_in(struct kvm *self, uint16_t port, void *data, int size, uint32_t count)
+static bool cmos_ram_data_in(struct kvm *self, u16 port, void *data, int size, u32 count)
{
struct tm *tm;
time_t ti;
@@ -52,7 +52,7 @@ static bool cmos_ram_data_in(struct kvm *self, uint16_t port, void *data, int si
return true;
}
-static bool cmos_ram_data_out(struct kvm *self, uint16_t port, void *data, int size, uint32_t count)
+static bool cmos_ram_data_out(struct kvm *self, u16 port, void *data, int size, u32 count)
{
return true;
}
@@ -62,9 +62,9 @@ static struct ioport_operations cmos_ram_data_ioport_ops = {
.io_in = cmos_ram_data_in,
};
-static bool cmos_ram_index_out(struct kvm *self, uint16_t port, void *data, int size, uint32_t count)
+static bool cmos_ram_index_out(struct kvm *self, u16 port, void *data, int size, u32 count)
{
- uint8_t value;
+ u8 value;
value = ioport__read8(data);
diff --git a/tools/kvm/util/parse-options.c b/tools/kvm/util/parse-options.c
index 94edf7b..19d2048 100644
--- a/tools/kvm/util/parse-options.c
+++ b/tools/kvm/util/parse-options.c
@@ -1,7 +1,6 @@
#include <stdio.h>
#include <string.h>
#include <unistd.h>
-#include <stdint.h>
#include <stdbool.h>
diff --git a/tools/kvm/virtio/blk.c b/tools/kvm/virtio/blk.c
index 16c9658..4e5ac9e 100644
--- a/tools/kvm/virtio/blk.c
+++ b/tools/kvm/virtio/blk.c
@@ -14,7 +14,7 @@
#include <linux/virtio_ring.h>
#include <linux/virtio_blk.h>
-#include <inttypes.h>
+#include <linux/types.h>
#include <pthread.h>
#define VIRTIO_BLK_IRQ 9
@@ -35,14 +35,14 @@ struct blk_device {
struct virtio_blk_config blk_config;
struct disk_image *disk;
- uint32_t host_features;
- uint32_t guest_features;
- uint16_t config_vector;
- uint8_t status;
+ u32 host_features;
+ u32 guest_features;
+ u16 config_vector;
+ u8 status;
u8 idx;
/* virtio queue */
- uint16_t queue_selector;
+ u16 queue_selector;
struct virt_queue vqs[NUM_VIRT_QUEUES];
struct blk_device_job jobs[NUM_VIRT_QUEUES];
@@ -55,9 +55,9 @@ static bool virtio_blk_pci_io_device_specific_in(struct blk_device *blk_device,
void *data,
unsigned long offset,
int size,
- uint32_t count)
+ u32 count)
{
- uint8_t *config_space = (uint8_t *) &blk_device->blk_config;
+ u8 *config_space = (u8 *) &blk_device->blk_config;
if (size != 1 || count != 1)
return false;
@@ -77,7 +77,7 @@ static void virtio_blk_port2dev(u16 port,
*dev_idx = (port - base) / size;
*offset = port - (base + *dev_idx * size);
}
-static bool virtio_blk_pci_io_in(struct kvm *self, uint16_t port, void *data, int size, uint32_t count)
+static bool virtio_blk_pci_io_in(struct kvm *self, u16 port, void *data, int size, u32 count)
{
u16 offset, dev_idx;
bool ret = true;
@@ -133,8 +133,8 @@ static bool virtio_blk_do_io_request(struct kvm *self,
struct iovec iov[VIRTIO_BLK_QUEUE_SIZE];
struct virtio_blk_outhdr *req;
ssize_t block_cnt = -1;
- uint16_t out, in, head;
- uint8_t *status;
+ u16 out, in, head;
+ u8 *status;
head = virt_queue__get_iov(queue, iov, &out, &in, self);
@@ -177,7 +177,7 @@ static void virtio_blk_do_io(struct kvm *kvm, void *param)
kvm__irq_line(kvm, VIRTIO_BLK_IRQ + blk_device->idx, 1);
}
-static bool virtio_blk_pci_io_out(struct kvm *self, uint16_t port, void *data, int size, uint32_t count)
+static bool virtio_blk_pci_io_out(struct kvm *self, u16 port, void *data, int size, u32 count)
{
u16 offset, dev_idx;
bool ret = true;
@@ -220,7 +220,7 @@ static bool virtio_blk_pci_io_out(struct kvm *self, uint16_t port, void *data, i
blk_device->queue_selector = ioport__read16(data);
break;
case VIRTIO_PCI_QUEUE_NOTIFY: {
- uint16_t queue_index;
+ u16 queue_index;
queue_index = ioport__read16(data);
thread_pool__do_job(blk_device->jobs[queue_index].job_id);
break;
diff --git a/tools/kvm/virtio/console.c b/tools/kvm/virtio/console.c
index f440ded..3be65d3 100644
--- a/tools/kvm/virtio/console.c
+++ b/tools/kvm/virtio/console.c
@@ -17,7 +17,6 @@
#include <sys/uio.h>
#include <sys/types.h>
#include <sys/stat.h>
-#include <inttypes.h>
#include <termios.h>
#include <assert.h>
#include <unistd.h>
@@ -37,25 +36,25 @@ struct console_device {
struct virt_queue vqs[VIRTIO_CONSOLE_NUM_QUEUES];
struct virtio_console_config console_config;
- uint32_t host_features;
- uint32_t guest_features;
- uint16_t config_vector;
- uint8_t status;
- uint16_t queue_selector;
+ u32 host_features;
+ u32 guest_features;
+ u16 config_vector;
+ u8 status;
+ u16 queue_selector;
- void *jobs[VIRTIO_CONSOLE_NUM_QUEUES];
+ void *jobs[VIRTIO_CONSOLE_NUM_QUEUES];
};
static struct console_device console_device = {
- .mutex = PTHREAD_MUTEX_INITIALIZER,
+ .mutex = PTHREAD_MUTEX_INITIALIZER,
.console_config = {
- .cols = 80,
- .rows = 24,
- .max_nr_ports = 1,
+ .cols = 80,
+ .rows = 24,
+ .max_nr_ports = 1,
},
- .host_features = 0,
+ .host_features = 0,
};
/*
@@ -65,8 +64,8 @@ static void virtio_console__inject_interrupt_callback(struct kvm *self, void *pa
{
struct iovec iov[VIRTIO_CONSOLE_QUEUE_SIZE];
struct virt_queue *vq;
- uint16_t out, in;
- uint16_t head;
+ u16 out, in;
+ u16 head;
int len;
mutex_lock(&console_device.mutex);
@@ -88,9 +87,9 @@ void virtio_console__inject_interrupt(struct kvm *self)
thread_pool__do_job(console_device.jobs[VIRTIO_CONSOLE_RX_QUEUE]);
}
-static bool virtio_console_pci_io_device_specific_in(void *data, unsigned long offset, int size, uint32_t count)
+static bool virtio_console_pci_io_device_specific_in(void *data, unsigned long offset, int size, u32 count)
{
- uint8_t *config_space = (uint8_t *) &console_device.console_config;
+ u8 *config_space = (u8 *) &console_device.console_config;
if (size != 1 || count != 1)
return false;
@@ -103,7 +102,7 @@ static bool virtio_console_pci_io_device_specific_in(void *data, unsigned long o
return true;
}
-static bool virtio_console_pci_io_in(struct kvm *self, uint16_t port, void *data, int size, uint32_t count)
+static bool virtio_console_pci_io_in(struct kvm *self, u16 port, void *data, int size, u32 count)
{
unsigned long offset = port - IOPORT_VIRTIO_CONSOLE;
bool ret = true;
@@ -150,9 +149,9 @@ static void virtio_console_handle_callback(struct kvm *self, void *param)
{
struct iovec iov[VIRTIO_CONSOLE_QUEUE_SIZE];
struct virt_queue *vq;
- uint16_t out, in;
- uint16_t head;
- uint32_t len;
+ u16 out, in;
+ u16 head;
+ u32 len;
vq = param;
@@ -165,7 +164,7 @@ static void virtio_console_handle_callback(struct kvm *self, void *param)
kvm__irq_line(self, VIRTIO_CONSOLE_IRQ, 1);
}
-static bool virtio_console_pci_io_out(struct kvm *self, uint16_t port, void *data, int size, uint32_t count)
+static bool virtio_console_pci_io_out(struct kvm *self, u16 port, void *data, int size, u32 count)
{
unsigned long offset = port - IOPORT_VIRTIO_CONSOLE;
bool ret = true;
@@ -201,7 +200,7 @@ static bool virtio_console_pci_io_out(struct kvm *self, uint16_t port, void *dat
console_device.queue_selector = ioport__read16(data);
break;
case VIRTIO_PCI_QUEUE_NOTIFY: {
- uint16_t queue_index;
+ u16 queue_index;
queue_index = ioport__read16(data);
thread_pool__do_job(console_device.jobs[queue_index]);
break;
diff --git a/tools/kvm/virtio/core.c b/tools/kvm/virtio/core.c
index 4dcd092..dd7a3cf 100644
--- a/tools/kvm/virtio/core.c
+++ b/tools/kvm/virtio/core.c
@@ -1,5 +1,5 @@
#include <linux/virtio_ring.h>
-#include <stdint.h>
+#include <linux/types.h>
#include <sys/uio.h>
#include "kvm/barrier.h"
@@ -7,7 +7,7 @@
#include "kvm/kvm.h"
#include "kvm/virtio.h"
-struct vring_used_elem *virt_queue__set_used_elem(struct virt_queue *queue, uint32_t head, uint32_t len)
+struct vring_used_elem *virt_queue__set_used_elem(struct virt_queue *queue, u32 head, u32 len)
{
struct vring_used_elem *used_elem;
used_elem = &queue->vring.used->ring[queue->vring.used->idx % queue->vring.num];
@@ -32,10 +32,10 @@ struct vring_used_elem *virt_queue__set_used_elem(struct virt_queue *queue, uint
return used_elem;
}
-uint16_t virt_queue__get_iov(struct virt_queue *queue, struct iovec iov[], uint16_t *out, uint16_t *in, struct kvm *kvm)
+u16 virt_queue__get_iov(struct virt_queue *queue, struct iovec iov[], u16 *out, u16 *in, struct kvm *kvm)
{
struct vring_desc *desc;
- uint16_t head, idx;
+ u16 head, idx;
idx = head = virt_queue__pop(queue);
*out = *in = 0;
diff --git a/tools/kvm/virtio/net.c b/tools/kvm/virtio/net.c
index 3e13429..f0d24fa 100644
--- a/tools/kvm/virtio/net.c
+++ b/tools/kvm/virtio/net.c
@@ -34,11 +34,11 @@ struct net_device {
struct virt_queue vqs[VIRTIO_NET_NUM_QUEUES];
struct virtio_net_config net_config;
- uint32_t host_features;
- uint32_t guest_features;
- uint16_t config_vector;
- uint8_t status;
- uint16_t queue_selector;
+ u32 host_features;
+ u32 guest_features;
+ u16 config_vector;
+ u8 status;
+ u16 queue_selector;
pthread_t io_rx_thread;
pthread_mutex_t io_rx_mutex;
@@ -74,8 +74,8 @@ static void *virtio_net_rx_thread(void *p)
struct iovec iov[VIRTIO_NET_QUEUE_SIZE];
struct virt_queue *vq;
struct kvm *self;
- uint16_t out, in;
- uint16_t head;
+ u16 out, in;
+ u16 head;
int len;
self = p;
@@ -107,8 +107,8 @@ static void *virtio_net_tx_thread(void *p)
struct iovec iov[VIRTIO_NET_QUEUE_SIZE];
struct virt_queue *vq;
struct kvm *self;
- uint16_t out, in;
- uint16_t head;
+ u16 out, in;
+ u16 head;
int len;
self = p;
@@ -133,9 +133,9 @@ static void *virtio_net_tx_thread(void *p)
return NULL;
}
-static bool virtio_net_pci_io_device_specific_in(void *data, unsigned long offset, int size, uint32_t count)
+static bool virtio_net_pci_io_device_specific_in(void *data, unsigned long offset, int size, u32 count)
{
- uint8_t *config_space = (uint8_t *) &net_device.net_config;
+ u8 *config_space = (u8 *) &net_device.net_config;
if (size != 1 || count != 1)
return false;
@@ -148,7 +148,7 @@ static bool virtio_net_pci_io_device_specific_in(void *data, unsigned long offse
return true;
}
-static bool virtio_net_pci_io_in(struct kvm *self, uint16_t port, void *data, int size, uint32_t count)
+static bool virtio_net_pci_io_in(struct kvm *self, u16 port, void *data, int size, u32 count)
{
unsigned long offset = port - IOPORT_VIRTIO_NET;
bool ret = true;
@@ -191,7 +191,7 @@ static bool virtio_net_pci_io_in(struct kvm *self, uint16_t port, void *data, in
return ret;
}
-static void virtio_net_handle_callback(struct kvm *self, uint16_t queue_index)
+static void virtio_net_handle_callback(struct kvm *self, u16 queue_index)
{
if (queue_index == VIRTIO_NET_TX_QUEUE) {
@@ -208,7 +208,7 @@ static void virtio_net_handle_callback(struct kvm *self, uint16_t queue_index)
}
}
-static bool virtio_net_pci_io_out(struct kvm *self, uint16_t port, void *data, int size, uint32_t count)
+static bool virtio_net_pci_io_out(struct kvm *self, u16 port, void *data, int size, u32 count)
{
unsigned long offset = port - IOPORT_VIRTIO_NET;
bool ret = true;
@@ -237,7 +237,7 @@ static bool virtio_net_pci_io_out(struct kvm *self, uint16_t port, void *data, i
net_device.queue_selector = ioport__read16(data);
break;
case VIRTIO_PCI_QUEUE_NOTIFY: {
- uint16_t queue_index;
+ u16 queue_index;
queue_index = ioport__read16(data);
virtio_net_handle_callback(self, queue_index);
break;
diff --git a/tools/kvm/virtio/rng.c b/tools/kvm/virtio/rng.c
index 6dab92e..65fa48d 100644
--- a/tools/kvm/virtio/rng.c
+++ b/tools/kvm/virtio/rng.c
@@ -17,7 +17,6 @@
#include <fcntl.h>
#include <sys/types.h>
#include <sys/stat.h>
-#include <inttypes.h>
#include <pthread.h>
#define PCI_VENDOR_ID_REDHAT_QUMRANET 0x1af4
@@ -34,19 +33,19 @@
#define VIRTIO_RNG_QUEUE_SIZE 128
struct rng_device {
- uint8_t status;
- uint16_t config_vector;
+ u8 status;
+ u16 config_vector;
int fd_rng;
/* virtio queue */
- uint16_t queue_selector;
+ u16 queue_selector;
struct virt_queue vqs[NUM_VIRT_QUEUES];
void *jobs[NUM_VIRT_QUEUES];
};
static struct rng_device rng_device;
-static bool virtio_rng_pci_io_in(struct kvm *kvm, uint16_t port, void *data, int size, uint32_t count)
+static bool virtio_rng_pci_io_in(struct kvm *kvm, u16 port, void *data, int size, u32 count)
{
unsigned long offset;
bool ret = true;
@@ -86,7 +85,7 @@ static bool virtio_rng_pci_io_in(struct kvm *kvm, uint16_t port, void *data, int
static bool virtio_rng_do_io_request(struct kvm *self, struct virt_queue *queue)
{
struct iovec iov[VIRTIO_RNG_QUEUE_SIZE];
- uint16_t out, in, head;
+ u16 out, in, head;
unsigned int len = 0;
head = virt_queue__get_iov(queue, iov, &out, &in, self);
@@ -106,7 +105,7 @@ static void virtio_rng_do_io(struct kvm *kvm, void *param)
}
}
-static bool virtio_rng_pci_io_out(struct kvm *kvm, uint16_t port, void *data, int size, uint32_t count)
+static bool virtio_rng_pci_io_out(struct kvm *kvm, u16 port, void *data, int size, u32 count)
{
unsigned long offset;
bool ret = true;
@@ -136,7 +135,7 @@ static bool virtio_rng_pci_io_out(struct kvm *kvm, uint16_t port, void *data, in
rng_device.queue_selector = ioport__read16(data);
break;
case VIRTIO_PCI_QUEUE_NOTIFY: {
- uint16_t queue_index;
+ u16 queue_index;
queue_index = ioport__read16(data);
thread_pool__do_job(rng_device.jobs[queue_index]);
break;
--
1.7.5.rc3
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 2/5] kvm tools: virtio-blk code cleanup
2011-05-05 18:34 [PATCH 1/5] kvm tools: Abolishment of uint*_t types Sasha Levin
@ 2011-05-05 18:34 ` Sasha Levin
2011-05-05 18:34 ` [PATCH 3/5] kvm tools: virtio-console " Sasha Levin
` (3 subsequent siblings)
4 siblings, 0 replies; 7+ messages in thread
From: Sasha Levin @ 2011-05-05 18:34 UTC (permalink / raw)
To: penberg; +Cc: mingo, asias.hejun, gorcunov, prasadjoshi124, kvm, Sasha Levin
Clean coding style and naming within virtio-blk.
Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
---
tools/kvm/virtio/blk.c | 133 +++++++++++++++++++++++++-----------------------
1 files changed, 70 insertions(+), 63 deletions(-)
diff --git a/tools/kvm/virtio/blk.c b/tools/kvm/virtio/blk.c
index 4e5ac9e..92a8e9e 100644
--- a/tools/kvm/virtio/blk.c
+++ b/tools/kvm/virtio/blk.c
@@ -17,20 +17,20 @@
#include <linux/types.h>
#include <pthread.h>
-#define VIRTIO_BLK_IRQ 9
-#define VIRTIO_BLK_PIN 1
-#define VIRTIO_BLK_MAX_DEV 4
-#define NUM_VIRT_QUEUES 1
+#define VIRTIO_BLK_IRQ 9
+#define VIRTIO_BLK_PIN 1
+#define VIRTIO_BLK_MAX_DEV 4
+#define NUM_VIRT_QUEUES 1
-#define VIRTIO_BLK_QUEUE_SIZE 128
+#define VIRTIO_BLK_QUEUE_SIZE 128
-struct blk_device_job {
+struct blk_dev_job {
struct virt_queue *vq;
- struct blk_device *blk_device;
+ struct blk_dev *bdev;
void *job_id;
};
-struct blk_device {
+struct blk_dev {
pthread_mutex_t mutex;
struct virtio_blk_config blk_config;
@@ -45,19 +45,19 @@ struct blk_device {
u16 queue_selector;
struct virt_queue vqs[NUM_VIRT_QUEUES];
- struct blk_device_job jobs[NUM_VIRT_QUEUES];
+ struct blk_dev_job jobs[NUM_VIRT_QUEUES];
struct pci_device_header pci_device;
};
-static struct blk_device *blk_devices[VIRTIO_BLK_MAX_DEV];
+static struct blk_dev *bdevs[VIRTIO_BLK_MAX_DEV];
-static bool virtio_blk_pci_io_device_specific_in(struct blk_device *blk_device,
+static bool virtio_blk_pci_io_device_specific_in(struct blk_dev *bdev,
void *data,
unsigned long offset,
int size,
u32 count)
{
- u8 *config_space = (u8 *) &blk_device->blk_config;
+ u8 *config_space = (u8 *) &bdev->blk_config;
if (size != 1 || count != 1)
return false;
@@ -79,26 +79,26 @@ static void virtio_blk_port2dev(u16 port,
}
static bool virtio_blk_pci_io_in(struct kvm *self, u16 port, void *data, int size, u32 count)
{
- u16 offset, dev_idx;
- bool ret = true;
- struct blk_device *blk_device;
+ u16 offset, dev_idx;
+ bool ret = true;
+ struct blk_dev *bdev;
virtio_blk_port2dev(port, IOPORT_VIRTIO_BLK, IOPORT_VIRTIO_BLK_SIZE,
&dev_idx, &offset);
- blk_device = blk_devices[dev_idx];
+ bdev = bdevs[dev_idx];
- mutex_lock(&blk_device->mutex);
+ mutex_lock(&bdev->mutex);
switch (offset) {
case VIRTIO_PCI_HOST_FEATURES:
- ioport__write32(data, blk_device->host_features);
+ ioport__write32(data, bdev->host_features);
break;
case VIRTIO_PCI_GUEST_FEATURES:
ret = false;
break;
case VIRTIO_PCI_QUEUE_PFN:
- ioport__write32(data, blk_device->vqs[blk_device->queue_selector].pfn);
+ ioport__write32(data, bdev->vqs[bdev->queue_selector].pfn);
break;
case VIRTIO_PCI_QUEUE_NUM:
ioport__write16(data, VIRTIO_BLK_QUEUE_SIZE);
@@ -108,26 +108,26 @@ static bool virtio_blk_pci_io_in(struct kvm *self, u16 port, void *data, int siz
ret = false;
break;
case VIRTIO_PCI_STATUS:
- ioport__write8(data, blk_device->status);
+ ioport__write8(data, bdev->status);
break;
case VIRTIO_PCI_ISR:
ioport__write8(data, 0x1);
- kvm__irq_line(self, VIRTIO_BLK_IRQ + blk_device->idx, 0);
+ kvm__irq_line(self, VIRTIO_BLK_IRQ + bdev->idx, 0);
break;
case VIRTIO_MSI_CONFIG_VECTOR:
- ioport__write16(data, blk_device->config_vector);
+ ioport__write16(data, bdev->config_vector);
break;
default:
- ret = virtio_blk_pci_io_device_specific_in(blk_device, data, offset, size, count);
+ ret = virtio_blk_pci_io_device_specific_in(bdev, data, offset, size, count);
};
- mutex_unlock(&blk_device->mutex);
+ mutex_unlock(&bdev->mutex);
return ret;
}
static bool virtio_blk_do_io_request(struct kvm *self,
- struct blk_device *blk_device,
+ struct blk_dev *bdev,
struct virt_queue *queue)
{
struct iovec iov[VIRTIO_BLK_QUEUE_SIZE];
@@ -136,24 +136,30 @@ static bool virtio_blk_do_io_request(struct kvm *self,
u16 out, in, head;
u8 *status;
- head = virt_queue__get_iov(queue, iov, &out, &in, self);
+ head = virt_queue__get_iov(queue, iov, &out, &in, self);
/* head */
- req = iov[0].iov_base;
+ req = iov[0].iov_base;
switch (req->type) {
case VIRTIO_BLK_T_IN:
- block_cnt = disk_image__read_sector_iov(blk_device->disk, req->sector, iov + 1, in + out - 2);
+ block_cnt = disk_image__read_sector_iov(bdev->disk,
+ req->sector,
+ iov + 1,
+ in + out - 2);
break;
case VIRTIO_BLK_T_OUT:
- block_cnt = disk_image__write_sector_iov(blk_device->disk, req->sector, iov + 1, in + out - 2);
+ block_cnt = disk_image__write_sector_iov(bdev->disk,
+ req->sector,
+ iov + 1,
+ in + out - 2);
break;
default:
warning("request type %d", req->type);
- block_cnt = -1;
+ block_cnt = -1;
}
/* status */
@@ -167,49 +173,49 @@ static bool virtio_blk_do_io_request(struct kvm *self,
static void virtio_blk_do_io(struct kvm *kvm, void *param)
{
- struct blk_device_job *job = param;
- struct virt_queue *vq = job->vq;
- struct blk_device *blk_device = job->blk_device;
+ struct blk_dev_job *job = param;
+ struct virt_queue *vq = job->vq;
+ struct blk_dev *bdev = job->bdev;
while (virt_queue__available(vq))
- virtio_blk_do_io_request(kvm, blk_device, vq);
+ virtio_blk_do_io_request(kvm, bdev, vq);
- kvm__irq_line(kvm, VIRTIO_BLK_IRQ + blk_device->idx, 1);
+ kvm__irq_line(kvm, VIRTIO_BLK_IRQ + bdev->idx, 1);
}
static bool virtio_blk_pci_io_out(struct kvm *self, u16 port, void *data, int size, u32 count)
{
u16 offset, dev_idx;
bool ret = true;
- struct blk_device *blk_device;
+ struct blk_dev *bdev;
virtio_blk_port2dev(port, IOPORT_VIRTIO_BLK, IOPORT_VIRTIO_BLK_SIZE,
&dev_idx, &offset);
- blk_device = blk_devices[dev_idx];
+ bdev = bdevs[dev_idx];
- mutex_lock(&blk_device->mutex);
+ mutex_lock(&bdev->mutex);
switch (offset) {
case VIRTIO_PCI_GUEST_FEATURES:
- blk_device->guest_features = ioport__read32(data);
+ bdev->guest_features = ioport__read32(data);
break;
case VIRTIO_PCI_QUEUE_PFN: {
struct virt_queue *queue;
- struct blk_device_job *job;
+ struct blk_dev_job *job;
void *p;
- job = &blk_device->jobs[blk_device->queue_selector];
+ job = &bdev->jobs[bdev->queue_selector];
- queue = &blk_device->vqs[blk_device->queue_selector];
- queue->pfn = ioport__read32(data);
- p = guest_flat_to_host(self, queue->pfn << 12);
+ queue = &bdev->vqs[bdev->queue_selector];
+ queue->pfn = ioport__read32(data);
+ p = guest_flat_to_host(self, queue->pfn << 12);
vring_init(&queue->vring, VIRTIO_BLK_QUEUE_SIZE, p, 4096);
- *job = (struct blk_device_job) {
- .vq = queue,
- .blk_device = blk_device,
+ *job = (struct blk_dev_job) {
+ .vq = queue,
+ .bdev = bdev,
};
job->job_id = thread_pool__add_job(self, virtio_blk_do_io, job);
@@ -217,27 +223,27 @@ static bool virtio_blk_pci_io_out(struct kvm *self, u16 port, void *data, int si
break;
}
case VIRTIO_PCI_QUEUE_SEL:
- blk_device->queue_selector = ioport__read16(data);
+ bdev->queue_selector = ioport__read16(data);
break;
case VIRTIO_PCI_QUEUE_NOTIFY: {
u16 queue_index;
- queue_index = ioport__read16(data);
- thread_pool__do_job(blk_device->jobs[queue_index].job_id);
+ queue_index = ioport__read16(data);
+ thread_pool__do_job(bdev->jobs[queue_index].job_id);
break;
}
case VIRTIO_PCI_STATUS:
- blk_device->status = ioport__read8(data);
+ bdev->status = ioport__read8(data);
break;
case VIRTIO_MSI_CONFIG_VECTOR:
- blk_device->config_vector = VIRTIO_MSI_NO_VECTOR;
+ bdev->config_vector = VIRTIO_MSI_NO_VECTOR;
break;
case VIRTIO_MSI_QUEUE_VECTOR:
break;
default:
- ret = false;
+ ret = false;
};
- mutex_unlock(&blk_device->mutex);
+ mutex_unlock(&bdev->mutex);
return ret;
}
@@ -258,7 +264,7 @@ static int virtio_blk_find_empty_dev(void)
int i;
for (i = 0; i < VIRTIO_BLK_MAX_DEV; i++) {
- if (blk_devices[i] == NULL)
+ if (bdevs[i] == NULL)
return i;
}
@@ -269,7 +275,7 @@ void virtio_blk__init(struct kvm *self, struct disk_image *disk)
{
int new_dev_idx;
u16 blk_dev_base_addr;
- struct blk_device *blk_device;
+ struct blk_dev *bdev;
if (!disk)
return;
@@ -278,19 +284,20 @@ void virtio_blk__init(struct kvm *self, struct disk_image *disk)
if (new_dev_idx < 0)
die("Could not find an empty block device slot");
- blk_devices[new_dev_idx] = calloc(1, sizeof(struct blk_device));
- if (blk_devices[new_dev_idx] == NULL)
- die("Failed allocating blk_device");
+ bdevs[new_dev_idx] = calloc(1, sizeof(struct blk_dev));
+ if (bdevs[new_dev_idx] == NULL)
+ die("Failed allocating bdev");
+
+ bdev = bdevs[new_dev_idx];
- blk_device = blk_devices[new_dev_idx];
blk_dev_base_addr = IOPORT_VIRTIO_BLK + new_dev_idx * IOPORT_VIRTIO_BLK_SIZE;
- *blk_device = (struct blk_device) {
+ *bdev = (struct blk_dev) {
.mutex = PTHREAD_MUTEX_INITIALIZER,
.disk = disk,
.idx = new_dev_idx,
.blk_config = (struct virtio_blk_config) {
- .capacity = disk->size / SECTOR_SIZE,
+ .capacity = disk->size / SECTOR_SIZE,
},
.pci_device = (struct pci_device_header) {
.vendor_id = PCI_VENDOR_ID_REDHAT_QUMRANET,
@@ -306,7 +313,7 @@ void virtio_blk__init(struct kvm *self, struct disk_image *disk)
},
};
- pci__register(&blk_device->pci_device, PCI_VIRTIO_BLK_DEVNUM + new_dev_idx);
+ pci__register(&bdev->pci_device, PCI_VIRTIO_BLK_DEVNUM + new_dev_idx);
ioport__register(blk_dev_base_addr, &virtio_blk_io_ops, IOPORT_VIRTIO_BLK_SIZE);
}
--
1.7.5.rc3
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 3/5] kvm tools: virtio-console code cleanup
2011-05-05 18:34 [PATCH 1/5] kvm tools: Abolishment of uint*_t types Sasha Levin
2011-05-05 18:34 ` [PATCH 2/5] kvm tools: virtio-blk code cleanup Sasha Levin
@ 2011-05-05 18:34 ` Sasha Levin
2011-05-05 18:34 ` [PATCH 4/5] kvm tools: virtio-net " Sasha Levin
` (2 subsequent siblings)
4 siblings, 0 replies; 7+ messages in thread
From: Sasha Levin @ 2011-05-05 18:34 UTC (permalink / raw)
To: penberg; +Cc: mingo, asias.hejun, gorcunov, prasadjoshi124, kvm, Sasha Levin
Clean coding style and naming within virtio-console.
Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
---
tools/kvm/virtio/console.c | 69 +++++++++++++++++++++----------------------
1 files changed, 34 insertions(+), 35 deletions(-)
diff --git a/tools/kvm/virtio/console.c b/tools/kvm/virtio/console.c
index 3be65d3..6ccb1ef 100644
--- a/tools/kvm/virtio/console.c
+++ b/tools/kvm/virtio/console.c
@@ -31,7 +31,7 @@
#define VIRTIO_CONSOLE_TX_QUEUE 1
#define PCI_VIRTIO_CONSOLE_DEVNUM 2
-struct console_device {
+struct con_dev {
pthread_mutex_t mutex;
struct virt_queue vqs[VIRTIO_CONSOLE_NUM_QUEUES];
@@ -45,7 +45,7 @@ struct console_device {
void *jobs[VIRTIO_CONSOLE_NUM_QUEUES];
};
-static struct console_device console_device = {
+static struct con_dev cdev = {
.mutex = PTHREAD_MUTEX_INITIALIZER,
.console_config = {
@@ -68,7 +68,7 @@ static void virtio_console__inject_interrupt_callback(struct kvm *self, void *pa
u16 head;
int len;
- mutex_lock(&console_device.mutex);
+ mutex_lock(&cdev.mutex);
vq = param;
@@ -79,17 +79,17 @@ static void virtio_console__inject_interrupt_callback(struct kvm *self, void *pa
kvm__irq_line(self, VIRTIO_CONSOLE_IRQ, 1);
}
- mutex_unlock(&console_device.mutex);
+ mutex_unlock(&cdev.mutex);
}
void virtio_console__inject_interrupt(struct kvm *self)
{
- thread_pool__do_job(console_device.jobs[VIRTIO_CONSOLE_RX_QUEUE]);
+ thread_pool__do_job(cdev.jobs[VIRTIO_CONSOLE_RX_QUEUE]);
}
static bool virtio_console_pci_io_device_specific_in(void *data, unsigned long offset, int size, u32 count)
{
- u8 *config_space = (u8 *) &console_device.console_config;
+ u8 *config_space = (u8 *) &cdev.console_config;
if (size != 1 || count != 1)
return false;
@@ -107,17 +107,17 @@ static bool virtio_console_pci_io_in(struct kvm *self, u16 port, void *data, int
unsigned long offset = port - IOPORT_VIRTIO_CONSOLE;
bool ret = true;
- mutex_lock(&console_device.mutex);
+ mutex_lock(&cdev.mutex);
switch (offset) {
case VIRTIO_PCI_HOST_FEATURES:
- ioport__write32(data, console_device.host_features);
+ ioport__write32(data, cdev.host_features);
break;
case VIRTIO_PCI_GUEST_FEATURES:
ret = false;
break;
case VIRTIO_PCI_QUEUE_PFN:
- ioport__write32(data, console_device.vqs[console_device.queue_selector].pfn);
+ ioport__write32(data, cdev.vqs[cdev.queue_selector].pfn);
break;
case VIRTIO_PCI_QUEUE_NUM:
ioport__write16(data, VIRTIO_CONSOLE_QUEUE_SIZE);
@@ -127,31 +127,31 @@ static bool virtio_console_pci_io_in(struct kvm *self, u16 port, void *data, int
ret = false;
break;
case VIRTIO_PCI_STATUS:
- ioport__write8(data, console_device.status);
+ ioport__write8(data, cdev.status);
break;
case VIRTIO_PCI_ISR:
ioport__write8(data, 0x1);
kvm__irq_line(self, VIRTIO_CONSOLE_IRQ, 0);
break;
case VIRTIO_MSI_CONFIG_VECTOR:
- ioport__write16(data, console_device.config_vector);
+ ioport__write16(data, cdev.config_vector);
break;
default:
ret = virtio_console_pci_io_device_specific_in(data, offset, size, count);
};
- mutex_unlock(&console_device.mutex);
+ mutex_unlock(&cdev.mutex);
return ret;
}
static void virtio_console_handle_callback(struct kvm *self, void *param)
{
- struct iovec iov[VIRTIO_CONSOLE_QUEUE_SIZE];
- struct virt_queue *vq;
- u16 out, in;
- u16 head;
- u32 len;
+ struct iovec iov[VIRTIO_CONSOLE_QUEUE_SIZE];
+ struct virt_queue *vq;
+ u16 out, in;
+ u16 head;
+ u32 len;
vq = param;
@@ -166,58 +166,57 @@ static void virtio_console_handle_callback(struct kvm *self, void *param)
static bool virtio_console_pci_io_out(struct kvm *self, u16 port, void *data, int size, u32 count)
{
- unsigned long offset = port - IOPORT_VIRTIO_CONSOLE;
- bool ret = true;
+ unsigned long offset = port - IOPORT_VIRTIO_CONSOLE;
+ bool ret = true;
- mutex_lock(&console_device.mutex);
+ mutex_lock(&cdev.mutex);
switch (offset) {
case VIRTIO_PCI_GUEST_FEATURES:
- console_device.guest_features = ioport__read32(data);
+ cdev.guest_features = ioport__read32(data);
break;
case VIRTIO_PCI_QUEUE_PFN: {
struct virt_queue *queue;
void *p;
- assert(console_device.queue_selector < VIRTIO_CONSOLE_NUM_QUEUES);
+ assert(cdev.queue_selector < VIRTIO_CONSOLE_NUM_QUEUES);
- queue = &console_device.vqs[console_device.queue_selector];
+ queue = &cdev.vqs[cdev.queue_selector];
queue->pfn = ioport__read32(data);
p = guest_flat_to_host(self, queue->pfn << 12);
vring_init(&queue->vring, VIRTIO_CONSOLE_QUEUE_SIZE, p, 4096);
- if (console_device.queue_selector == VIRTIO_CONSOLE_TX_QUEUE)
- console_device.jobs[console_device.queue_selector] =
+ if (cdev.queue_selector == VIRTIO_CONSOLE_TX_QUEUE)
+ cdev.jobs[cdev.queue_selector] =
thread_pool__add_job(self, virtio_console_handle_callback, queue);
- else if (console_device.queue_selector == VIRTIO_CONSOLE_RX_QUEUE)
- console_device.jobs[console_device.queue_selector] =
+ else if (cdev.queue_selector == VIRTIO_CONSOLE_RX_QUEUE)
+ cdev.jobs[cdev.queue_selector] =
thread_pool__add_job(self, virtio_console__inject_interrupt_callback, queue);
break;
}
case VIRTIO_PCI_QUEUE_SEL:
- console_device.queue_selector = ioport__read16(data);
+ cdev.queue_selector = ioport__read16(data);
break;
case VIRTIO_PCI_QUEUE_NOTIFY: {
- u16 queue_index;
- queue_index = ioport__read16(data);
- thread_pool__do_job(console_device.jobs[queue_index]);
+ u16 queue_index = ioport__read16(data);
+ thread_pool__do_job(cdev.jobs[queue_index]);
break;
}
case VIRTIO_PCI_STATUS:
- console_device.status = ioport__read8(data);
+ cdev.status = ioport__read8(data);
break;
case VIRTIO_MSI_CONFIG_VECTOR:
- console_device.config_vector = VIRTIO_MSI_NO_VECTOR;
+ cdev.config_vector = VIRTIO_MSI_NO_VECTOR;
break;
case VIRTIO_MSI_QUEUE_VECTOR:
break;
default:
- ret = false;
+ ret = false;
};
- mutex_unlock(&console_device.mutex);
+ mutex_unlock(&cdev.mutex);
return ret;
}
--
1.7.5.rc3
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 4/5] kvm tools: virtio-net code cleanup
2011-05-05 18:34 [PATCH 1/5] kvm tools: Abolishment of uint*_t types Sasha Levin
2011-05-05 18:34 ` [PATCH 2/5] kvm tools: virtio-blk code cleanup Sasha Levin
2011-05-05 18:34 ` [PATCH 3/5] kvm tools: virtio-console " Sasha Levin
@ 2011-05-05 18:34 ` Sasha Levin
2011-05-05 18:34 ` [PATCH 5/5] kvm tools: virtio-rng " Sasha Levin
2011-05-05 19:02 ` [PATCH 1/5] kvm tools: Abolishment of uint*_t types Pekka Enberg
4 siblings, 0 replies; 7+ messages in thread
From: Sasha Levin @ 2011-05-05 18:34 UTC (permalink / raw)
To: penberg; +Cc: mingo, asias.hejun, gorcunov, prasadjoshi124, kvm, Sasha Levin
Clean coding style and naming within virtio-net.
Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
---
tools/kvm/virtio/net.c | 68 ++++++++++++++++++++++++------------------------
1 files changed, 34 insertions(+), 34 deletions(-)
diff --git a/tools/kvm/virtio/net.c b/tools/kvm/virtio/net.c
index f0d24fa..61910f2 100644
--- a/tools/kvm/virtio/net.c
+++ b/tools/kvm/virtio/net.c
@@ -20,14 +20,14 @@
#include <unistd.h>
#include <sys/wait.h>
-#define VIRTIO_NET_IRQ 14
-#define VIRTIO_NET_PIN 3
+#define VIRTIO_NET_IRQ 14
+#define VIRTIO_NET_PIN 3
-#define VIRTIO_NET_QUEUE_SIZE 128
-#define VIRTIO_NET_NUM_QUEUES 2
-#define VIRTIO_NET_RX_QUEUE 0
-#define VIRTIO_NET_TX_QUEUE 1
-#define PCI_VIRTIO_NET_DEVNUM 3
+#define VIRTIO_NET_QUEUE_SIZE 128
+#define VIRTIO_NET_NUM_QUEUES 2
+#define VIRTIO_NET_RX_QUEUE 0
+#define VIRTIO_NET_TX_QUEUE 1
+#define PCI_VIRTIO_NET_DEVNUM 3
struct net_device {
pthread_mutex_t mutex;
@@ -53,20 +53,20 @@ struct net_device {
};
static struct net_device net_device = {
- .mutex = PTHREAD_MUTEX_INITIALIZER,
+ .mutex = PTHREAD_MUTEX_INITIALIZER,
.net_config = {
- .mac = {0x00, 0x11, 0x22, 0x33, 0x44, 0x55},
- .status = VIRTIO_NET_S_LINK_UP,
+ .mac = {0x00, 0x11, 0x22, 0x33, 0x44, 0x55},
+ .status = VIRTIO_NET_S_LINK_UP,
},
- .host_features = 1UL << VIRTIO_NET_F_MAC |
- 1UL << VIRTIO_NET_F_CSUM |
- 1UL << VIRTIO_NET_F_HOST_UFO |
- 1UL << VIRTIO_NET_F_HOST_TSO4 |
- 1UL << VIRTIO_NET_F_HOST_TSO6 |
- 1UL << VIRTIO_NET_F_GUEST_UFO |
- 1UL << VIRTIO_NET_F_GUEST_TSO4 |
- 1UL << VIRTIO_NET_F_GUEST_TSO6,
+ .host_features = 1UL << VIRTIO_NET_F_MAC |
+ 1UL << VIRTIO_NET_F_CSUM |
+ 1UL << VIRTIO_NET_F_HOST_UFO |
+ 1UL << VIRTIO_NET_F_HOST_TSO4 |
+ 1UL << VIRTIO_NET_F_HOST_TSO6 |
+ 1UL << VIRTIO_NET_F_GUEST_UFO |
+ 1UL << VIRTIO_NET_F_GUEST_TSO4 |
+ 1UL << VIRTIO_NET_F_GUEST_TSO6,
};
static void *virtio_net_rx_thread(void *p)
@@ -78,8 +78,8 @@ static void *virtio_net_rx_thread(void *p)
u16 head;
int len;
- self = p;
- vq = &net_device.vqs[VIRTIO_NET_RX_QUEUE];
+ self = p;
+ vq = &net_device.vqs[VIRTIO_NET_RX_QUEUE];
while (1) {
mutex_lock(&net_device.io_rx_mutex);
@@ -88,8 +88,8 @@ static void *virtio_net_rx_thread(void *p)
mutex_unlock(&net_device.io_rx_mutex);
while (virt_queue__available(vq)) {
- head = virt_queue__get_iov(vq, iov, &out, &in, self);
- len = readv(net_device.tap_fd, iov, in);
+ head = virt_queue__get_iov(vq, iov, &out, &in, self);
+ len = readv(net_device.tap_fd, iov, in);
virt_queue__set_used_elem(vq, head, len);
/* We should interrupt guest right now, otherwise latency is huge. */
kvm__irq_line(self, VIRTIO_NET_IRQ, 1);
@@ -111,8 +111,8 @@ static void *virtio_net_tx_thread(void *p)
u16 head;
int len;
- self = p;
- vq = &net_device.vqs[VIRTIO_NET_TX_QUEUE];
+ self = p;
+ vq = &net_device.vqs[VIRTIO_NET_TX_QUEUE];
while (1) {
mutex_lock(&net_device.io_tx_mutex);
@@ -121,8 +121,8 @@ static void *virtio_net_tx_thread(void *p)
mutex_unlock(&net_device.io_tx_mutex);
while (virt_queue__available(vq)) {
- head = virt_queue__get_iov(vq, iov, &out, &in, self);
- len = writev(net_device.tap_fd, iov, out);
+ head = virt_queue__get_iov(vq, iov, &out, &in, self);
+ len = writev(net_device.tap_fd, iov, out);
virt_queue__set_used_elem(vq, head, len);
}
@@ -150,8 +150,8 @@ static bool virtio_net_pci_io_device_specific_in(void *data, unsigned long offse
static bool virtio_net_pci_io_in(struct kvm *self, u16 port, void *data, int size, u32 count)
{
- unsigned long offset = port - IOPORT_VIRTIO_NET;
- bool ret = true;
+ unsigned long offset = port - IOPORT_VIRTIO_NET;
+ bool ret = true;
mutex_lock(&net_device.mutex);
@@ -210,8 +210,8 @@ static void virtio_net_handle_callback(struct kvm *self, u16 queue_index)
static bool virtio_net_pci_io_out(struct kvm *self, u16 port, void *data, int size, u32 count)
{
- unsigned long offset = port - IOPORT_VIRTIO_NET;
- bool ret = true;
+ unsigned long offset = port - IOPORT_VIRTIO_NET;
+ bool ret = true;
mutex_lock(&net_device.mutex);
@@ -225,9 +225,9 @@ static bool virtio_net_pci_io_out(struct kvm *self, u16 port, void *data, int si
assert(net_device.queue_selector < VIRTIO_NET_NUM_QUEUES);
- queue = &net_device.vqs[net_device.queue_selector];
- queue->pfn = ioport__read32(data);
- p = guest_flat_to_host(self, queue->pfn << 12);
+ queue = &net_device.vqs[net_device.queue_selector];
+ queue->pfn = ioport__read32(data);
+ p = guest_flat_to_host(self, queue->pfn << 12);
vring_init(&queue->vring, VIRTIO_NET_QUEUE_SIZE, p, 4096);
@@ -251,7 +251,7 @@ static bool virtio_net_pci_io_out(struct kvm *self, u16 port, void *data, int si
case VIRTIO_MSI_QUEUE_VECTOR:
break;
default:
- ret = false;
+ ret = false;
};
mutex_unlock(&net_device.mutex);
--
1.7.5.rc3
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 5/5] kvm tools: virtio-rng code cleanup
2011-05-05 18:34 [PATCH 1/5] kvm tools: Abolishment of uint*_t types Sasha Levin
` (2 preceding siblings ...)
2011-05-05 18:34 ` [PATCH 4/5] kvm tools: virtio-net " Sasha Levin
@ 2011-05-05 18:34 ` Sasha Levin
2011-05-05 19:06 ` Ingo Molnar
2011-05-05 19:02 ` [PATCH 1/5] kvm tools: Abolishment of uint*_t types Pekka Enberg
4 siblings, 1 reply; 7+ messages in thread
From: Sasha Levin @ 2011-05-05 18:34 UTC (permalink / raw)
To: penberg; +Cc: mingo, asias.hejun, gorcunov, prasadjoshi124, kvm, Sasha Levin
Clean coding style and naming within virtio-rng.
Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
---
tools/kvm/virtio/rng.c | 77 +++++++++++++++++++++++------------------------
1 files changed, 38 insertions(+), 39 deletions(-)
diff --git a/tools/kvm/virtio/rng.c b/tools/kvm/virtio/rng.c
index 65fa48d..61eb27e 100644
--- a/tools/kvm/virtio/rng.c
+++ b/tools/kvm/virtio/rng.c
@@ -19,36 +19,35 @@
#include <sys/stat.h>
#include <pthread.h>
-#define PCI_VENDOR_ID_REDHAT_QUMRANET 0x1af4
-#define PCI_DEVICE_ID_VIRTIO_RNG 0x1004
+#define PCI_VENDOR_ID_REDHAT_QUMRANET 0x1af4
+#define PCI_DEVICE_ID_VIRTIO_RNG 0x1004
#define PCI_SUBSYSTEM_VENDOR_ID_REDHAT_QUMRANET 0x1af4
-#define PCI_SUBSYSTEM_ID_VIRTIO_RNG 0x0004
-#define PCI_VIRTIO_RNG_DEVNUM 4
+#define PCI_SUBSYSTEM_ID_VIRTIO_RNG 0x0004
+#define PCI_VIRTIO_RNG_DEVNUM 4
-#define VIRTIO_RNG_IRQ 11
-#define VIRTIO_RNG_PIN 1
+#define VIRTIO_RNG_IRQ 11
+#define VIRTIO_RNG_PIN 1
-#define NUM_VIRT_QUEUES 1
+#define NUM_VIRT_QUEUES 1
+#define VIRTIO_RNG_QUEUE_SIZE 128
-#define VIRTIO_RNG_QUEUE_SIZE 128
-
-struct rng_device {
- u8 status;
- u16 config_vector;
+struct rng_dev {
+ u8 status;
+ u16 config_vector;
int fd_rng;
/* virtio queue */
- u16 queue_selector;
- struct virt_queue vqs[NUM_VIRT_QUEUES];
- void *jobs[NUM_VIRT_QUEUES];
+ u16 queue_selector;
+ struct virt_queue vqs[NUM_VIRT_QUEUES];
+ void *jobs[NUM_VIRT_QUEUES];
};
-static struct rng_device rng_device;
+static struct rng_dev rdev;
static bool virtio_rng_pci_io_in(struct kvm *kvm, u16 port, void *data, int size, u32 count)
{
- unsigned long offset;
- bool ret = true;
+ unsigned long offset;
+ bool ret = true;
offset = port - IOPORT_VIRTIO_RNG;
@@ -60,20 +59,20 @@ static bool virtio_rng_pci_io_in(struct kvm *kvm, u16 port, void *data, int size
ret = false;
break;
case VIRTIO_PCI_QUEUE_PFN:
- ioport__write32(data, rng_device.vqs[rng_device.queue_selector].pfn);
+ ioport__write32(data, rdev.vqs[rdev.queue_selector].pfn);
break;
case VIRTIO_PCI_QUEUE_NUM:
ioport__write16(data, VIRTIO_RNG_QUEUE_SIZE);
break;
case VIRTIO_PCI_STATUS:
- ioport__write8(data, rng_device.status);
+ ioport__write8(data, rdev.status);
break;
case VIRTIO_PCI_ISR:
ioport__write8(data, 0x1);
kvm__irq_line(kvm, VIRTIO_RNG_IRQ, 0);
break;
case VIRTIO_MSI_CONFIG_VECTOR:
- ioport__write16(data, rng_device.config_vector);
+ ioport__write16(data, rdev.config_vector);
break;
default:
ret = false;
@@ -82,14 +81,14 @@ static bool virtio_rng_pci_io_in(struct kvm *kvm, u16 port, void *data, int size
return ret;
}
-static bool virtio_rng_do_io_request(struct kvm *self, struct virt_queue *queue)
+static bool virtio_rng_do_io_request(struct kvm *kvm, struct virt_queue *queue)
{
struct iovec iov[VIRTIO_RNG_QUEUE_SIZE];
u16 out, in, head;
unsigned int len = 0;
- head = virt_queue__get_iov(queue, iov, &out, &in, self);
- len = readv(rng_device.fd_rng, iov, in);
+ head = virt_queue__get_iov(queue, iov, &out, &in, kvm);
+ len = readv(rdev.fd_rng, iov, in);
virt_queue__set_used_elem(queue, head, len);
return true;
@@ -120,51 +119,51 @@ static bool virtio_rng_pci_io_out(struct kvm *kvm, u16 port, void *data, int siz
struct virt_queue *queue;
void *p;
- queue = &rng_device.vqs[rng_device.queue_selector];
+ queue = &rdev.vqs[rdev.queue_selector];
queue->pfn = ioport__read32(data);
- p = guest_flat_to_host(kvm, queue->pfn << 12);
+ p = guest_flat_to_host(kvm, queue->pfn << 12);
vring_init(&queue->vring, VIRTIO_RNG_QUEUE_SIZE, p, 4096);
- rng_device.jobs[rng_device.queue_selector] =
+ rdev.jobs[rdev.queue_selector] =
thread_pool__add_job(kvm, virtio_rng_do_io, queue);
break;
}
case VIRTIO_PCI_QUEUE_SEL:
- rng_device.queue_selector = ioport__read16(data);
+ rdev.queue_selector = ioport__read16(data);
break;
case VIRTIO_PCI_QUEUE_NOTIFY: {
u16 queue_index;
queue_index = ioport__read16(data);
- thread_pool__do_job(rng_device.jobs[queue_index]);
+ thread_pool__do_job(rdev.jobs[queue_index]);
break;
}
case VIRTIO_PCI_STATUS:
- rng_device.status = ioport__read8(data);
+ rdev.status = ioport__read8(data);
break;
case VIRTIO_MSI_CONFIG_VECTOR:
- rng_device.config_vector = VIRTIO_MSI_NO_VECTOR;
+ rdev.config_vector = VIRTIO_MSI_NO_VECTOR;
break;
default:
- ret = false;
+ ret = false;
};
return ret;
}
static struct ioport_operations virtio_rng_io_ops = {
- .io_in = virtio_rng_pci_io_in,
- .io_out = virtio_rng_pci_io_out,
+ .io_in = virtio_rng_pci_io_in,
+ .io_out = virtio_rng_pci_io_out,
};
static struct pci_device_header virtio_rng_pci_device = {
.vendor_id = PCI_VENDOR_ID_REDHAT_QUMRANET,
.device_id = PCI_DEVICE_ID_VIRTIO_RNG,
- .header_type = PCI_HEADER_TYPE_NORMAL,
- .revision_id = 0,
+ .header_type = PCI_HEADER_TYPE_NORMAL,
+ .revision_id = 0,
.class = 0x010000,
- .subsys_vendor_id = PCI_SUBSYSTEM_VENDOR_ID_REDHAT_QUMRANET,
+ .subsys_vendor_id = PCI_SUBSYSTEM_VENDOR_ID_REDHAT_QUMRANET,
.subsys_id = PCI_SUBSYSTEM_ID_VIRTIO_RNG,
.bar[0] = IOPORT_VIRTIO_RNG | PCI_BASE_ADDRESS_SPACE_IO,
.irq_pin = VIRTIO_RNG_PIN,
@@ -173,8 +172,8 @@ static struct pci_device_header virtio_rng_pci_device = {
void virtio_rng__init(struct kvm *kvm)
{
- rng_device.fd_rng = open("/dev/urandom", O_RDONLY);
- if (rng_device.fd_rng < 0)
+ rdev.fd_rng = open("/dev/urandom", O_RDONLY);
+ if (rdev.fd_rng < 0)
die("Failed initializing RNG");
pci__register(&virtio_rng_pci_device, PCI_VIRTIO_RNG_DEVNUM);
--
1.7.5.rc3
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 1/5] kvm tools: Abolishment of uint*_t types
2011-05-05 18:34 [PATCH 1/5] kvm tools: Abolishment of uint*_t types Sasha Levin
` (3 preceding siblings ...)
2011-05-05 18:34 ` [PATCH 5/5] kvm tools: virtio-rng " Sasha Levin
@ 2011-05-05 19:02 ` Pekka Enberg
4 siblings, 0 replies; 7+ messages in thread
From: Pekka Enberg @ 2011-05-05 19:02 UTC (permalink / raw)
To: Sasha Levin; +Cc: mingo, asias.hejun, gorcunov, prasadjoshi124, kvm
On Thu, 5 May 2011, Sasha Levin wrote:
> Clean uint*_t type from the code.
>
> Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Applied, thanks!
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 5/5] kvm tools: virtio-rng code cleanup
2011-05-05 18:34 ` [PATCH 5/5] kvm tools: virtio-rng " Sasha Levin
@ 2011-05-05 19:06 ` Ingo Molnar
0 siblings, 0 replies; 7+ messages in thread
From: Ingo Molnar @ 2011-05-05 19:06 UTC (permalink / raw)
To: Sasha Levin; +Cc: penberg, asias.hejun, gorcunov, prasadjoshi124, kvm
* Sasha Levin <levinsasha928@gmail.com> wrote:
> +struct rng_dev {
> + u8 status;
> + u16 config_vector;
> int fd_rng;
I think you forgot the fd_rng -> fd rename?
The cleanup series looks very nice otherwise:
Acked-by: Ingo Molnar <mingo@elte.hu>
Thanks,
Ingo
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2011-05-05 19:06 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-05-05 18:34 [PATCH 1/5] kvm tools: Abolishment of uint*_t types Sasha Levin
2011-05-05 18:34 ` [PATCH 2/5] kvm tools: virtio-blk code cleanup Sasha Levin
2011-05-05 18:34 ` [PATCH 3/5] kvm tools: virtio-console " Sasha Levin
2011-05-05 18:34 ` [PATCH 4/5] kvm tools: virtio-net " Sasha Levin
2011-05-05 18:34 ` [PATCH 5/5] kvm tools: virtio-rng " Sasha Levin
2011-05-05 19:06 ` Ingo Molnar
2011-05-05 19:02 ` [PATCH 1/5] kvm tools: Abolishment of uint*_t types Pekka Enberg
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox