mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Roger Quadros <roger.quadros@nokia.com>
To: gregkh@suse.de
Cc: mina86@mina86.com, linux-usb@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: [PATCH 2/5] usb: gadget: f_mass_storage: If 'ro'/'cdrom' specified, open file as read-only
Date: Tue,  5 Apr 2011 18:36:39 +0300	[thread overview]
Message-ID: <1302017802-16614-3-git-send-email-roger.quadros@nokia.com> (raw)
In-Reply-To: <1302017802-16614-1-git-send-email-roger.quadros@nokia.com>

If we don't need Write access then attempt to open backing file in Read Only
mode instead of bailing out too soon.

Signed-off-by: Roger Quadros <roger.quadros@nokia.com>
---
 drivers/usb/gadget/f_mass_storage.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/drivers/usb/gadget/f_mass_storage.c b/drivers/usb/gadget/f_mass_storage.c
index 90472af..5d7de93 100644
--- a/drivers/usb/gadget/f_mass_storage.c
+++ b/drivers/usb/gadget/f_mass_storage.c
@@ -2810,6 +2810,7 @@ static struct fsg_common *fsg_common_init(struct fsg_common *common,
 	for (i = 0, lcfg = cfg->luns; i < nluns; ++i, ++curlun, ++lcfg) {
 		curlun->cdrom = !!lcfg->cdrom;
 		curlun->ro = lcfg->cdrom || lcfg->ro;
+		curlun->initially_ro = curlun->ro;
 		curlun->removable = lcfg->removable;
 		curlun->dev.release = fsg_lun_release;
 		curlun->dev.parent = &gadget->dev;
-- 
1.6.0.4


  parent reply	other threads:[~2011-04-05 15:34 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-05 15:36 [PATCH 0/5] fixes for f_mass_storage Roger Quadros
2011-04-05 15:36 ` [PATCH 1/5] usb: gadget: f_mass_storage: Fix Bulk-only RESET handling Roger Quadros
2011-04-05 16:09   ` Michal Nazarewicz
2011-04-05 15:36 ` Roger Quadros [this message]
2011-04-05 16:04   ` [PATCH 2/5] usb: gadget: f_mass_storage: If 'ro'/'cdrom' specified, open file as read-only Michal Nazarewicz
2011-04-05 15:36 ` [PATCH 3/5] usb: gadget: f_mass_storage: Prevent NULL pointer dereference Roger Quadros
2011-04-05 15:56   ` Michal Nazarewicz
2011-04-05 17:47     ` Roger Quadros
2011-04-05 15:36 ` [PATCH 4/5] usb: gadget: f_mass_storage: Fix potential memory leak Roger Quadros
2011-04-05 15:59   ` Michal Nazarewicz
2011-04-05 17:47     ` Roger Quadros
2011-04-05 15:36 ` [PATCH 5/5] usb: gadget: f_mass_storage: remove unnecessary initialization Roger Quadros
2011-04-05 16:01   ` Michal Nazarewicz
2011-04-05 16:10 ` [PATCH 0/5] fixes for f_mass_storage Michal Nazarewicz

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=1302017802-16614-3-git-send-email-roger.quadros@nokia.com \
    --to=roger.quadros@nokia.com \
    --cc=gregkh@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=mina86@mina86.com \
    /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

all inboxes | Powered by JetHome®