Re: [PATCH] gadget: mass_storage: make mass_storage support multi-luns with different logic block size

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

 



2011/10/18 Michal Nazarewicz <mina86@xxxxxxxxxx>:
> On Mon, 17 Oct 2011 02:01:48 -0700, Yuping Luo <lypingsh@xxxxxxxxx> wrote:
>>
>> here you are , :)
>>
>> diff --git a/drivers/usb/gadget/f_mass_storage.c
>> b/drivers/usb/gadget/f_mass_storage.c
>> index 524381a..6a5c42d 100644
>> --- a/drivers/usb/gadget/f_mass_storage.c
>> +++ b/drivers/usb/gadget/f_mass_storage.c
>> @@ -379,6 +379,7 @@ struct fsg_common {
>>        enum data_direction     data_dir;
>>        u32                     data_size;
>>        u32                     data_size_from_cmnd;
>> +       u32                     data_size_is_in_blocks;
>
> Personally, I'd make it an argument to check_command() or create a simple
> wrapper for check_command() that calculates the size.
>
>>        u32                     tag;
>>        u32                     residue;
>>        u32                     usb_amount_left;
>> @@ -1851,6 +1852,18 @@ static int check_command(struct fsg_common
>> *common, int cmnd_size,
>>        char                    hdlen[20];
>>        struct fsg_lun          *curlun;
>>
>> +       curlun = common->curlun;
>> +       /* Convert the data size's unit from CDB */
>> +       if (common->data_size_is_in_blocks == 1) {
>> +               common->data_size_is_in_blocks = 0;
>> +               if (!curlun) {
>> +                       DBG(common, "curlun NULL\n");
>> +                       return -EINVAL;
>> +               }
>> +               common->data_size_from_cmnd =
>> +                       common->data_size_from_cmnd << curlun->blkbits;
>> +       }
>> +
>
> Same thing as in what Alan pointed.
>
ok.

>>        hdlen[0] = 0;
>>        if (common->data_dir != DATA_DIR_UNKNOWN)
>>                sprintf(hdlen, ", H%c=%u", dirletter[(int)
>> common->data_dir],
>> @@ -1859,6 +1872,7 @@ static int check_command(struct fsg_common
>> *common, int cmnd_size,
>>             name, cmnd_size, dirletter[(int) data_dir],
>>             common->data_size_from_cmnd, common->cmnd_size, hdlen);
>>
>> +
>
> Unnecessary empty line.
>
ok , will remove it.

>>        /*

>> @@ -2316,7 +2326,10 @@ static int received_cbw(struct fsg_dev *fsg,
>> struct fsg_buffhd *bh)
>>        if (common->data_size == 0)
>>                common->data_dir = DATA_DIR_NONE;
>>        common->lun = cbw->Lun;
>> -       common->curlun = &common->luns[cbw->Lun];
>
> Where did this line came from?  I cannot see it in my Felipe's gadget tree.
>
I use one old kernel for the draft, will give the new patch against
the git kernel.

Thanks
Yuping Luo
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux