Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 15 Mar 1995 17:22:15 +0100
From:      "Philippe Charnier" <charnier@lirmm.fr>
To:        current@FreeBSD.org
Subject:   scsi_sense
Message-ID:  <199503151634.RAA08046@lirmm.lirmm.fr>

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


from scsi_sence.c (in src/sys/scsi)

        {0x26, 0x03, "Threshold parameters not supported" },
        {0x46, 0x00, "Unsuccessful soft reset" },
#endif /* NO_SCSI_SENSE */
        {0xff, 0xff, 0 },
};

char *scsi_sense_desc(int asc, int ascq)
{
        int i;
        for (i = 0; i < sizeof(tab) / sizeof(tab[0]); i++)
                if (tab[i].asc == asc && tab[i].ascq == ascq)
                        return tab[i].desc;

        return "no available sense description";
}

Why this code don't use {0xff, 0xff, 0 } as a end of list?

What about something like this?


char *scsi_sense_desc(int asc, int ascq)
{
        int i;

        i = -1;
        while (tab[++i].desc)
          if (tab[i].asc == asc && tab[i].ascq == ascq)
              return tab[i].desc;
        return "no available sense description";
}



--------                                                        --------
Philippe Charnier                                      charnier@lirmm.fr
                               

         LIRMM, 161 rue Ada, 34392 Montpellier cedex 5 -- France
------------------------------------------------------------------------




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