Re: 答复: [PATCH] gadget: mass_storage: adapt logic block size to bound block devices

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

 



2011/8/16 Alan Stern <stern@xxxxxxxxxxxxxxxxxxx>:
> On Tue, 16 Aug 2011, Xianglong Du wrote:
>
>> Hi Alan,
>>
>> >> +     num_sectors = size >> curlun->l_blkbits; /* File size in logic-block-size blocks */
>> >>       min_sectors = 1;
>> >>      if (curlun->cdrom) {
>> >>               num_sectors &= ~3;      /* Reduce to a multiple of 2048 */
>>
>> > And as long as you're using variable logical block sizes, you might as
>> > well set l_blkbits here to 11, because cdroms always use a block size
>> > of 2048.
>>
>>    I've test cdrom as mass storage according to your suggestion:
>>             if (curlun->cdrom)
>>                       curlun->l_blkbits = 11;
>>    but it seems that the cdrom doesn't work:
>>             FAT: logical sector size too small for device (logical sector size = 512)
>>    after set l_blkbits to 9 for cdrom, it works properly.
>
> As Michal pointed out, cdroms don't contain FAT filesystems.  You
> should test with an ISO9660 filesystem.

then i think xianglong can make an iso image by:
mkisofs -o imagefile.iso /path/to/files
and use the regular file as the file name of gadget and check.

>
>>    The code in earlier version is also set to default value 9:
>>             num_sectors = size >> 9;  /* File size in 512-byte blocks */
>
> Because I didn't want to go to the trouble of supporting variable block
> sizes.

in your original design, does cdrom mass storage gadget only want to
bind an regular iso image file or a real cdrom /dev/sr0...n on target
board? do you want a normal block device to be the back device of the
gadget?

>
>>           min_sectors = 1;
>>             if (curlun->cdrom) {
>>                       num_sectors &= ~3;      /* Reduce to a multiple of 2048 */
>>                       min_sectors = 300*4;    /* Smallest track is 300 frames */
>>    So I think we should set l_blkbits to 9 for cdrom.
>>
>>    Do you have any suggestions?
>
> Same as before: Change it to 11.
>
> Alan Stern

Thanks
barry
--
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