Remove unused functions
cover Remove unused functions
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(-)
PATCH 1/4 migration: Remove unused functions
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.
--- 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(-)
arch_init.c +0 -10
@@ -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;
include/migration/migration.h +0 -3
@@ -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 );
include/migration/qemu-file.h +0 -2
@@ -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);
migration/migration.c +0 -9
@@ -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;
migration/qemu-file-buf.c +0 -53
65 lines not on this page · raw message
Signature · 1 line
1.7.1
PATCH 2/4 ui/console: Removed unused functions
In reply to Thomas HuthRemove 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.
--- 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(-)
include/ui/console.h +0 -11
@@ -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);
include/ui/input.h +0 -1
@@ -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,
include/ui/qemu-pixman.h +0 -3
@@ -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,
ui/console.c +0 -103
121 lines not on this page · raw message
ui/d3des.c +0 -9
@@ -121,15 +121,6 @@ static void cookey(register unsigned long *raw1)return ; } -void cpkey (registerunsigned long *into) -{ - registerunsigned long *from, *endp; - - from = KnL, endp = &KnL[32 ]; -while ( from < endp ) *into++ = *from++; -return ; - } -void usekey (registerunsigned long *from) { registerunsigned long *to, *endp;
ui/d3des.h +0 -6
@@ -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
ui/input-legacy.c +0 -6
@@ -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) {
ui/input.c +0 -7
@@ -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);
ui/qemu-pixman.c +0 -19
@@ -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) {
ui/vnc-jobs.c +0 -13
@@ -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); -}
ui/vnc-jobs.h +0 -1
@@ -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)
Signature · 1 line
1.7.1
Re: [Qemu-devel] [PATCH 2/4] ui/console: Removed unused functions
Quoted 7 lines · Thomas Huth
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(), voidcpkey(),qemu_pixman_linebuf_copy(),qemu_pixman_color(),emu_remove_kbd_event_handler()andvnc_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.
Quoted 1 line
-void dpy_gfx_update_dirty(QemuConsole *con,
Keep.
Quoted 1 line
-QemuUIInfo *qemu_console_get_ui_info(QemuConsole *con)
Keep.
ui/console.c int qemu_console_get_index(QemuConsole *con) · line 1821
Quoted 2 lines
ui/console.c +0
-2-int qemu_console_get_width(QemuConsole *con, int fallback) -int qemu_console_get_height(QemuConsole *con, int fallback)
Hmm, not sure. Separate patch please.
Quoted 1 line
-DisplayState *qemu_console_displaystate(QemuConsole *console)
Ok.
Quoted 1 line
-PixelFormat
qemu_different_endianness_pixelformat(int bpp)
Ok.
Quoted 1 line
-void
cpkey(register unsigned long *into)
Ok.
Quoted 1 line
-void
qemu_remove_kbd_event_handler(QEMUPutKbdEntry *entry)
Ok.
Quoted 1 line
-void
qemu_input_handler_deactivate(QemuInputHandlerState *s)
Hmm, might be needed in the future. Separate patch please.
ui/qemu-pixman.c void qemu_pixman_linebuf_fill(pixman_image_t *linebuf, pixman_image_t *fb, · line 177
Quoted 7 lines
ui/qemu-pixman.c +0
-7-/* 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.
ui/qemu-pixman.c void qemu_pixman_image_unref(pixman_image_t *image) · line 209
Quoted 10 lines
ui/qemu-pixman.c +0
-10-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.
Quoted 1 line
-void
vnc_stop_worker_thread(void)
Probably ok. Separate patch would be nice.
cheers,
Gerd
PATCH 3/4 util: Remove unused functions
In reply to Thomas HuthDelete the unused functions qemu_opt_get_number_del(), qemu_signalfd_available(), qemu_send_full() and qemu_recv_full().
--- 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(-)
include/qemu-common.h +0 -4
@@ -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 _WIN32int qemu_pipe (int pipefd[2 ]);
include/qemu/compatfd.h +0 -1
@@ -39,6 +39,5 @@ struct qemu_signalfd_siginfo { };int qemu_signalfd (const sigset_t *mask); -bool qemu_signalfd_available (void );#endif
include/qemu/option.h +0 -2
@@ -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);
util/compatfd.c +0 -19
@@ -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 -}
util/osdep.c +0 -66
72 lines not on this page · raw message
util/qemu-option.c +0 -6
@@ -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) {
Signature · 1 line
1.7.1
Re: [Qemu-devel] [PATCH 3/4] util: Remove unused functions
Quoted 4 lines · Thomas Huth
Delete the unused functions
qemu_opt_get_number_del(),qemu_signalfd_available(),qemu_send_full()andqemu_recv_full().Signed-off-by Thomas Huth <[email protected]>
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; }))
#endifMore 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.
Re: [Qemu-devel] [PATCH 3/4] util: Remove unused functions
Hi,
Quoted 11 lines · On Tue, 17 Feb 2015 09:55:33 +0100 Markus Armbruster <[email protected]> wrote:
Quoted 4 lines · Thomas Huth
Delete the unused functions
qemu_opt_get_number_del(),qemu_signalfd_available(),qemu_send_full()andqemu_recv_full().Signed-off-by Thomas Huth <[email protected]>
qemu_opt_get_number_del()was added in commit 782730b along withqemu_opt_get_del(),qemu_opt_get_bool_del()andqemu_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.
Quoted 3 lines
qemu_signalfd_available()is unused since commit 6d32717. It's also the only user ofCONFIG_SIGNALFD. If we want to drop it, I recommend droppingCONFIG_SIGNALFDas 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
PATCH 4/4 block: Remove unused functions
In reply to Thomas Huthqemu_try_blockalign0() and nbd_export_close_all() are not used anymore and thus can be removed.
--- block.c | 11 ----------- include/block/block.h | 1 - include/block/nbd.h | 1 - nbd.c | 9 --------- 4 files changed, 0 insertions(+), 22 deletions(-)
block.c +0 -11
@@ -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. */
include/block/block.h +0 -1
@@ -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 ;
include/block/nbd.h +0 -1
@@ -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 *));
nbd.c +0 -9
@@ -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) {
Signature · 1 line
1.7.1
Max Reitz
NAKRe: [Qemu-devel] [PATCH 4/4] block: Remove unused functions
Quoted 7 lines · Thomas Huth
qemu_try_blockalign0()andnbd_export_close_all()are not used anymore and thus can be removed.Signed-off-by Thomas Huth <[email protected]>Cc Kevin Wolf <[email protected]>Cc Stefan Hajnoczi <[email protected]>Cc Paolo Bonzini <[email protected]>
Quoted 6 lines
--- 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
Quoted 66 lines
block.c +0
-11@@ -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. */ include/block/block.h +0
-1@@ -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 ;include/block/nbd.h +0
-1@@ -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 *));nbd.c +0
-9@@ -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) {
Re: [Qemu-devel] [PATCH 4/4] block: Remove unused functions
Hi Max,
Quoted 15 lines · On Mon, 16 Feb 2015 17:26:56 -0500 Max Reitz <[email protected]> wrote:
Quoted 7 lines · Thomas Huth
qemu_try_blockalign0()andnbd_export_close_all()are not used anymore and thus can be removed.Signed-off-by Thomas Huth <[email protected]>Cc Kevin Wolf <[email protected]>Cc Stefan Hajnoczi <[email protected]>Cc Paolo Bonzini <[email protected]>Quoted 6 lines
--- block.c | 11 ----------- include/block/block.h | 1 - include/block/nbd.h | 1 - nbd.c | 9 --------- 4 files changed, 0 insertions(+), 22 deletions(-)
Quoted 2 lines
NACK, I'm using
nbd_export_close_all()in my "block: Reworkbdrv_close_all()" series.
Alright, if it's going to be used again, then it must not be removed, of course.
Quoted 9 lines
I'm not so sure about
qemu_try_blockalign0(); it has never been used, but I introduced it because we haveqemu_blockalign(),qemu_try_blockalign(), andqemu_blockalign0()(the latter of which I introduced along withqemu_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