From: Dave Young <dyoung@redhat.com>
To: Alan Stern <stern@rowland.harvard.edu>
Cc: balbi@ti.com, gregkh@linuxfoundation.org,
linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] usb gadget: remove size limitation for storage cdrom
Date: Mon, 9 Mar 2015 13:33:56 +0800 [thread overview]
Message-ID: <20150309053356.GA6029@darkstar.redhat.com> (raw)
In-Reply-To: <Pine.LNX.4.44L0.1503081125390.3638-100000@netrider.rowland.org>
On 03/08/15 at 11:29am, Alan Stern wrote:
> On Sun, 8 Mar 2015, Dave Young wrote:
>
> > I used usb cdrom emulation to play video dvd for my daughter, but I got below
> > error:
> >
> > [dave@darkstar tmp]$ cat /mnt/sr1/VIDEO_TS/VTS_01_5.VOB >/dev/null
> > cat: /mnt/sr1/VIDEO_TS/VTS_01_5.VOB: Input/output error
> > [dave@darkstar tmp]$ dmesg|tail -1
> > [ 3349.371857] sr1: rw=0, want=8028824, limit=4607996
> >
> > The assumption of cdrom size is not right, we can create data dvd large then
> > 4G, also mkisofs can create an iso with only one blank directory, the size is
> > less than 300 sectors. The size limit does not make sense, thus remove them.
> >
> > Signed-off-by: Dave Young <dyoung@redhat.com>
> > ---
> > drivers/usb/gadget/function/storage_common.c | 9 ---------
> > 1 file changed, 9 deletions(-)
> >
> > --- linux.orig/drivers/usb/gadget/function/storage_common.c
> > +++ linux/drivers/usb/gadget/function/storage_common.c
> > @@ -247,15 +247,6 @@ int fsg_lun_open(struct fsg_lun *curlun,
> >
> > num_sectors = size >> blkbits; /* File size in logic-block-size blocks */
> > min_sectors = 1;
> > - if (curlun->cdrom) {
> > - min_sectors = 300; /* Smallest track is 300 frames */
> > - if (num_sectors >= 256*60*75) {
> > - num_sectors = 256*60*75 - 1;
> > - LINFO(curlun, "file too big: %s\n", filename);
> > - LINFO(curlun, "using only first %d blocks\n",
> > - (int) num_sectors);
> > - }
> > - }
> > if (num_sectors < min_sectors) {
> > LINFO(curlun, "file too small: %s\n", filename);
> > rc = -ETOOSMALL;
>
> NAK. This patch is wrong, for a very simple reason. You wrote:
>
> > I used usb cdrom emulation to play video dvd for my daughter
>
> and this demonstrates the error quite plainly. You can't use _CD_
> emulation to imitate a _DVD_ -- they are different sorts of media.
> Just think of what happens when you try playing a DVD on a CD player.
>
> A more suitable approach would be to add DVD emulation to the driver.
>
They are both iso9660 images, aren't they? So from data image point
of view there's no difference, it is not worth to create another mode
for dvd data.
We should not emulate cd drive to support different cd media type,
it is far more better to support just iso9660 volume no matter how
large the size is as long as it is fit for iso9660 spec.
OTOH, the size limitation is a bug:
* isofs can be less than 300 sectors, the 300 sectors limitation is for
music cd I think. Try mkisofs a blank directory and burn it.
* There's 99 minutes dics even for cdrom, see:
http://en.wikipedia.org/wiki/CD-R
If we code to support different size discs, it will looks like a wrong way.
Thanks
Dave
next prev parent reply other threads:[~2015-03-09 5:34 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-08 4:24 [PATCH] usb gadget: remove size limitation for storage cdrom Dave Young
2015-03-08 15:29 ` Alan Stern
2015-03-09 5:33 ` Dave Young [this message]
2015-03-09 14:22 ` Alan Stern
2015-03-09 14:39 ` Alan Stern
2015-03-12 1:34 ` Dave Young
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20150309053356.GA6029@darkstar.redhat.com \
--to=dyoung@redhat.com \
--cc=balbi@ti.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=stern@rowland.harvard.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox