Actions
Bug #12119
closedndmpd: cast between incompatible function types
Start date:
Due date:
% Done:
100%
Estimated time:
Difficulty:
Medium
Tags:
Gerrit CR:
External Bug:
Description
Build errors with gcc 8:
ndmp/ndmpd_data.c: In function 'ndmpd_tar_start_backup_v3': ndmp/ndmpd_data.c:1469:6: error: cast between incompatible function types from 'int (*)(void *)' to 'void * (*)(void *)' [-Werror=cast-function-type] (funct_t)session->ns_data.dd_module.dm_start_func, ^ ndmp/ndmpd_data.c: In function 'ndmpd_tar_start_recover_v3': ndmp/ndmpd_data.c:1598:6: error: cast between incompatible function types from 'int (*)(void *)' to 'void * (*)(void *)' [-Werror=cast-function-type] (funct_t)session->ns_data.dd_module.dm_start_func, ^ ndmp/ndmpd_data.c: In function 'ndmpd_zfs_start_op': ndmp/ndmpd_data.c:1695:6: error: cast between incompatible function types from 'int (*)(void *)' to 'void * (*)(void *)' [-Werror=cast-function-type] (funct_t)session->ns_data.dd_module.dm_start_func, ndmpd_zfs_args); ^ ndmp/ndmpd_data.c: In function 'ndmpd_tar_start_backup_v2': ndmp/ndmpd_data.c:2188:6: error: cast between incompatible function types from 'int (*)(void *)' to 'void * (*)(void *)' [-Werror=cast-function-type] (funct_t)session->ns_data.dd_module.dm_start_func, ^ ndmp/ndmpd_data.c: In function 'ndmpd_tar_start_recover_v2': ndmp/ndmpd_data.c:2325:6: error: cast between incompatible function types from 'int (*)(void *)' to 'void * (*)(void *)' [-Werror=cast-function-type] (funct_t)session->ns_data.dd_module.dm_start_func, ^ ndmp/ndmpd_mover.c: In function 'start_mover_for_restore': ndmp/ndmpd_mover.c:2775:34: error: cast between incompatible function types from 'int (*)(ndmpd_session_t *)' {aka 'int (*)(struct ndmpd_session *)'} to 'void * (*)(void *)' [-Werror=cast-function-type] rc = pthread_create(NULL, NULL, (funct_t)mover_tape_reader, session); ^ ndmp/ndmpd_mover.c:2784:34: error: cast between incompatible function types from 'int (*)(ndmpd_session_t *)' {aka 'int (*)(struct ndmpd_session *)'} to 'void * (*)(void *)' [-Werror=cast-function-type] rc = pthread_create(NULL, NULL, (funct_t)mover_socket_writer, session); ^ ndmp/ndmpd_mover.c: In function 'start_mover_for_backup': ndmp/ndmpd_mover.c:3146:34: error: cast between incompatible function types from 'int (*)(ndmpd_session_t *)' {aka 'int (*)(struct ndmpd_session *)'} to 'void * (*)(void *)' [-Werror=cast-function-type] rc = pthread_create(NULL, NULL, (funct_t)mover_socket_reader, session); ^ ndmp/ndmpd_mover.c:3155:34: error: cast between incompatible function types from 'int (*)(ndmpd_session_t *)' {aka 'int (*)(struct ndmpd_session *)'} to 'void * (*)(void *)' [-Werror=cast-function-type] rc = pthread_create(NULL, NULL, (funct_t)mover_tape_writer, session); ^ ndmp/ndmpd_tar.c:1317:37: error: cast between incompatible function types from 'int (*)(ndmp_tar_reader_arg_t *)' {aka 'int (*)(struct <anonymous> *)'} to 'void * (*)(void *)' [-Werror=cast-function-type] err = pthread_create(&rdtp, NULL, (funct_t)ndmp_tar_reader, ^ ndmp/ndmpd_tar.c:1350:8: error: cast between incompatible function types from 'int (*)()' to 'void * (*)(void *)' [-Werror=cast-function-type] (funct_t)tm_tar_ops.tm_getfile, (void *)&tlm_arg); ^ ndmp/ndmpd_tar3.c: In function 'tar_backup_v3': ndmp/ndmpd_tar3.c:2441:37: error: cast between incompatible function types from 'int (*)(backup_reader_arg_t *)' {aka 'int (*)(struct <anonymous> *)'} to 'void * (*)(void *)' [-Werror=cast-function-type] err = pthread_create(&rdtp, NULL, (funct_t)backup_reader_v3, ^ ndmp/ndmpd_tar3.c: In function 'ndmpd_dar_tar_v3': ndmp/ndmpd_tar3.c:3189:37: error: cast between incompatible function types from 'int (*)(ndmp_tar_reader_arg_t *)' {aka 'int (*)(struct <anonymous> *)'} to 'void * (*)(void *)' [-Werror=cast-function-type] err = pthread_create(&rdtp, NULL, (funct_t)ndmp_tar_reader, ^ ndmp/ndmpd_tar3.c: In function 'ndmpd_rs_sar_tar_v3': ndmp/ndmpd_tar3.c:3551:37: error: cast between incompatible function types from 'int (*)(ndmp_tar_reader_arg_t *)' {aka 'int (*)(struct <anonymous> *)'} to 'void * (*)(void *)' [-Werror=cast-function-type] err = pthread_create(&rdtp, NULL, (funct_t)ndmp_tar_reader, ^ ndmp/ndmpd_tar3.c: In function 'ndmpd_tar_backup_starter_v3': ndmp/ndmpd_tar3.c:3783:34: error: cast between incompatible function types from 'void (*)(ndmp_bkup_size_arg_t *)' {aka 'void (*)(struct <anonymous> *)'} to 'void * (*)(void *)' [-Werror=cast-function-type] if (pthread_create(&tid, NULL, (funct_t)get_backup_size, ^ ndmp/ndmpd_zfs.c:944:19: error: cast between incompatible function types from 'int (*)(ndmpd_zfs_args_t *)' {aka 'int (*)(struct ndmpd_zfs_args *)'} to 'void * (*)(void *)' [-Werror=cast-function-type] sendrecv_func = (funct_t)ndmpd_zfs_backup_send_read; ^ ndmp/ndmpd_zfs.c:945:15: error: cast between incompatible function types from 'int (*)(ndmpd_zfs_args_t *)' {aka 'int (*)(struct ndmpd_zfs_args *)'} to 'void * (*)(void *)' [-Werror=cast-function-type] tape_func = (funct_t)ndmpd_zfs_backup_tape_write; ^ ndmp/ndmpd_zfs.c:948:19: error: cast between incompatible function types from 'int (*)(ndmpd_zfs_args_t *)' {aka 'int (*)(struct ndmpd_zfs_args *)'} to 'void * (*)(void *)' [-Werror=cast-function-type] sendrecv_func = (funct_t)ndmpd_zfs_restore_recv_write; ^ ndmp/ndmpd_zfs.c:949:15: error: cast between incompatible function types from 'int (*)(ndmpd_zfs_args_t *)' {aka 'int (*)(struct ndmpd_zfs_args *)'} to 'void * (*)(void *)' [-Werror=cast-function-type] tape_func = (funct_t)ndmpd_zfs_restore_tape_read; ^ cc1: all warnings being treated as errors
The problem starts with fact that pthread_create() does take start function returning void *, and this return value is used as exit value (int). and there all follow up is just a mess.
Testing done: disasm compare, unfortunately when there is change in instruction count in function, the diffs are growing large.
Note from Dan Fields: Right now, the zfs part of the backup is dead code or isn't part of NS NDMP product. We have talked about adding it (back in) to the product. At that time can take those changes - but for now we don't use zfs backups through ndmp.
Updated by Electric Monk almost 3 years ago
- Status changed from In Progress to Closed
- % Done changed from 90 to 100
git commit 82049ff560eed6fbdf4cf222d894467f5809f9b3
commit 82049ff560eed6fbdf4cf222d894467f5809f9b3 Author: Toomas Soome <tsoome@me.com> Date: 2020-06-01T20:28:43.000Z 12119 ndmpd: cast between incompatible function types Reviewed by: Dan Fields <danfields@fastmail.us> Approved by: Dan McDonald <danmcd@joyent.com>
Actions