Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 3 Oct 2010 19:33:17 -0700
From:      Garrett Cooper <yanegomi@gmail.com>
To:        John Baldwin <jhb@freebsd.org>, scottl@freebsd.org, sbruno@freebsd.org
Cc:        freebsd-hackers@freebsd.org
Subject:   Fix mfiutil compile with -DDEBUG
Message-ID:  <AANLkTikiaTONmZbLdWW5Np7h1EwxFBeyjsWTxZd43CUt@mail.gmail.com>

next in thread | raw e-mail | index | archive | help

[-- Attachment #1 --]
    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

[-- Attachment #2 --]
Index: usr.sbin/mfiutil/mfi_config.c
===================================================================
--- usr.sbin/mfiutil/mfi_config.c	(revision 213377)
+++ usr.sbin/mfiutil/mfi_config.c	(working copy)
@@ -1024,7 +1024,7 @@
 		    ar->num_drives);
 		printf("      size = %ju\n", (uintmax_t)ar->size);
 		for (j = 0; j < ar->num_drives; j++) {
-			device_id = ar->pd[j].ref.device_id;
+			device_id = ar->pd[j].ref.v.device_id;
 			if (device_id == 0xffff)
 				printf("        drive MISSING\n");
 			else {
@@ -1080,7 +1080,7 @@
 		sp = (struct mfi_spare *)p;
 		printf("    %s spare %u ",
 		    sp->spare_type & MFI_SPARE_DEDICATED ? "dedicated" :
-		    "global", sp->ref.device_id);
+		    "global", sp->ref.v.device_id);
 		printf("%s", mfi_pdstate(MFI_PD_STATE_HOT_SPARE));
 		printf(" backs:\n");
 		for (j = 0; j < sp->array_count; j++)

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?AANLkTikiaTONmZbLdWW5Np7h1EwxFBeyjsWTxZd43CUt>