10154 zfs: cast between incompatible function types

Review Request #1326 — Created Dec. 21, 2018 and submitted

tsoome
illumos-gate
10154
f115cc1...
general
../../common/fs/zfs/vdev_disk.c: In function 'vdev_disk_io_start':
../../common/fs/zfs/vdev_disk.c:795:17: error: cast between incompatible function types from 'void (*)(buf_t *)' {aka 'void (*)(struct buf *)'} to 'int (*)()' [-Werror=cast-function-type]
  bp->b_iodone = (int (*)())vdev_disk_io_intr;
                 ^
../../common/fs/zfs/vdev_file.c: In function 'vdev_file_io_start':
../../common/fs/zfs/vdev_file.c:244:17: error: cast between incompatible function types from 'void (*)(buf_t *)' {aka 'void (*)(struct buf *)'} to 'int (*)()' [-Werror=cast-function-type]
  bp->b_iodone = (int (*)())vdev_file_io_intr;
                 ^

cc1: all warnings being treated as errors


rm
  1. Ship It!
  2. 
      
norm
  1. The only two places there i saw ((bp->b_iodone))(bp) called, the results were ignored, so perhaps
    int (
    b_iodone)(struct buf ); / function called by iodone /
    should become
    void (
    b_iodone)(struct buf ); / function called by iodone */
    in buf.h:118

    The following functions are assigned to this function pointer and either declared to return and int and return (0), or are declared void.
    hsfs_iodone, ud_iodone, trans_not_done, log_done, ufs_si_io_done, ufs_iodone,
    db_flush_write_cache_done, sd_mapblockaddr_iodone, sd_mapblocksize_iodone,
    aio_done, xdb_biodone, dadk_flushdone, qmerge_iodone, dcdflushdone, vd_biodone

    There are two other small signature changes that would need to happen to saviodone and sd_shadow_buf_alloc

    It looks like other may have done what you are doing, so I'm ok with it, but I would prefer to see it consistent across the gate.

  2. 
      
andy_js
  1. Ship It!
  2. 
      
domag02
  1. Ship It!
  2. 
      
tsoome
Review request changed

Status: Closed (submitted)

Loading...