* [Qemu-devel] [PATCH 0/4] Remove unused functions
@ 2015-02-16 21:41 Thomas Huth
2015-02-16 21:41 ` [Qemu-devel] [PATCH 1/4] migration: " Thomas Huth
` (3 more replies)
0 siblings, 4 replies; 10+ messages in thread
From: Thomas Huth @ 2015-02-16 21:41 UTC (permalink / raw)
To: qemu-trivial, qemu-devel; +Cc: Thomas Huth
There are quite a lot of completely unused functions scattered
around in the QEMU sources - here are some patches to remove at
least some of them.
Thomas Huth (4):
migration: Remove unused functions
ui/console: Removed unused functions
util: Remove unused functions
block: Remove unused functions
arch_init.c | 10 ----
block.c | 11 ----
include/block/block.h | 1 -
include/block/nbd.h | 1 -
include/migration/migration.h | 3 -
include/migration/qemu-file.h | 2 -
include/qemu-common.h | 4 --
include/qemu/compatfd.h | 1 -
include/qemu/option.h | 2 -
include/ui/console.h | 11 ----
include/ui/input.h | 1 -
include/ui/qemu-pixman.h | 3 -
migration/migration.c | 9 ----
migration/qemu-file-buf.c | 53 ---------------------
nbd.c | 9 ----
ui/console.c | 103 -----------------------------------------
ui/d3des.c | 9 ----
ui/d3des.h | 6 --
ui/input-legacy.c | 6 --
ui/input.c | 7 ---
ui/qemu-pixman.c | 19 --------
ui/vnc-jobs.c | 13 -----
ui/vnc-jobs.h | 1 -
util/compatfd.c | 19 --------
util/osdep.c | 66 --------------------------
util/qemu-option.c | 6 --
26 files changed, 0 insertions(+), 376 deletions(-)
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Qemu-devel] [PATCH 1/4] migration: Remove unused functions
2015-02-16 21:41 [Qemu-devel] [PATCH 0/4] Remove unused functions Thomas Huth
@ 2015-02-16 21:41 ` Thomas Huth
2015-02-16 21:41 ` [Qemu-devel] [PATCH 2/4] ui/console: Removed " Thomas Huth
` (2 subsequent siblings)
3 siblings, 0 replies; 10+ messages in thread
From: Thomas Huth @ 2015-02-16 21:41 UTC (permalink / raw)
To: qemu-trivial, qemu-devel; +Cc: Amit Shah, Thomas Huth, Juan Quintela
dup_mig_bytes_transferred(), skipped_mig_bytes_transferred(),
migrate_rdma_pin_all(), qsb_clone() and qsb_set_length()
are completely unused and thus can be deleted.
Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com>
Cc: Juan Quintela <quintela@redhat.com>
Cc: Amit Shah <amit.shah@redhat.com>
---
arch_init.c | 10 -------
include/migration/migration.h | 3 --
include/migration/qemu-file.h | 2 -
migration/migration.c | 9 -------
migration/qemu-file-buf.c | 53 -----------------------------------------
5 files changed, 0 insertions(+), 77 deletions(-)
diff --git a/arch_init.c b/arch_init.c
index 89c8fa4..ad5ce28 100644
--- a/arch_init.c
+++ b/arch_init.c
@@ -249,21 +249,11 @@ static void acct_clear(void)
memset(&acct_info, 0, sizeof(acct_info));
}
-uint64_t dup_mig_bytes_transferred(void)
-{
- return acct_info.dup_pages * TARGET_PAGE_SIZE;
-}
-
uint64_t dup_mig_pages_transferred(void)
{
return acct_info.dup_pages;
}
-uint64_t skipped_mig_bytes_transferred(void)
-{
- return acct_info.skipped_pages * TARGET_PAGE_SIZE;
-}
-
uint64_t skipped_mig_pages_transferred(void)
{
return acct_info.skipped_pages;
diff --git a/include/migration/migration.h b/include/migration/migration.h
index f37348b..7f6cdaa 100644
--- a/include/migration/migration.h
+++ b/include/migration/migration.h
@@ -115,9 +115,7 @@ void free_xbzrle_decoded_buf(void);
void acct_update_position(QEMUFile *f, size_t size, bool zero);
-uint64_t dup_mig_bytes_transferred(void);
uint64_t dup_mig_pages_transferred(void);
-uint64_t skipped_mig_bytes_transferred(void);
uint64_t skipped_mig_pages_transferred(void);
uint64_t norm_mig_bytes_transferred(void);
uint64_t norm_mig_pages_transferred(void);
@@ -143,7 +141,6 @@ void migrate_add_blocker(Error *reason);
*/
void migrate_del_blocker(Error *reason);
-bool migrate_rdma_pin_all(void);
bool migrate_zero_blocks(void);
bool migrate_auto_converge(void);
diff --git a/include/migration/qemu-file.h b/include/migration/qemu-file.h
index a923cec..45d7f71 100644
--- a/include/migration/qemu-file.h
+++ b/include/migration/qemu-file.h
@@ -133,9 +133,7 @@ bool qemu_file_mode_is_not_valid(const char *mode);
bool qemu_file_is_writable(QEMUFile *f);
QEMUSizedBuffer *qsb_create(const uint8_t *buffer, size_t len);
-QEMUSizedBuffer *qsb_clone(const QEMUSizedBuffer *);
void qsb_free(QEMUSizedBuffer *);
-size_t qsb_set_length(QEMUSizedBuffer *qsb, size_t length);
size_t qsb_get_length(const QEMUSizedBuffer *qsb);
ssize_t qsb_get_buffer(const QEMUSizedBuffer *, off_t start, size_t count,
uint8_t *buf);
diff --git a/migration/migration.c b/migration/migration.c
index b3adbc6..6f1a490 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -540,15 +540,6 @@ void qmp_migrate_set_downtime(double value, Error **errp)
max_downtime = (uint64_t)value;
}
-bool migrate_rdma_pin_all(void)
-{
- MigrationState *s;
-
- s = migrate_get_current();
-
- return s->enabled_capabilities[MIGRATION_CAPABILITY_RDMA_PIN_ALL];
-}
-
bool migrate_auto_converge(void)
{
MigrationState *s;
diff --git a/migration/qemu-file-buf.c b/migration/qemu-file-buf.c
index e97e0bd..3b79c09 100644
--- a/migration/qemu-file-buf.c
+++ b/migration/qemu-file-buf.c
@@ -124,28 +124,6 @@ size_t qsb_get_length(const QEMUSizedBuffer *qsb)
}
/**
- * Set the length of the buffer; the primary usage of this
- * function is to truncate the number of used bytes in the buffer.
- * The size will not be extended beyond the current number of
- * allocated bytes in the QEMUSizedBuffer.
- *
- * @qsb: A QEMUSizedBuffer
- * @new_len: The new length of bytes in the buffer
- *
- * Returns the number of bytes the buffer was truncated or extended
- * to.
- */
-size_t qsb_set_length(QEMUSizedBuffer *qsb, size_t new_len)
-{
- if (new_len <= qsb->size) {
- qsb->used = new_len;
- } else {
- qsb->used = qsb->size;
- }
- return qsb->used;
-}
-
-/**
* Get the iovec that holds the data for a given position @pos.
*
* @qsb: A QEMUSizedBuffer
@@ -361,37 +339,6 @@ ssize_t qsb_write_at(QEMUSizedBuffer *qsb, const uint8_t *source,
return count;
}
-/**
- * Create a deep copy of the given QEMUSizedBuffer.
- *
- * @qsb: A QEMUSizedBuffer
- *
- * Returns a clone of @qsb or NULL on allocation failure
- */
-QEMUSizedBuffer *qsb_clone(const QEMUSizedBuffer *qsb)
-{
- QEMUSizedBuffer *out = qsb_create(NULL, qsb_get_length(qsb));
- size_t i;
- ssize_t res;
- off_t pos = 0;
-
- if (!out) {
- return NULL;
- }
-
- for (i = 0; i < qsb->n_iov; i++) {
- res = qsb_write_at(out, qsb->iov[i].iov_base,
- pos, qsb->iov[i].iov_len);
- if (res < 0) {
- qsb_free(out);
- return NULL;
- }
- pos += res;
- }
-
- return out;
-}
-
typedef struct QEMUBuffer {
QEMUSizedBuffer *qsb;
QEMUFile *file;
--
1.7.1
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [Qemu-devel] [PATCH 2/4] ui/console: Removed unused functions
2015-02-16 21:41 [Qemu-devel] [PATCH 0/4] Remove unused functions Thomas Huth
2015-02-16 21:41 ` [Qemu-devel] [PATCH 1/4] migration: " Thomas Huth
@ 2015-02-16 21:41 ` Thomas Huth
2015-02-17 8:21 ` Gerd Hoffmann
2015-02-16 21:41 ` [Qemu-devel] [PATCH 3/4] util: Remove " Thomas Huth
2015-02-16 21:41 ` [Qemu-devel] [PATCH 4/4] block: " Thomas Huth
3 siblings, 1 reply; 10+ messages in thread
From: Thomas Huth @ 2015-02-16 21:41 UTC (permalink / raw)
To: qemu-trivial, qemu-devel; +Cc: Thomas Huth, Anthony Liguori, Gerd Hoffmann
Remove dpy_gfx_update_dirty(), qemu_console_get_head(),
qemu_console_get_ui_info(), qemu_console_get_width(),
qemu_console_get_height(), emu_console_displaystate(),
qemu_different_endianness_pixelformat(), void cpkey(),
qemu_pixman_linebuf_copy(), qemu_pixman_color(),
emu_remove_kbd_event_handler() and vnc_stop_worker_thread()
since they are completely unused.
Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com>
Cc: Anthony Liguori <aliguori@amazon.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
---
include/ui/console.h | 11 -----
include/ui/input.h | 1 -
include/ui/qemu-pixman.h | 3 -
ui/console.c | 103 ----------------------------------------------
ui/d3des.c | 9 ----
ui/d3des.h | 6 ---
ui/input-legacy.c | 6 ---
ui/input.c | 7 ---
ui/qemu-pixman.c | 19 --------
ui/vnc-jobs.c | 13 ------
ui/vnc-jobs.h | 1 -
11 files changed, 0 insertions(+), 179 deletions(-)
diff --git a/include/ui/console.h b/include/ui/console.h
index 8a4d671..abba208 100644
--- a/include/ui/console.h
+++ b/include/ui/console.h
@@ -36,7 +36,6 @@ typedef struct QEMUPutLEDEntry QEMUPutLEDEntry;
QEMUPutKbdEntry *qemu_add_kbd_event_handler(QEMUPutKBDEvent *func,
void *opaque);
-void qemu_remove_kbd_event_handler(QEMUPutKbdEntry *entry);
QEMUPutMouseEntry *qemu_add_mouse_event_handler(QEMUPutMouseEvent *func,
void *opaque, int absolute,
const char *name);
@@ -194,7 +193,6 @@ DisplaySurface *qemu_create_displaysurface_guestmem(int width, int height,
pixman_format_code_t format,
int linesize,
uint64_t addr);
-PixelFormat qemu_different_endianness_pixelformat(int bpp);
PixelFormat qemu_default_pixelformat(int bpp);
DisplaySurface *qemu_create_displaysurface(int width, int height);
@@ -233,10 +231,6 @@ void dpy_text_resize(QemuConsole *con, int w, int h);
void dpy_mouse_set(QemuConsole *con, int x, int y, int on);
void dpy_cursor_define(QemuConsole *con, QEMUCursor *cursor);
bool dpy_cursor_define_supported(QemuConsole *con);
-void dpy_gfx_update_dirty(QemuConsole *con,
- MemoryRegion *address_space,
- uint64_t base,
- bool invalidate);
bool dpy_gfx_check_format(QemuConsole *con,
pixman_format_code_t format);
@@ -310,10 +304,6 @@ bool qemu_console_is_visible(QemuConsole *con);
bool qemu_console_is_graphic(QemuConsole *con);
bool qemu_console_is_fixedsize(QemuConsole *con);
int qemu_console_get_index(QemuConsole *con);
-uint32_t qemu_console_get_head(QemuConsole *con);
-QemuUIInfo *qemu_console_get_ui_info(QemuConsole *con);
-int qemu_console_get_width(QemuConsole *con, int fallback);
-int qemu_console_get_height(QemuConsole *con, int fallback);
void text_consoles_set_display(DisplayState *ds);
void console_select(unsigned int index);
@@ -322,7 +312,6 @@ void qemu_console_resize(QemuConsole *con, int width, int height);
void qemu_console_copy(QemuConsole *con, int src_x, int src_y,
int dst_x, int dst_y, int w, int h);
DisplaySurface *qemu_console_surface(QemuConsole *con);
-DisplayState *qemu_console_displaystate(QemuConsole *console);
/* sdl.c */
void sdl_display_init(DisplayState *ds, int full_screen, int no_frame);
diff --git a/include/ui/input.h b/include/ui/input.h
index 5d5ac00..d50ea9d 100644
--- a/include/ui/input.h
+++ b/include/ui/input.h
@@ -27,7 +27,6 @@ struct QemuInputHandler {
QemuInputHandlerState *qemu_input_handler_register(DeviceState *dev,
QemuInputHandler *handler);
void qemu_input_handler_activate(QemuInputHandlerState *s);
-void qemu_input_handler_deactivate(QemuInputHandlerState *s);
void qemu_input_handler_unregister(QemuInputHandlerState *s);
void qemu_input_handler_bind(QemuInputHandlerState *s,
const char *device_id, int head,
diff --git a/include/ui/qemu-pixman.h b/include/ui/qemu-pixman.h
index 3dee576..29c575c 100644
--- a/include/ui/qemu-pixman.h
+++ b/include/ui/qemu-pixman.h
@@ -44,13 +44,10 @@ pixman_image_t *qemu_pixman_linebuf_create(pixman_format_code_t format,
int width);
void qemu_pixman_linebuf_fill(pixman_image_t *linebuf, pixman_image_t *fb,
int width, int x, int y);
-void qemu_pixman_linebuf_copy(pixman_image_t *fb, int width, int x, int y,
- pixman_image_t *linebuf);
pixman_image_t *qemu_pixman_mirror_create(pixman_format_code_t format,
pixman_image_t *image);
void qemu_pixman_image_unref(pixman_image_t *image);
-pixman_color_t qemu_pixman_color(PixelFormat *pf, uint32_t color);
pixman_image_t *qemu_pixman_glyph_from_vgafont(int height, const uint8_t *font,
unsigned int ch);
void qemu_pixman_glyph_render(pixman_image_t *glyph,
diff --git a/ui/console.c b/ui/console.c
index 87574a7..74854dd 100644
--- a/ui/console.c
+++ b/ui/console.c
@@ -1599,67 +1599,6 @@ bool dpy_cursor_define_supported(QemuConsole *con)
return false;
}
-/*
- * Call dpy_gfx_update for all dirity scanlines. Works for
- * DisplaySurfaces backed by guest memory (i.e. the ones created
- * using qemu_create_displaysurface_guestmem).
- */
-void dpy_gfx_update_dirty(QemuConsole *con,
- MemoryRegion *address_space,
- hwaddr base,
- bool invalidate)
-{
- DisplaySurface *ds = qemu_console_surface(con);
- int width = surface_stride(ds);
- int height = surface_height(ds);
- hwaddr size = width * height;
- MemoryRegionSection mem_section;
- MemoryRegion *mem;
- ram_addr_t addr;
- int first, last, i;
- bool dirty;
-
- mem_section = memory_region_find(address_space, base, size);
- mem = mem_section.mr;
- if (int128_get64(mem_section.size) != size ||
- !memory_region_is_ram(mem_section.mr)) {
- goto out;
- }
- assert(mem);
-
- memory_region_sync_dirty_bitmap(mem);
- addr = mem_section.offset_within_region;
-
- first = -1;
- last = -1;
- for (i = 0; i < height; i++, addr += width) {
- dirty = invalidate ||
- memory_region_get_dirty(mem, addr, width, DIRTY_MEMORY_VGA);
- if (dirty) {
- if (first == -1) {
- first = i;
- }
- last = i;
- }
- if (first != -1 && !dirty) {
- assert(last != -1 && last >= first);
- dpy_gfx_update(con, 0, first, surface_width(ds),
- last - first + 1);
- first = -1;
- }
- }
- if (first != -1) {
- assert(last != -1 && last >= first);
- dpy_gfx_update(con, 0, first, surface_width(ds),
- last - first + 1);
- }
-
- memory_region_reset_dirty(mem, mem_section.offset_within_region, size,
- DIRTY_MEMORY_VGA);
-out:
- memory_region_unref(mem);
-}
-
/***********************************************************/
/* register display */
@@ -1796,36 +1735,6 @@ int qemu_console_get_index(QemuConsole *con)
return con ? con->index : -1;
}
-uint32_t qemu_console_get_head(QemuConsole *con)
-{
- if (con == NULL) {
- con = active_console;
- }
- return con ? con->head : -1;
-}
-
-QemuUIInfo *qemu_console_get_ui_info(QemuConsole *con)
-{
- assert(con != NULL);
- return &con->ui_info;
-}
-
-int qemu_console_get_width(QemuConsole *con, int fallback)
-{
- if (con == NULL) {
- con = active_console;
- }
- return con ? surface_width(con->surface) : fallback;
-}
-
-int qemu_console_get_height(QemuConsole *con, int fallback)
-{
- if (con == NULL) {
- con = active_console;
- }
- return con ? surface_height(con->surface) : fallback;
-}
-
static void text_console_set_echo(CharDriverState *chr, bool echo)
{
QemuConsole *s = chr->opaque;
@@ -2005,18 +1914,6 @@ DisplaySurface *qemu_console_surface(QemuConsole *console)
return console->surface;
}
-DisplayState *qemu_console_displaystate(QemuConsole *console)
-{
- return console->ds;
-}
-
-PixelFormat qemu_different_endianness_pixelformat(int bpp)
-{
- pixman_format_code_t fmt = qemu_default_pixman_format(bpp, false);
- PixelFormat pf = qemu_pixelformat_from_pixman(fmt);
- return pf;
-}
-
PixelFormat qemu_default_pixelformat(int bpp)
{
pixman_format_code_t fmt = qemu_default_pixman_format(bpp, true);
diff --git a/ui/d3des.c b/ui/d3des.c
index 60c840e..5bc99b8 100644
--- a/ui/d3des.c
+++ b/ui/d3des.c
@@ -121,15 +121,6 @@ static void cookey(register unsigned long *raw1)
return;
}
-void cpkey(register unsigned long *into)
-{
- register unsigned long *from, *endp;
-
- from = KnL, endp = &KnL[32];
- while( from < endp ) *into++ = *from++;
- return;
- }
-
void usekey(register unsigned long *from)
{
register unsigned long *to, *endp;
diff --git a/ui/d3des.h b/ui/d3des.h
index 70cb6b5..773667e 100644
--- a/ui/d3des.h
+++ b/ui/d3des.h
@@ -36,12 +36,6 @@ void usekey(unsigned long *);
* Loads the internal key register with the data in cookedkey.
*/
-void cpkey(unsigned long *);
-/* cookedkey[32]
- * Copies the contents of the internal key register into the storage
- * located at &cookedkey[0].
- */
-
void des(unsigned char *, unsigned char *);
/* from[8] to[8]
* Encrypts/Decrypts (according to the key currently loaded in the
diff --git a/ui/input-legacy.c b/ui/input-legacy.c
index a698a34..2d4ca19 100644
--- a/ui/input-legacy.c
+++ b/ui/input-legacy.c
@@ -143,12 +143,6 @@ QEMUPutKbdEntry *qemu_add_kbd_event_handler(QEMUPutKBDEvent *func, void *opaque)
return entry;
}
-void qemu_remove_kbd_event_handler(QEMUPutKbdEntry *entry)
-{
- qemu_input_handler_unregister(entry->s);
- g_free(entry);
-}
-
static void legacy_mouse_event(DeviceState *dev, QemuConsole *src,
InputEvent *evt)
{
diff --git a/ui/input.c b/ui/input.c
index 7ba99e5..50499a1 100644
--- a/ui/input.c
+++ b/ui/input.c
@@ -61,13 +61,6 @@ void qemu_input_handler_activate(QemuInputHandlerState *s)
qemu_input_check_mode_change();
}
-void qemu_input_handler_deactivate(QemuInputHandlerState *s)
-{
- QTAILQ_REMOVE(&handlers, s, node);
- QTAILQ_INSERT_TAIL(&handlers, s, node);
- qemu_input_check_mode_change();
-}
-
void qemu_input_handler_unregister(QemuInputHandlerState *s)
{
QTAILQ_REMOVE(&handlers, s, node);
diff --git a/ui/qemu-pixman.c b/ui/qemu-pixman.c
index 4116e15..6587c00 100644
--- a/ui/qemu-pixman.c
+++ b/ui/qemu-pixman.c
@@ -168,14 +168,6 @@ void qemu_pixman_linebuf_fill(pixman_image_t *linebuf, pixman_image_t *fb,
x, y, 0, 0, 0, 0, width, 1);
}
-/* copy linebuf to framebuffer */
-void qemu_pixman_linebuf_copy(pixman_image_t *fb, int width, int x, int y,
- pixman_image_t *linebuf)
-{
- pixman_image_composite(PIXMAN_OP_SRC, linebuf, NULL, fb,
- 0, 0, 0, 0, x, y, width, 1);
-}
-
pixman_image_t *qemu_pixman_mirror_create(pixman_format_code_t format,
pixman_image_t *image)
{
@@ -197,17 +189,6 @@ void qemu_pixman_image_unref(pixman_image_t *image)
pixman_image_unref(image);
}
-pixman_color_t qemu_pixman_color(PixelFormat *pf, uint32_t color)
-{
- pixman_color_t c;
-
- c.red = ((color & pf->rmask) >> pf->rshift) << (16 - pf->rbits);
- c.green = ((color & pf->gmask) >> pf->gshift) << (16 - pf->gbits);
- c.blue = ((color & pf->bmask) >> pf->bshift) << (16 - pf->bbits);
- c.alpha = ((color & pf->amask) >> pf->ashift) << (16 - pf->abits);
- return c;
-}
-
pixman_image_t *qemu_pixman_glyph_from_vgafont(int height, const uint8_t *font,
unsigned int ch)
{
diff --git a/ui/vnc-jobs.c b/ui/vnc-jobs.c
index 68f3d77..c8ee203 100644
--- a/ui/vnc-jobs.c
+++ b/ui/vnc-jobs.c
@@ -342,16 +342,3 @@ void vnc_start_worker_thread(void)
QEMU_THREAD_DETACHED);
queue = q; /* Set global queue */
}
-
-void vnc_stop_worker_thread(void)
-{
- if (!vnc_worker_thread_running())
- return ;
-
- /* Remove all jobs and wake up the thread */
- vnc_lock_queue(queue);
- queue->exit = true;
- vnc_unlock_queue(queue);
- vnc_jobs_clear(NULL);
- qemu_cond_broadcast(&queue->cond);
-}
diff --git a/ui/vnc-jobs.h b/ui/vnc-jobs.h
index 31da103..044bf9f 100644
--- a/ui/vnc-jobs.h
+++ b/ui/vnc-jobs.h
@@ -40,7 +40,6 @@ void vnc_jobs_join(VncState *vs);
void vnc_jobs_consume_buffer(VncState *vs);
void vnc_start_worker_thread(void);
-void vnc_stop_worker_thread(void);
/* Locks */
static inline int vnc_trylock_display(VncDisplay *vd)
--
1.7.1
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [Qemu-devel] [PATCH 3/4] util: Remove unused functions
2015-02-16 21:41 [Qemu-devel] [PATCH 0/4] Remove unused functions Thomas Huth
2015-02-16 21:41 ` [Qemu-devel] [PATCH 1/4] migration: " Thomas Huth
2015-02-16 21:41 ` [Qemu-devel] [PATCH 2/4] ui/console: Removed " Thomas Huth
@ 2015-02-16 21:41 ` Thomas Huth
2015-02-17 8:55 ` Markus Armbruster
2015-02-16 21:41 ` [Qemu-devel] [PATCH 4/4] block: " Thomas Huth
3 siblings, 1 reply; 10+ messages in thread
From: Thomas Huth @ 2015-02-16 21:41 UTC (permalink / raw)
To: qemu-trivial, qemu-devel; +Cc: Thomas Huth
Delete the unused functions qemu_opt_get_number_del(),
qemu_signalfd_available(), qemu_send_full() and qemu_recv_full().
Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com>
---
include/qemu-common.h | 4 ---
include/qemu/compatfd.h | 1 -
include/qemu/option.h | 2 -
util/compatfd.c | 19 -------------
util/osdep.c | 66 -----------------------------------------------
util/qemu-option.c | 6 ----
6 files changed, 0 insertions(+), 98 deletions(-)
diff --git a/include/qemu-common.h b/include/qemu-common.h
index 644b46d..0aac082 100644
--- a/include/qemu-common.h
+++ b/include/qemu-common.h
@@ -217,10 +217,6 @@ void *qemu_oom_check(void *ptr);
ssize_t qemu_write_full(int fd, const void *buf, size_t count)
QEMU_WARN_UNUSED_RESULT;
-ssize_t qemu_send_full(int fd, const void *buf, size_t count, int flags)
- QEMU_WARN_UNUSED_RESULT;
-ssize_t qemu_recv_full(int fd, void *buf, size_t count, int flags)
- QEMU_WARN_UNUSED_RESULT;
#ifndef _WIN32
int qemu_pipe(int pipefd[2]);
diff --git a/include/qemu/compatfd.h b/include/qemu/compatfd.h
index 6b04877..fc37915 100644
--- a/include/qemu/compatfd.h
+++ b/include/qemu/compatfd.h
@@ -39,6 +39,5 @@ struct qemu_signalfd_siginfo {
};
int qemu_signalfd(const sigset_t *mask);
-bool qemu_signalfd_available(void);
#endif
diff --git a/include/qemu/option.h b/include/qemu/option.h
index 58c0157..9fdec02 100644
--- a/include/qemu/option.h
+++ b/include/qemu/option.h
@@ -89,8 +89,6 @@ bool qemu_opt_get_bool(QemuOpts *opts, const char *name, bool defval);
uint64_t qemu_opt_get_number(QemuOpts *opts, const char *name, uint64_t defval);
uint64_t qemu_opt_get_size(QemuOpts *opts, const char *name, uint64_t defval);
bool qemu_opt_get_bool_del(QemuOpts *opts, const char *name, bool defval);
-uint64_t qemu_opt_get_number_del(QemuOpts *opts, const char *name,
- uint64_t defval);
uint64_t qemu_opt_get_size_del(QemuOpts *opts, const char *name,
uint64_t defval);
int qemu_opt_unset(QemuOpts *opts, const char *name);
diff --git a/util/compatfd.c b/util/compatfd.c
index 341ada6..e857150 100644
--- a/util/compatfd.c
+++ b/util/compatfd.c
@@ -108,22 +108,3 @@ int qemu_signalfd(const sigset_t *mask)
return qemu_signalfd_compat(mask);
}
-
-bool qemu_signalfd_available(void)
-{
-#ifdef CONFIG_SIGNALFD
- sigset_t mask;
- int fd;
- bool ok;
- sigemptyset(&mask);
- errno = 0;
- fd = syscall(SYS_signalfd, -1, &mask, _NSIG / 8);
- ok = (errno != ENOSYS);
- if (fd >= 0) {
- close(fd);
- }
- return ok;
-#else
- return false;
-#endif
-}
diff --git a/util/osdep.c b/util/osdep.c
index b2bd154..f938b69 100644
--- a/util/osdep.c
+++ b/util/osdep.c
@@ -310,72 +310,6 @@ int qemu_accept(int s, struct sockaddr *addr, socklen_t *addrlen)
return ret;
}
-/*
- * A variant of send(2) which handles partial write.
- *
- * Return the number of bytes transferred, which is only
- * smaller than `count' if there is an error.
- *
- * This function won't work with non-blocking fd's.
- * Any of the possibilities with non-bloking fd's is bad:
- * - return a short write (then name is wrong)
- * - busy wait adding (errno == EAGAIN) to the loop
- */
-ssize_t qemu_send_full(int fd, const void *buf, size_t count, int flags)
-{
- ssize_t ret = 0;
- ssize_t total = 0;
-
- while (count) {
- ret = send(fd, buf, count, flags);
- if (ret < 0) {
- if (errno == EINTR) {
- continue;
- }
- break;
- }
-
- count -= ret;
- buf += ret;
- total += ret;
- }
-
- return total;
-}
-
-/*
- * A variant of recv(2) which handles partial write.
- *
- * Return the number of bytes transferred, which is only
- * smaller than `count' if there is an error.
- *
- * This function won't work with non-blocking fd's.
- * Any of the possibilities with non-bloking fd's is bad:
- * - return a short write (then name is wrong)
- * - busy wait adding (errno == EAGAIN) to the loop
- */
-ssize_t qemu_recv_full(int fd, void *buf, size_t count, int flags)
-{
- ssize_t ret = 0;
- ssize_t total = 0;
-
- while (count) {
- ret = qemu_recv(fd, buf, count, flags);
- if (ret <= 0) {
- if (ret < 0 && errno == EINTR) {
- continue;
- }
- break;
- }
-
- count -= ret;
- buf += ret;
- total += ret;
- }
-
- return total;
-}
-
void qemu_set_version(const char *version)
{
qemu_version = version;
diff --git a/util/qemu-option.c b/util/qemu-option.c
index d3ab65d..0e408eb 100644
--- a/util/qemu-option.c
+++ b/util/qemu-option.c
@@ -433,12 +433,6 @@ uint64_t qemu_opt_get_number(QemuOpts *opts, const char *name, uint64_t defval)
return qemu_opt_get_number_helper(opts, name, defval, false);
}
-uint64_t qemu_opt_get_number_del(QemuOpts *opts, const char *name,
- uint64_t defval)
-{
- return qemu_opt_get_number_helper(opts, name, defval, true);
-}
-
static uint64_t qemu_opt_get_size_helper(QemuOpts *opts, const char *name,
uint64_t defval, bool del)
{
--
1.7.1
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [Qemu-devel] [PATCH 4/4] block: Remove unused functions
2015-02-16 21:41 [Qemu-devel] [PATCH 0/4] Remove unused functions Thomas Huth
` (2 preceding siblings ...)
2015-02-16 21:41 ` [Qemu-devel] [PATCH 3/4] util: Remove " Thomas Huth
@ 2015-02-16 21:41 ` Thomas Huth
2015-02-16 22:26 ` Max Reitz
3 siblings, 1 reply; 10+ messages in thread
From: Thomas Huth @ 2015-02-16 21:41 UTC (permalink / raw)
To: qemu-trivial, qemu-devel
Cc: Kevin Wolf, Paolo Bonzini, Thomas Huth, Stefan Hajnoczi
qemu_try_blockalign0() and nbd_export_close_all() are not
used anymore and thus can be removed.
Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com>
Cc: Kevin Wolf <kwolf@redhat.com>
Cc: Stefan Hajnoczi <stefanha@redhat.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
---
block.c | 11 -----------
include/block/block.h | 1 -
include/block/nbd.h | 1 -
nbd.c | 9 ---------
4 files changed, 0 insertions(+), 22 deletions(-)
diff --git a/block.c b/block.c
index 210fd5f..2128f82 100644
--- a/block.c
+++ b/block.c
@@ -5335,17 +5335,6 @@ void *qemu_try_blockalign(BlockDriverState *bs, size_t size)
return qemu_try_memalign(align, size);
}
-void *qemu_try_blockalign0(BlockDriverState *bs, size_t size)
-{
- void *mem = qemu_try_blockalign(bs, size);
-
- if (mem) {
- memset(mem, 0, size);
- }
-
- return mem;
-}
-
/*
* Check if all memory in this vector is sector aligned.
*/
diff --git a/include/block/block.h b/include/block/block.h
index 321295e..7ee9ab3 100644
--- a/include/block/block.h
+++ b/include/block/block.h
@@ -433,7 +433,6 @@ void bdrv_set_guest_block_size(BlockDriverState *bs, int align);
void *qemu_blockalign(BlockDriverState *bs, size_t size);
void *qemu_blockalign0(BlockDriverState *bs, size_t size);
void *qemu_try_blockalign(BlockDriverState *bs, size_t size);
-void *qemu_try_blockalign0(BlockDriverState *bs, size_t size);
bool bdrv_qiov_is_aligned(BlockDriverState *bs, QEMUIOVector *qiov);
struct HBitmapIter;
diff --git a/include/block/nbd.h b/include/block/nbd.h
index b759595..fccef2d 100644
--- a/include/block/nbd.h
+++ b/include/block/nbd.h
@@ -95,7 +95,6 @@ BlockBackend *nbd_export_get_blockdev(NBDExport *exp);
NBDExport *nbd_export_find(const char *name);
void nbd_export_set_name(NBDExport *exp, const char *name);
-void nbd_export_close_all(void);
NBDClient *nbd_client_new(NBDExport *exp, int csock,
void (*close)(NBDClient *));
diff --git a/nbd.c b/nbd.c
index e56afbc..634bf84 100644
--- a/nbd.c
+++ b/nbd.c
@@ -1067,15 +1067,6 @@ BlockBackend *nbd_export_get_blockdev(NBDExport *exp)
return exp->blk;
}
-void nbd_export_close_all(void)
-{
- NBDExport *exp, *next;
-
- QTAILQ_FOREACH_SAFE(exp, &exports, next, next) {
- nbd_export_close(exp);
- }
-}
-
static ssize_t nbd_co_send_reply(NBDRequest *req, struct nbd_reply *reply,
int len)
{
--
1.7.1
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [Qemu-devel] [PATCH 4/4] block: Remove unused functions
2015-02-16 21:41 ` [Qemu-devel] [PATCH 4/4] block: " Thomas Huth
@ 2015-02-16 22:26 ` Max Reitz
2015-02-17 8:15 ` Thomas Huth
0 siblings, 1 reply; 10+ messages in thread
From: Max Reitz @ 2015-02-16 22:26 UTC (permalink / raw)
To: Thomas Huth, qemu-trivial, qemu-devel
Cc: Kevin Wolf, Paolo Bonzini, Stefan Hajnoczi
On 2015-02-16 at 16:41, Thomas Huth wrote:
> qemu_try_blockalign0() and nbd_export_close_all() are not
> used anymore and thus can be removed.
>
> Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com>
> Cc: Kevin Wolf <kwolf@redhat.com>
> Cc: Stefan Hajnoczi <stefanha@redhat.com>
> Cc: Paolo Bonzini <pbonzini@redhat.com>
> ---
> block.c | 11 -----------
> include/block/block.h | 1 -
> include/block/nbd.h | 1 -
> nbd.c | 9 ---------
> 4 files changed, 0 insertions(+), 22 deletions(-)
NACK, I'm using nbd_export_close_all() in my "block: Rework
bdrv_close_all()" series.
I'm not so sure about qemu_try_blockalign0(); it has never been used,
but I introduced it because we have qemu_blockalign(),
qemu_try_blockalign(), and qemu_blockalign0() (the latter of which I
introduced along with qemu_try_blockalign0(), and this function is used).
So I'd be fine with removing qemu_try_blockalign0() again, but I don't
really see the point in doing so. It is not a function that is per-se
deprecated or something, quite the opposite, actually. If people can
make use of that function, they should most certainly do so.
Max
> diff --git a/block.c b/block.c
> index 210fd5f..2128f82 100644
> --- a/block.c
> +++ b/block.c
> @@ -5335,17 +5335,6 @@ void *qemu_try_blockalign(BlockDriverState *bs, size_t size)
> return qemu_try_memalign(align, size);
> }
>
> -void *qemu_try_blockalign0(BlockDriverState *bs, size_t size)
> -{
> - void *mem = qemu_try_blockalign(bs, size);
> -
> - if (mem) {
> - memset(mem, 0, size);
> - }
> -
> - return mem;
> -}
> -
> /*
> * Check if all memory in this vector is sector aligned.
> */
> diff --git a/include/block/block.h b/include/block/block.h
> index 321295e..7ee9ab3 100644
> --- a/include/block/block.h
> +++ b/include/block/block.h
> @@ -433,7 +433,6 @@ void bdrv_set_guest_block_size(BlockDriverState *bs, int align);
> void *qemu_blockalign(BlockDriverState *bs, size_t size);
> void *qemu_blockalign0(BlockDriverState *bs, size_t size);
> void *qemu_try_blockalign(BlockDriverState *bs, size_t size);
> -void *qemu_try_blockalign0(BlockDriverState *bs, size_t size);
> bool bdrv_qiov_is_aligned(BlockDriverState *bs, QEMUIOVector *qiov);
>
> struct HBitmapIter;
> diff --git a/include/block/nbd.h b/include/block/nbd.h
> index b759595..fccef2d 100644
> --- a/include/block/nbd.h
> +++ b/include/block/nbd.h
> @@ -95,7 +95,6 @@ BlockBackend *nbd_export_get_blockdev(NBDExport *exp);
>
> NBDExport *nbd_export_find(const char *name);
> void nbd_export_set_name(NBDExport *exp, const char *name);
> -void nbd_export_close_all(void);
>
> NBDClient *nbd_client_new(NBDExport *exp, int csock,
> void (*close)(NBDClient *));
> diff --git a/nbd.c b/nbd.c
> index e56afbc..634bf84 100644
> --- a/nbd.c
> +++ b/nbd.c
> @@ -1067,15 +1067,6 @@ BlockBackend *nbd_export_get_blockdev(NBDExport *exp)
> return exp->blk;
> }
>
> -void nbd_export_close_all(void)
> -{
> - NBDExport *exp, *next;
> -
> - QTAILQ_FOREACH_SAFE(exp, &exports, next, next) {
> - nbd_export_close(exp);
> - }
> -}
> -
> static ssize_t nbd_co_send_reply(NBDRequest *req, struct nbd_reply *reply,
> int len)
> {
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [Qemu-devel] [PATCH 4/4] block: Remove unused functions
2015-02-16 22:26 ` Max Reitz
@ 2015-02-17 8:15 ` Thomas Huth
0 siblings, 0 replies; 10+ messages in thread
From: Thomas Huth @ 2015-02-17 8:15 UTC (permalink / raw)
To: Max Reitz
Cc: qemu-trivial, Kevin Wolf, qemu-devel, Stefan Hajnoczi, Paolo Bonzini
Hi Max,
On Mon, 16 Feb 2015 17:26:56 -0500
Max Reitz <mreitz@redhat.com> wrote:
> On 2015-02-16 at 16:41, Thomas Huth wrote:
> > qemu_try_blockalign0() and nbd_export_close_all() are not
> > used anymore and thus can be removed.
> >
> > Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com>
> > Cc: Kevin Wolf <kwolf@redhat.com>
> > Cc: Stefan Hajnoczi <stefanha@redhat.com>
> > Cc: Paolo Bonzini <pbonzini@redhat.com>
> > ---
> > block.c | 11 -----------
> > include/block/block.h | 1 -
> > include/block/nbd.h | 1 -
> > nbd.c | 9 ---------
> > 4 files changed, 0 insertions(+), 22 deletions(-)
>
> NACK, I'm using nbd_export_close_all() in my "block: Rework
> bdrv_close_all()" series.
Alright, if it's going to be used again, then it must not be removed,
of course.
> I'm not so sure about qemu_try_blockalign0(); it has never been used,
> but I introduced it because we have qemu_blockalign(),
> qemu_try_blockalign(), and qemu_blockalign0() (the latter of which I
> introduced along with qemu_try_blockalign0(), and this function is used).
>
> So I'd be fine with removing qemu_try_blockalign0() again, but I don't
> really see the point in doing so. It is not a function that is per-se
> deprecated or something, quite the opposite, actually. If people can
> make use of that function, they should most certainly do so.
I'm not a big fan of providing unused (and likely untested) functions
just because they could be used somewhen in a distant future (unless
they are part of a proper library) ... I'd rather add such functions
again when they are really being used.
Anyway, this is just a small, trivial function, and if you prefer to
keep it, then please ignore this patch simply completely. There is
certainly no urgent need for removing unused functions, I just wanted
to make people aware that there are some.
Thomas
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [Qemu-devel] [PATCH 2/4] ui/console: Removed unused functions
2015-02-16 21:41 ` [Qemu-devel] [PATCH 2/4] ui/console: Removed " Thomas Huth
@ 2015-02-17 8:21 ` Gerd Hoffmann
0 siblings, 0 replies; 10+ messages in thread
From: Gerd Hoffmann @ 2015-02-17 8:21 UTC (permalink / raw)
To: Thomas Huth; +Cc: qemu-trivial, qemu-devel, Anthony Liguori
On Mo, 2015-02-16 at 22:41 +0100, Thomas Huth wrote:
> Remove dpy_gfx_update_dirty(), qemu_console_get_head(),
> qemu_console_get_ui_info(), qemu_console_get_width(),
> qemu_console_get_height(), emu_console_displaystate(),
> qemu_different_endianness_pixelformat(), void cpkey(),
> qemu_pixman_linebuf_copy(), qemu_pixman_color(),
> emu_remove_kbd_event_handler() and vnc_stop_worker_thread()
> since they are completely unused.
Vetoing this one. Some of them belong to work-in-progress bits and
should not be removed.
Also I think this kind of cleanup should be splitted into smaller
pieces, so it is easier to get specific bits back via "git revert"
should the need arise.
> -void dpy_gfx_update_dirty(QemuConsole *con,
Keep.
> -QemuUIInfo *qemu_console_get_ui_info(QemuConsole *con)
Keep.
> -int qemu_console_get_width(QemuConsole *con, int fallback)
> -int qemu_console_get_height(QemuConsole *con, int fallback)
Hmm, not sure. Separate patch please.
> -DisplayState *qemu_console_displaystate(QemuConsole *console)
Ok.
> -PixelFormat qemu_different_endianness_pixelformat(int bpp)
Ok.
> -void cpkey(register unsigned long *into)
Ok.
> -void qemu_remove_kbd_event_handler(QEMUPutKbdEntry *entry)
Ok.
> -void qemu_input_handler_deactivate(QemuInputHandlerState *s)
Hmm, might be needed in the future. Separate patch please.
> -/* copy linebuf to framebuffer */
> -void qemu_pixman_linebuf_copy(pixman_image_t *fb, int width, int x, int y,
> - pixman_image_t *linebuf)
> -{
> - pixman_image_composite(PIXMAN_OP_SRC, linebuf, NULL, fb,
> - 0, 0, 0, 0, x, y, width, 1);
> -}
Keep.
> -pixman_color_t qemu_pixman_color(PixelFormat *pf, uint32_t color)
> -{
> - pixman_color_t c;
> -
> - c.red = ((color & pf->rmask) >> pf->rshift) << (16 - pf->rbits);
> - c.green = ((color & pf->gmask) >> pf->gshift) << (16 - pf->gbits);
> - c.blue = ((color & pf->bmask) >> pf->bshift) << (16 - pf->bbits);
> - c.alpha = ((color & pf->amask) >> pf->ashift) << (16 - pf->abits);
> - return c;
> -}
Not sure. Separate patch please.
> -void vnc_stop_worker_thread(void)
Probably ok. Separate patch would be nice.
cheers,
Gerd
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [Qemu-devel] [PATCH 3/4] util: Remove unused functions
2015-02-16 21:41 ` [Qemu-devel] [PATCH 3/4] util: Remove " Thomas Huth
@ 2015-02-17 8:55 ` Markus Armbruster
2015-02-17 9:52 ` Thomas Huth
0 siblings, 1 reply; 10+ messages in thread
From: Markus Armbruster @ 2015-02-17 8:55 UTC (permalink / raw)
To: Thomas Huth; +Cc: qemu-trivial, qemu-devel
Thomas Huth <thuth@linux.vnet.ibm.com> writes:
> Delete the unused functions qemu_opt_get_number_del(),
> qemu_signalfd_available(), qemu_send_full() and qemu_recv_full().
>
> Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com>
qemu_opt_get_number_del() was added in commit 782730b along with
qemu_opt_get_del(), qemu_opt_get_bool_del() and qemu_opt_get_size_del().
It hasn't been used so far, but removing it makes the interface
irregular. I'd rather not. Covering all four in tests/test-qemu-opts.c
would be nice.
qemu_send_full() and qemu_recv_full() complement qemu_write_full(). On
the other hand, there's no qemu_read_full(). I don't think keeping the
two unused ones hurts, but I don't object to dropping them, either.
For what it's worth, glibc provides a macro to solve this problem once
and for all:
/* Evaluate EXPRESSION, and repeat as long as it returns -1 with `errno'
set to EINTR. */
# define TEMP_FAILURE_RETRY(expression) \
(__extension__ \
({ long int __result; \
do __result = (long int) (expression); \
while (__result == -1L && errno == EINTR); \
__result; }))
#endif
More elegant than writing the same old boring wrapper around everything
that can fail with EINTR.
qemu_signalfd_available() is unused since commit 6d32717. It's also the
only user of CONFIG_SIGNALFD. If we want to drop it, I recommend
dropping CONFIG_SIGNALFD as well.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [Qemu-devel] [PATCH 3/4] util: Remove unused functions
2015-02-17 8:55 ` Markus Armbruster
@ 2015-02-17 9:52 ` Thomas Huth
0 siblings, 0 replies; 10+ messages in thread
From: Thomas Huth @ 2015-02-17 9:52 UTC (permalink / raw)
To: Markus Armbruster; +Cc: qemu-trivial, qemu-devel
Hi,
On Tue, 17 Feb 2015 09:55:33 +0100
Markus Armbruster <armbru@redhat.com> wrote:
> Thomas Huth <thuth@linux.vnet.ibm.com> writes:
>
> > Delete the unused functions qemu_opt_get_number_del(),
> > qemu_signalfd_available(), qemu_send_full() and qemu_recv_full().
> >
> > Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com>
>
> qemu_opt_get_number_del() was added in commit 782730b along with
> qemu_opt_get_del(), qemu_opt_get_bool_del() and qemu_opt_get_size_del().
> It hasn't been used so far, but removing it makes the interface
> irregular. I'd rather not.
Ok, then let's keep them.
> qemu_signalfd_available() is unused since commit 6d32717. It's also the
> only user of CONFIG_SIGNALFD. If we want to drop it, I recommend
> dropping CONFIG_SIGNALFD as well.
As far as I can see, CONFIG_SIGNALFD is still used in qemu_signalfd(),
so I think we've got to keep that.
Thomas
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2015-02-17 9:56 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-02-16 21:41 [Qemu-devel] [PATCH 0/4] Remove unused functions Thomas Huth
2015-02-16 21:41 ` [Qemu-devel] [PATCH 1/4] migration: " Thomas Huth
2015-02-16 21:41 ` [Qemu-devel] [PATCH 2/4] ui/console: Removed " Thomas Huth
2015-02-17 8:21 ` Gerd Hoffmann
2015-02-16 21:41 ` [Qemu-devel] [PATCH 3/4] util: Remove " Thomas Huth
2015-02-17 8:55 ` Markus Armbruster
2015-02-17 9:52 ` Thomas Huth
2015-02-16 21:41 ` [Qemu-devel] [PATCH 4/4] block: " Thomas Huth
2015-02-16 22:26 ` Max Reitz
2015-02-17 8:15 ` Thomas Huth
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.