Fix mfiutil compile with -DDEBUG

Garrett Cooper yanegomi at gmail.com
Mon Oct 4 02:33:19 UTC 2010


    make -DDEBUG is broken in mfiutil:

$ make -DDEBUG
cc -O2 -pipe -fno-strict-aliasing -pipe -O2 -march=nocona
-fno-builtin-strftime -DDEBUG -Wall -Wcast-align -Woverflow
-Wsign-compare -Wunused -std=gnu99 -fstack-protector -Wsystem-headers
-Werror -Wall -Wno-format-y2k -W -Wno-unused-parameter
-Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith
-Wno-uninitialized -Wno-pointer-sign -c
/usr/src/usr.sbin/mfiutil/mfi_config.c
/usr/src/usr.sbin/mfiutil/mfi_config.c: In function 'dump_config':
/usr/src/usr.sbin/mfiutil/mfi_config.c:1027: error: 'union mfi_pd_ref'
has no member named 'device_id'
/usr/src/usr.sbin/mfiutil/mfi_config.c:1083: error: 'union mfi_pd_ref'
has no member named 'device_id'
*** Error code 1

Stop in /usr/src/usr.sbin/mfiutil.
$

    device_id is a field in the v field in the mfi_pd_ref union
(/sys/dev/mfi/mfireg.h):

union mfi_pd_ref {
        struct {
                uint16_t        device_id;
                uint16_t        seq_num;
        } v;
        uint32_t        ref;
} __packed;

    The attached patch fixes the compile (and produces logical
results) with make -DDEBUG:

$ sudo /usr/obj/usr/src/usr.sbin/mfiutil/mfiutil debug
mfi0 Configuration (Debug): 1 arrays, 1 volumes, 0 spares
  array size: 288
  volume size: 256
  spare size: 40
    array 0 of 4 drives:
      size = 1951170560
        drive 4 ONLINE
          raw size: 1953525168
          non-coerced size: 1952476592
          coerced size: 1951170560
        drive 5 ONLINE
          raw size: 1953525168
          non-coerced size: 1952476592
          coerced size: 1951170560
        drive 6 ONLINE
          raw size: 1953525168
          non-coerced size: 1952476592
          coerced size: 1951170560
        drive 7 ONLINE
          raw size: 1953525168
          non-coerced size: 1952476592
          coerced size: 1951170560
    volume mfid0 RAID-6 OPTIMAL
      primary raid level: 6
      raid level qualifier: 3
      secondary raid level: 0
      stripe size: 7
      num drives: 4
      init state: 0
      consistent: 1
      no bgi: 0
      spans:
        array 0 @ 0 : 1951170560

Thanks!
-Garrett
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fix-mfiutil-debug.diff
Type: application/octet-stream
Size: 849 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-hackers/attachments/20101004/52f0782c/fix-mfiutil-debug.obj


More information about the freebsd-hackers mailing list