James Bottomley | 1 Feb 2007 02:51
Favicon

RE: [PATCH] - export scsilun_to_int

On Wed, 2007-01-31 at 15:54 -0700, Eric Moore wrote:
> static int
> +mptscsih_cmp_scsilun(struct scsi_lun * lun1, struct scsi_lun * lun2)
> +{
> +       int i;
> +
> +       for (i = 0; i < 8 ; i++)
> +               if (lun1->scsi_lun[i] != lun2->scsi_lun[i])
> +                       return 1;
> +
> +       return 0;
> +}

what's wrong with

memcmp(lun1->scsi_lun, lun2->scsi_lun, 8)

rather than introducing a wrapper?  The compiler can even optimise
memcmp for a fixed size nicely.

James

-
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo <at> vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Jeff Garzik | 1 Feb 2007 09:35
Favicon

Re: [PATCH] - export scsilun_to_int

James Bottomley wrote:
> On Wed, 2007-01-31 at 15:54 -0700, Eric Moore wrote:
>> static int
>> +mptscsih_cmp_scsilun(struct scsi_lun * lun1, struct scsi_lun * lun2)
>> +{
>> +       int i;
>> +
>> +       for (i = 0; i < 8 ; i++)
>> +               if (lun1->scsi_lun[i] != lun2->scsi_lun[i])
>> +                       return 1;
>> +
>> +       return 0;
>> +}
> 
> what's wrong with
> 
> memcmp(lun1->scsi_lun, lun2->scsi_lun, 8)
> 
> rather than introducing a wrapper?  The compiler can even optimise
> memcmp for a fixed size nicely.

I would rather introduce a wrapper that calls memcmp()

That's why I have done in my scsilun tree (jgarzik/scsilun-2.6.git, 
branches submit1, submit1 and hacking)

	Jeff

-
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
(Continue reading)


Gmane