]> bbs.cooldavid.org Git - net-next-2.6.git/blobdiff - drivers/usb/gadget/storage_common.c
USB: g_file_storage: per-LUN ro, removable and cdrom flags handling changed
[net-next-2.6.git] / drivers / usb / gadget / storage_common.c
index 19bf1e330dd0a392b21fc0ba309a73d676d79346..affd23b5436f71e6d252b8fa89febb28ff098f08 100644 (file)
@@ -225,7 +225,10 @@ struct fsg_lun {
        loff_t          file_length;
        loff_t          num_sectors;
 
+       unsigned int    initially_ro : 1;
        unsigned int    ro : 1;
+       unsigned int    removable : 1;
+       unsigned int    cdrom : 1;
        unsigned int    prevent_medium_removal : 1;
        unsigned int    registered : 1;
        unsigned int    info_valid : 1;
@@ -478,7 +481,7 @@ static int fsg_lun_open(struct fsg_lun *curlun, const char *filename)
        loff_t                          min_sectors;
 
        /* R/W if we can, R/O if we must */
-       ro = curlun->ro;
+       ro = curlun->initially_ro;
        if (!ro) {
                filp = filp_open(filename, O_RDWR | O_LARGEFILE, 0);
                if (-EROFS == PTR_ERR(filp))
@@ -521,7 +524,7 @@ static int fsg_lun_open(struct fsg_lun *curlun, const char *filename)
        }
        num_sectors = size >> 9;        // File size in 512-byte blocks
        min_sectors = 1;
-       if (mod_data.cdrom) {
+       if (curlun->cdrom) {
                num_sectors &= ~3;      // Reduce to a multiple of 2048
                min_sectors = 300*4;    // Smallest track is 300 frames
                if (num_sectors >= 256*60*75*4) {