[Stgt-devel] [Patch 1/1] Add support for extra VPD pages within INQUIRY op code

FUJITA Tomonori tomof
Sun Sep 2 12:48:18 CEST 2007


On Sun, 2 Sep 2007 20:23:12 +1000
"Mark Harvey" <markh794 at gmail.com> wrote:

> > > diff --git a/usr/spc.c b/usr/spc.c
> > > index b56c0b3..08a4bc5 100644
> > > --- a/usr/spc.c
> > > +++ b/usr/spc.c
> > > @@ -20,6 +20,7 @@
> > >   * 02110-1301 USA
> > >   */
> > >  #include <errno.h>
> > > +#include <inttypes.h>
> > >  #include <stdio.h>
> > >  #include <stdlib.h>
> > >  #include <string.h>
> > > @@ -38,6 +39,96 @@
> > >  #define PRODUCT_REV  "0"
> > >  #define BLK_SHIFT    9
> > >
> > > +/** Protocol Identifier Values
> > > + * 0 Fibre Channel (FCP-2)
> > > + * 1 Parallel SCSI (SPI-5)
> > > + * 2 SSA (SSA-S3P)
> > > + * 3 IEEE 1394 (SBP-3)
> > > + * 4 SCSI Remote Direct Memory Access (SRP)
> > > + * 5 iSCSI
> > > + * 6 SAS Serial SCSI Protocol (SAS)
> > > + * 7 Automation/Drive Interface (ADT)
> > > + * 8 AT Attachment Interface (ATA/ATAPI-7)
> > > + */
> > > +#define PIV_FCP 0
> > > +#define PIV_SPI 1
> > > +#define PIV_S3P 2
> > > +#define PIV_SBP 3
> > > +#define PIV_SRP 4
> > > +#define PIV_ISCSI 5
> > > +#define PIV_SAS 6
> > > +#define PIV_ADT 7
> > > +#define PIV_ATA 8
> > > +
> > > +#define PIV_VALID 0x80
> >
> > Would be better to use lengthy names for SCSI specification defines
> > and move them to scsi.h?
> 
> As these defines are only used by the SCSI Inquiry page, I kept them
> in the spc module.
> 
> I can move them if you like.

OK, let's keep them in spc.c.


> > > +struct vpd *alloc_vpd(uint16_t size)
> > > +{
> > > +     struct vpd *vpd;
> > > +
> > > +     vpd = zalloc(sizeof(struct vpd) + size);
> > > +     if (!vpd)
> > > +             return NULL;
> > > +
> > > +     vpd->size = size;
> > > +
> > > +     return vpd;
> > > +}
> >
> > Where do you free vpd?
> 
> It's a one time allocation and stays set. i.e. There is no call to free().

When we remove a logical unit, what happens?




More information about the stgt mailing list