[Stgt-devel] vtl patch.

Ming Zhang blackmagic02881
Thu Apr 5 03:23:54 CEST 2007


On Thu, 2007-04-05 at 09:56 +1000, Mark Harvey wrote:
> +
> +static int
> +process_arg(char *key, char *value, struct scsi_lu *lu) {
> +       struct smc_info *smc = (struct smc_info *)lu->priv_p;
> +       int err = TGTADM_INVALID_REQUEST;
> +
> +       if(!strcmp(key, "VendorIdent")) {
> +               strncpy(smc->phy->VendorIdent, value,
> +                                               sizeof(smc->phy->VendorIdent));
> +               err = 0;
> +       }


can we use strcasecmp here so be case insensitive?


> +       if(!strcmp(key, "ProductIdent")) {
> +               strncpy(smc->phy->ProductIdent, value,
> +                                       sizeof(smc->phy->ProductIdent));
> +               err = 0;
> +       }
> +       if(!strcmp(key, "ProductRev")) {
> +               strncpy(smc->phy->ProductRev, value,
> +                                       sizeof(smc->phy->ProductRev));
> +               err = 0;
> +       }
> +       if(!strcmp(key, "SerialNumber")) {
> +               strncpy(smc->phy->SerialNumber, value,
> +                                       sizeof(smc->phy->SerialNumber));
> +               strncpy(lu->scsi_sn, value, SCSI_SN_LEN - 1);
> +//             strncpy(lu->scsi_sn, value,
> +//                             min((int)SCSI_SN_LEN - 1,
> (int)strlen(value)));
> +               err = 0;
> +       }
> +       dprintf("name: %s, Value: %s, return val: %d", key, value,
> err);
> +       return err;
> +} 




More information about the stgt mailing list