Current-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: sys/dev/scsipi/scsipi_base.c




To: Alan Barrett <apb%cequrux.com@localhost>

Subject: Re: sys/dev/scsipi/scsipi_base.c

From: "Perry E. Metzger" <perry%piermont.com@localhost>

Date: Sun, 06 Jan 2008 12:19:21 -0500


Alan Barrett <apb%cequrux.com@localhost> writes:
> On Sun, 06 Jan 2008, David Laight wrote:
>> > memcpy(inqbuf->vendor, "ADAPTEC ACB-4000            ", 28);
>> > yet inqbuf->vendor is declared in struct scsipi_inquiry_data as:
>> > char    vendor[8];
>> and is followed by:
>>   char    product[16];
>>   char    revision[4];
>> so the memcpy updates all 3 fields :-)
>
> This is rather ugly, but it's either guaranteed to work, or will work
> with all except the most perverse C language implementations.

True, but is there a good reason to commit a type violation just to
save an inconsequential amount of time and space by avoiding two more
calls?

Perry



References:

sys/dev/scsipi/scsipi_base.c
From: John R. Shannon

Re: sys/dev/scsipi/scsipi_base.c
From: David Laight

Re: sys/dev/scsipi/scsipi_base.c
From: Alan Barrett




Prev by Date: Re: sys/dev/scsipi/scsipi_base.c

Next by Date: Re: sys/dev/scsipi/scsipi_base.c

Previous by Thread: Re: sys/dev/scsipi/scsipi_base.c

Next by Thread: Re: sys/dev/scsipi/scsipi_base.c

Indexes:

reverse Date

reverse Thread

Old Index



Home | Main Index | Thread Index | Old Index