curlun 288 drivers/usb/gadget/function/f_mass_storage.c struct fsg_lun *curlun; curlun 621 drivers/usb/gadget/function/f_mass_storage.c struct fsg_lun *curlun = common->curlun; curlun 645 drivers/usb/gadget/function/f_mass_storage.c curlun->sense_data = SS_INVALID_FIELD_IN_CDB; curlun 649 drivers/usb/gadget/function/f_mass_storage.c if (lba >= curlun->num_sectors) { curlun 650 drivers/usb/gadget/function/f_mass_storage.c curlun->sense_data = SS_LOGICAL_BLOCK_ADDRESS_OUT_OF_RANGE; curlun 653 drivers/usb/gadget/function/f_mass_storage.c file_offset = ((loff_t) lba) << curlun->blkbits; curlun 669 drivers/usb/gadget/function/f_mass_storage.c curlun->file_length - file_offset); curlun 682 drivers/usb/gadget/function/f_mass_storage.c curlun->sense_data = curlun 684 drivers/usb/gadget/function/f_mass_storage.c curlun->sense_data_info = curlun 685 drivers/usb/gadget/function/f_mass_storage.c file_offset >> curlun->blkbits; curlun 686 drivers/usb/gadget/function/f_mass_storage.c curlun->info_valid = 1; curlun 694 drivers/usb/gadget/function/f_mass_storage.c nread = kernel_read(curlun->filp, bh->buf, amount, curlun 696 drivers/usb/gadget/function/f_mass_storage.c VLDBG(curlun, "file read %u @ %llu -> %d\n", amount, curlun 702 drivers/usb/gadget/function/f_mass_storage.c LDBG(curlun, "error in file read: %d\n", (int)nread); curlun 705 drivers/usb/gadget/function/f_mass_storage.c LDBG(curlun, "partial file read: %d/%u\n", curlun 707 drivers/usb/gadget/function/f_mass_storage.c nread = round_down(nread, curlun->blksize); curlun 723 drivers/usb/gadget/function/f_mass_storage.c curlun->sense_data = SS_UNRECOVERED_READ_ERROR; curlun 724 drivers/usb/gadget/function/f_mass_storage.c curlun->sense_data_info = curlun 725 drivers/usb/gadget/function/f_mass_storage.c file_offset >> curlun->blkbits; curlun 726 drivers/usb/gadget/function/f_mass_storage.c curlun->info_valid = 1; curlun 749 drivers/usb/gadget/function/f_mass_storage.c struct fsg_lun *curlun = common->curlun; curlun 759 drivers/usb/gadget/function/f_mass_storage.c if (curlun->ro) { curlun 760 drivers/usb/gadget/function/f_mass_storage.c curlun->sense_data = SS_WRITE_PROTECTED; curlun 763 drivers/usb/gadget/function/f_mass_storage.c spin_lock(&curlun->filp->f_lock); curlun 764 drivers/usb/gadget/function/f_mass_storage.c curlun->filp->f_flags &= ~O_SYNC; /* Default is not to wait */ curlun 765 drivers/usb/gadget/function/f_mass_storage.c spin_unlock(&curlun->filp->f_lock); curlun 783 drivers/usb/gadget/function/f_mass_storage.c curlun->sense_data = SS_INVALID_FIELD_IN_CDB; curlun 786 drivers/usb/gadget/function/f_mass_storage.c if (!curlun->nofua && (common->cmnd[1] & 0x08)) { /* FUA */ curlun 787 drivers/usb/gadget/function/f_mass_storage.c spin_lock(&curlun->filp->f_lock); curlun 788 drivers/usb/gadget/function/f_mass_storage.c curlun->filp->f_flags |= O_SYNC; curlun 789 drivers/usb/gadget/function/f_mass_storage.c spin_unlock(&curlun->filp->f_lock); curlun 792 drivers/usb/gadget/function/f_mass_storage.c if (lba >= curlun->num_sectors) { curlun 793 drivers/usb/gadget/function/f_mass_storage.c curlun->sense_data = SS_LOGICAL_BLOCK_ADDRESS_OUT_OF_RANGE; curlun 799 drivers/usb/gadget/function/f_mass_storage.c file_offset = usb_offset = ((loff_t) lba) << curlun->blkbits; curlun 817 drivers/usb/gadget/function/f_mass_storage.c if (usb_offset >= curlun->file_length) { curlun 819 drivers/usb/gadget/function/f_mass_storage.c curlun->sense_data = curlun 821 drivers/usb/gadget/function/f_mass_storage.c curlun->sense_data_info = curlun 822 drivers/usb/gadget/function/f_mass_storage.c usb_offset >> curlun->blkbits; curlun 823 drivers/usb/gadget/function/f_mass_storage.c curlun->info_valid = 1; curlun 862 drivers/usb/gadget/function/f_mass_storage.c curlun->sense_data = SS_COMMUNICATION_FAILURE; curlun 863 drivers/usb/gadget/function/f_mass_storage.c curlun->sense_data_info = curlun 864 drivers/usb/gadget/function/f_mass_storage.c file_offset >> curlun->blkbits; curlun 865 drivers/usb/gadget/function/f_mass_storage.c curlun->info_valid = 1; curlun 870 drivers/usb/gadget/function/f_mass_storage.c if (curlun->file_length - file_offset < amount) { curlun 871 drivers/usb/gadget/function/f_mass_storage.c LERROR(curlun, "write %u @ %llu beyond end %llu\n", curlun 873 drivers/usb/gadget/function/f_mass_storage.c (unsigned long long)curlun->file_length); curlun 874 drivers/usb/gadget/function/f_mass_storage.c amount = curlun->file_length - file_offset; curlun 884 drivers/usb/gadget/function/f_mass_storage.c amount = round_down(amount, curlun->blksize); curlun 890 drivers/usb/gadget/function/f_mass_storage.c nwritten = kernel_write(curlun->filp, bh->buf, amount, curlun 892 drivers/usb/gadget/function/f_mass_storage.c VLDBG(curlun, "file write %u @ %llu -> %d\n", amount, curlun 898 drivers/usb/gadget/function/f_mass_storage.c LDBG(curlun, "error in file write: %d\n", curlun 902 drivers/usb/gadget/function/f_mass_storage.c LDBG(curlun, "partial file write: %d/%u\n", curlun 904 drivers/usb/gadget/function/f_mass_storage.c nwritten = round_down(nwritten, curlun->blksize); curlun 912 drivers/usb/gadget/function/f_mass_storage.c curlun->sense_data = SS_WRITE_ERROR; curlun 913 drivers/usb/gadget/function/f_mass_storage.c curlun->sense_data_info = curlun 914 drivers/usb/gadget/function/f_mass_storage.c file_offset >> curlun->blkbits; curlun 915 drivers/usb/gadget/function/f_mass_storage.c curlun->info_valid = 1; curlun 935 drivers/usb/gadget/function/f_mass_storage.c struct fsg_lun *curlun = common->curlun; curlun 940 drivers/usb/gadget/function/f_mass_storage.c rc = fsg_lun_fsync_sub(curlun); curlun 942 drivers/usb/gadget/function/f_mass_storage.c curlun->sense_data = SS_WRITE_ERROR; curlun 949 drivers/usb/gadget/function/f_mass_storage.c static void invalidate_sub(struct fsg_lun *curlun) curlun 951 drivers/usb/gadget/function/f_mass_storage.c struct file *filp = curlun->filp; curlun 956 drivers/usb/gadget/function/f_mass_storage.c VLDBG(curlun, "invalidate_mapping_pages -> %ld\n", rc); curlun 961 drivers/usb/gadget/function/f_mass_storage.c struct fsg_lun *curlun = common->curlun; curlun 975 drivers/usb/gadget/function/f_mass_storage.c if (lba >= curlun->num_sectors) { curlun 976 drivers/usb/gadget/function/f_mass_storage.c curlun->sense_data = SS_LOGICAL_BLOCK_ADDRESS_OUT_OF_RANGE; curlun 985 drivers/usb/gadget/function/f_mass_storage.c curlun->sense_data = SS_INVALID_FIELD_IN_CDB; curlun 994 drivers/usb/gadget/function/f_mass_storage.c amount_left = verification_length << curlun->blkbits; curlun 995 drivers/usb/gadget/function/f_mass_storage.c file_offset = ((loff_t) lba) << curlun->blkbits; curlun 998 drivers/usb/gadget/function/f_mass_storage.c fsg_lun_fsync_sub(curlun); curlun 1002 drivers/usb/gadget/function/f_mass_storage.c invalidate_sub(curlun); curlun 1016 drivers/usb/gadget/function/f_mass_storage.c curlun->file_length - file_offset); curlun 1018 drivers/usb/gadget/function/f_mass_storage.c curlun->sense_data = curlun 1020 drivers/usb/gadget/function/f_mass_storage.c curlun->sense_data_info = curlun 1021 drivers/usb/gadget/function/f_mass_storage.c file_offset >> curlun->blkbits; curlun 1022 drivers/usb/gadget/function/f_mass_storage.c curlun->info_valid = 1; curlun 1028 drivers/usb/gadget/function/f_mass_storage.c nread = kernel_read(curlun->filp, bh->buf, amount, curlun 1030 drivers/usb/gadget/function/f_mass_storage.c VLDBG(curlun, "file read %u @ %llu -> %d\n", amount, curlun 1037 drivers/usb/gadget/function/f_mass_storage.c LDBG(curlun, "error in file verify: %d\n", (int)nread); curlun 1040 drivers/usb/gadget/function/f_mass_storage.c LDBG(curlun, "partial file verify: %d/%u\n", curlun 1042 drivers/usb/gadget/function/f_mass_storage.c nread = round_down(nread, curlun->blksize); curlun 1045 drivers/usb/gadget/function/f_mass_storage.c curlun->sense_data = SS_UNRECOVERED_READ_ERROR; curlun 1046 drivers/usb/gadget/function/f_mass_storage.c curlun->sense_data_info = curlun 1047 drivers/usb/gadget/function/f_mass_storage.c file_offset >> curlun->blkbits; curlun 1048 drivers/usb/gadget/function/f_mass_storage.c curlun->info_valid = 1; curlun 1062 drivers/usb/gadget/function/f_mass_storage.c struct fsg_lun *curlun = common->curlun; curlun 1065 drivers/usb/gadget/function/f_mass_storage.c if (!curlun) { /* Unsupported LUNs are okay */ curlun 1073 drivers/usb/gadget/function/f_mass_storage.c buf[0] = curlun->cdrom ? TYPE_ROM : TYPE_DISK; curlun 1074 drivers/usb/gadget/function/f_mass_storage.c buf[1] = curlun->removable ? 0x80 : 0; curlun 1081 drivers/usb/gadget/function/f_mass_storage.c if (curlun->inquiry_string[0]) curlun 1082 drivers/usb/gadget/function/f_mass_storage.c memcpy(buf + 8, curlun->inquiry_string, curlun 1083 drivers/usb/gadget/function/f_mass_storage.c sizeof(curlun->inquiry_string)); curlun 1092 drivers/usb/gadget/function/f_mass_storage.c struct fsg_lun *curlun = common->curlun; curlun 1113 drivers/usb/gadget/function/f_mass_storage.c if (curlun && curlun->unit_attention_data != SS_NO_SENSE) { curlun 1114 drivers/usb/gadget/function/f_mass_storage.c curlun->sense_data = curlun->unit_attention_data; curlun 1115 drivers/usb/gadget/function/f_mass_storage.c curlun->unit_attention_data = SS_NO_SENSE; curlun 1119 drivers/usb/gadget/function/f_mass_storage.c if (!curlun) { /* Unsupported LUNs are okay */ curlun 1125 drivers/usb/gadget/function/f_mass_storage.c sd = curlun->sense_data; curlun 1126 drivers/usb/gadget/function/f_mass_storage.c sdinfo = curlun->sense_data_info; curlun 1127 drivers/usb/gadget/function/f_mass_storage.c valid = curlun->info_valid << 7; curlun 1128 drivers/usb/gadget/function/f_mass_storage.c curlun->sense_data = SS_NO_SENSE; curlun 1129 drivers/usb/gadget/function/f_mass_storage.c curlun->sense_data_info = 0; curlun 1130 drivers/usb/gadget/function/f_mass_storage.c curlun->info_valid = 0; curlun 1145 drivers/usb/gadget/function/f_mass_storage.c struct fsg_lun *curlun = common->curlun; curlun 1152 drivers/usb/gadget/function/f_mass_storage.c curlun->sense_data = SS_INVALID_FIELD_IN_CDB; curlun 1156 drivers/usb/gadget/function/f_mass_storage.c put_unaligned_be32(curlun->num_sectors - 1, &buf[0]); curlun 1158 drivers/usb/gadget/function/f_mass_storage.c put_unaligned_be32(curlun->blksize, &buf[4]);/* Block length */ curlun 1164 drivers/usb/gadget/function/f_mass_storage.c struct fsg_lun *curlun = common->curlun; curlun 1170 drivers/usb/gadget/function/f_mass_storage.c curlun->sense_data = SS_INVALID_FIELD_IN_CDB; curlun 1173 drivers/usb/gadget/function/f_mass_storage.c if (lba >= curlun->num_sectors) { curlun 1174 drivers/usb/gadget/function/f_mass_storage.c curlun->sense_data = SS_LOGICAL_BLOCK_ADDRESS_OUT_OF_RANGE; curlun 1186 drivers/usb/gadget/function/f_mass_storage.c struct fsg_lun *curlun = common->curlun; curlun 1193 drivers/usb/gadget/function/f_mass_storage.c curlun->sense_data = SS_INVALID_FIELD_IN_CDB; curlun 1207 drivers/usb/gadget/function/f_mass_storage.c store_cdrom_address(&buf[16], msf, curlun->num_sectors); curlun 1213 drivers/usb/gadget/function/f_mass_storage.c struct fsg_lun *curlun = common->curlun; curlun 1223 drivers/usb/gadget/function/f_mass_storage.c curlun->sense_data = SS_INVALID_FIELD_IN_CDB; curlun 1229 drivers/usb/gadget/function/f_mass_storage.c curlun->sense_data = SS_SAVING_PARAMETERS_NOT_SUPPORTED; curlun 1243 drivers/usb/gadget/function/f_mass_storage.c buf[2] = (curlun->ro ? 0x80 : 0x00); /* WP, DPOFUA */ curlun 1247 drivers/usb/gadget/function/f_mass_storage.c buf[3] = (curlun->ro ? 0x80 : 0x00); /* WP, DPOFUA */ curlun 1285 drivers/usb/gadget/function/f_mass_storage.c curlun->sense_data = SS_INVALID_FIELD_IN_CDB; curlun 1299 drivers/usb/gadget/function/f_mass_storage.c struct fsg_lun *curlun = common->curlun; curlun 1302 drivers/usb/gadget/function/f_mass_storage.c if (!curlun) { curlun 1304 drivers/usb/gadget/function/f_mass_storage.c } else if (!curlun->removable) { curlun 1305 drivers/usb/gadget/function/f_mass_storage.c curlun->sense_data = SS_INVALID_COMMAND; curlun 1309 drivers/usb/gadget/function/f_mass_storage.c curlun->sense_data = SS_INVALID_FIELD_IN_CDB; curlun 1321 drivers/usb/gadget/function/f_mass_storage.c if (!fsg_lun_is_open(curlun)) { curlun 1322 drivers/usb/gadget/function/f_mass_storage.c curlun->sense_data = SS_MEDIUM_NOT_PRESENT; curlun 1329 drivers/usb/gadget/function/f_mass_storage.c if (curlun->prevent_medium_removal) { curlun 1330 drivers/usb/gadget/function/f_mass_storage.c LDBG(curlun, "unload attempt prevented\n"); curlun 1331 drivers/usb/gadget/function/f_mass_storage.c curlun->sense_data = SS_MEDIUM_REMOVAL_PREVENTED; curlun 1340 drivers/usb/gadget/function/f_mass_storage.c fsg_lun_close(curlun); curlun 1349 drivers/usb/gadget/function/f_mass_storage.c struct fsg_lun *curlun = common->curlun; curlun 1352 drivers/usb/gadget/function/f_mass_storage.c if (!common->curlun) { curlun 1354 drivers/usb/gadget/function/f_mass_storage.c } else if (!common->curlun->removable) { curlun 1355 drivers/usb/gadget/function/f_mass_storage.c common->curlun->sense_data = SS_INVALID_COMMAND; curlun 1361 drivers/usb/gadget/function/f_mass_storage.c curlun->sense_data = SS_INVALID_FIELD_IN_CDB; curlun 1365 drivers/usb/gadget/function/f_mass_storage.c if (curlun->prevent_medium_removal && !prevent) curlun 1366 drivers/usb/gadget/function/f_mass_storage.c fsg_lun_fsync_sub(curlun); curlun 1367 drivers/usb/gadget/function/f_mass_storage.c curlun->prevent_medium_removal = prevent; curlun 1374 drivers/usb/gadget/function/f_mass_storage.c struct fsg_lun *curlun = common->curlun; curlun 1381 drivers/usb/gadget/function/f_mass_storage.c put_unaligned_be32(curlun->num_sectors, &buf[0]); curlun 1383 drivers/usb/gadget/function/f_mass_storage.c put_unaligned_be32(curlun->blksize, &buf[4]);/* Block length */ curlun 1390 drivers/usb/gadget/function/f_mass_storage.c struct fsg_lun *curlun = common->curlun; curlun 1393 drivers/usb/gadget/function/f_mass_storage.c if (curlun) curlun 1394 drivers/usb/gadget/function/f_mass_storage.c curlun->sense_data = SS_INVALID_COMMAND; curlun 1599 drivers/usb/gadget/function/f_mass_storage.c struct fsg_lun *curlun = common->curlun; curlun 1612 drivers/usb/gadget/function/f_mass_storage.c if (curlun) { curlun 1613 drivers/usb/gadget/function/f_mass_storage.c sd = curlun->sense_data; curlun 1614 drivers/usb/gadget/function/f_mass_storage.c sdinfo = curlun->sense_data_info; curlun 1665 drivers/usb/gadget/function/f_mass_storage.c struct fsg_lun *curlun; curlun 1732 drivers/usb/gadget/function/f_mass_storage.c curlun = common->curlun; curlun 1733 drivers/usb/gadget/function/f_mass_storage.c if (curlun) { curlun 1735 drivers/usb/gadget/function/f_mass_storage.c curlun->sense_data = SS_NO_SENSE; curlun 1736 drivers/usb/gadget/function/f_mass_storage.c curlun->sense_data_info = 0; curlun 1737 drivers/usb/gadget/function/f_mass_storage.c curlun->info_valid = 0; curlun 1757 drivers/usb/gadget/function/f_mass_storage.c if (curlun && curlun->unit_attention_data != SS_NO_SENSE && curlun 1760 drivers/usb/gadget/function/f_mass_storage.c curlun->sense_data = curlun->unit_attention_data; curlun 1761 drivers/usb/gadget/function/f_mass_storage.c curlun->unit_attention_data = SS_NO_SENSE; curlun 1769 drivers/usb/gadget/function/f_mass_storage.c if (curlun) curlun 1770 drivers/usb/gadget/function/f_mass_storage.c curlun->sense_data = SS_INVALID_FIELD_IN_CDB; curlun 1777 drivers/usb/gadget/function/f_mass_storage.c if (curlun && !fsg_lun_is_open(curlun) && needs_medium) { curlun 1778 drivers/usb/gadget/function/f_mass_storage.c curlun->sense_data = SS_MEDIUM_NOT_PRESENT; curlun 1790 drivers/usb/gadget/function/f_mass_storage.c if (common->curlun) curlun 1791 drivers/usb/gadget/function/f_mass_storage.c common->data_size_from_cmnd <<= common->curlun->blkbits; curlun 1918 drivers/usb/gadget/function/f_mass_storage.c if (!common->curlun || !common->curlun->cdrom) curlun 1930 drivers/usb/gadget/function/f_mass_storage.c if (!common->curlun || !common->curlun->cdrom) curlun 2050 drivers/usb/gadget/function/f_mass_storage.c common->curlun->sense_data = SS_INVALID_COMMAND; curlun 2141 drivers/usb/gadget/function/f_mass_storage.c common->curlun = common->luns[common->lun]; curlun 2143 drivers/usb/gadget/function/f_mass_storage.c common->curlun = NULL; curlun 2315 drivers/usb/gadget/function/f_mass_storage.c struct fsg_lun *curlun; curlun 2377 drivers/usb/gadget/function/f_mass_storage.c curlun = common->luns[i]; curlun 2378 drivers/usb/gadget/function/f_mass_storage.c if (!curlun) curlun 2380 drivers/usb/gadget/function/f_mass_storage.c curlun->prevent_medium_removal = 0; curlun 2381 drivers/usb/gadget/function/f_mass_storage.c curlun->sense_data = SS_NO_SENSE; curlun 2382 drivers/usb/gadget/function/f_mass_storage.c curlun->unit_attention_data = SS_NO_SENSE; curlun 2383 drivers/usb/gadget/function/f_mass_storage.c curlun->sense_data_info = 0; curlun 2384 drivers/usb/gadget/function/f_mass_storage.c curlun->info_valid = 0; curlun 2491 drivers/usb/gadget/function/f_mass_storage.c struct fsg_lun *curlun = common->luns[i]; curlun 2493 drivers/usb/gadget/function/f_mass_storage.c if (curlun && fsg_lun_is_open(curlun)) curlun 2494 drivers/usb/gadget/function/f_mass_storage.c fsg_lun_close(curlun); curlun 2507 drivers/usb/gadget/function/f_mass_storage.c struct fsg_lun *curlun = fsg_lun_from_dev(dev); curlun 2509 drivers/usb/gadget/function/f_mass_storage.c return fsg_show_ro(curlun, buf); curlun 2515 drivers/usb/gadget/function/f_mass_storage.c struct fsg_lun *curlun = fsg_lun_from_dev(dev); curlun 2517 drivers/usb/gadget/function/f_mass_storage.c return fsg_show_nofua(curlun, buf); curlun 2523 drivers/usb/gadget/function/f_mass_storage.c struct fsg_lun *curlun = fsg_lun_from_dev(dev); curlun 2526 drivers/usb/gadget/function/f_mass_storage.c return fsg_show_file(curlun, filesem, buf); curlun 2532 drivers/usb/gadget/function/f_mass_storage.c struct fsg_lun *curlun = fsg_lun_from_dev(dev); curlun 2535 drivers/usb/gadget/function/f_mass_storage.c return fsg_store_ro(curlun, filesem, buf, count); curlun 2541 drivers/usb/gadget/function/f_mass_storage.c struct fsg_lun *curlun = fsg_lun_from_dev(dev); curlun 2543 drivers/usb/gadget/function/f_mass_storage.c return fsg_store_nofua(curlun, buf, count); curlun 2549 drivers/usb/gadget/function/f_mass_storage.c struct fsg_lun *curlun = fsg_lun_from_dev(dev); curlun 2552 drivers/usb/gadget/function/f_mass_storage.c return fsg_store_file(curlun, filesem, buf, count); curlun 168 drivers/usb/gadget/function/storage_common.c void fsg_lun_close(struct fsg_lun *curlun) curlun 170 drivers/usb/gadget/function/storage_common.c if (curlun->filp) { curlun 171 drivers/usb/gadget/function/storage_common.c LDBG(curlun, "close backing file\n"); curlun 172 drivers/usb/gadget/function/storage_common.c fput(curlun->filp); curlun 173 drivers/usb/gadget/function/storage_common.c curlun->filp = NULL; curlun 178 drivers/usb/gadget/function/storage_common.c int fsg_lun_open(struct fsg_lun *curlun, const char *filename) curlun 191 drivers/usb/gadget/function/storage_common.c ro = curlun->initially_ro; curlun 200 drivers/usb/gadget/function/storage_common.c LINFO(curlun, "unable to open backing file: %s\n", filename); curlun 209 drivers/usb/gadget/function/storage_common.c LINFO(curlun, "invalid file type: %s\n", filename); curlun 218 drivers/usb/gadget/function/storage_common.c LINFO(curlun, "file not readable: %s\n", filename); curlun 226 drivers/usb/gadget/function/storage_common.c LINFO(curlun, "unable to find file size: %s\n", filename); curlun 231 drivers/usb/gadget/function/storage_common.c if (curlun->cdrom) { curlun 244 drivers/usb/gadget/function/storage_common.c if (curlun->cdrom) { curlun 248 drivers/usb/gadget/function/storage_common.c LINFO(curlun, "file too big: %s\n", filename); curlun 249 drivers/usb/gadget/function/storage_common.c LINFO(curlun, "using only first %d blocks\n", curlun 254 drivers/usb/gadget/function/storage_common.c LINFO(curlun, "file too small: %s\n", filename); curlun 259 drivers/usb/gadget/function/storage_common.c if (fsg_lun_is_open(curlun)) curlun 260 drivers/usb/gadget/function/storage_common.c fsg_lun_close(curlun); curlun 262 drivers/usb/gadget/function/storage_common.c curlun->blksize = blksize; curlun 263 drivers/usb/gadget/function/storage_common.c curlun->blkbits = blkbits; curlun 264 drivers/usb/gadget/function/storage_common.c curlun->ro = ro; curlun 265 drivers/usb/gadget/function/storage_common.c curlun->filp = filp; curlun 266 drivers/usb/gadget/function/storage_common.c curlun->file_length = size; curlun 267 drivers/usb/gadget/function/storage_common.c curlun->num_sectors = num_sectors; curlun 268 drivers/usb/gadget/function/storage_common.c LDBG(curlun, "open backing file: %s\n", filename); curlun 284 drivers/usb/gadget/function/storage_common.c int fsg_lun_fsync_sub(struct fsg_lun *curlun) curlun 286 drivers/usb/gadget/function/storage_common.c struct file *filp = curlun->filp; curlun 288 drivers/usb/gadget/function/storage_common.c if (curlun->ro || !filp) curlun 316 drivers/usb/gadget/function/storage_common.c ssize_t fsg_show_ro(struct fsg_lun *curlun, char *buf) curlun 318 drivers/usb/gadget/function/storage_common.c return sprintf(buf, "%d\n", fsg_lun_is_open(curlun) curlun 319 drivers/usb/gadget/function/storage_common.c ? curlun->ro curlun 320 drivers/usb/gadget/function/storage_common.c : curlun->initially_ro); curlun 324 drivers/usb/gadget/function/storage_common.c ssize_t fsg_show_nofua(struct fsg_lun *curlun, char *buf) curlun 326 drivers/usb/gadget/function/storage_common.c return sprintf(buf, "%u\n", curlun->nofua); curlun 330 drivers/usb/gadget/function/storage_common.c ssize_t fsg_show_file(struct fsg_lun *curlun, struct rw_semaphore *filesem, curlun 337 drivers/usb/gadget/function/storage_common.c if (fsg_lun_is_open(curlun)) { /* Get the complete pathname */ curlun 338 drivers/usb/gadget/function/storage_common.c p = file_path(curlun->filp, buf, PAGE_SIZE - 1); curlun 356 drivers/usb/gadget/function/storage_common.c ssize_t fsg_show_cdrom(struct fsg_lun *curlun, char *buf) curlun 358 drivers/usb/gadget/function/storage_common.c return sprintf(buf, "%u\n", curlun->cdrom); curlun 362 drivers/usb/gadget/function/storage_common.c ssize_t fsg_show_removable(struct fsg_lun *curlun, char *buf) curlun 364 drivers/usb/gadget/function/storage_common.c return sprintf(buf, "%u\n", curlun->removable); curlun 368 drivers/usb/gadget/function/storage_common.c ssize_t fsg_show_inquiry_string(struct fsg_lun *curlun, char *buf) curlun 370 drivers/usb/gadget/function/storage_common.c return sprintf(buf, "%s\n", curlun->inquiry_string); curlun 377 drivers/usb/gadget/function/storage_common.c static ssize_t _fsg_store_ro(struct fsg_lun *curlun, bool ro) curlun 379 drivers/usb/gadget/function/storage_common.c if (fsg_lun_is_open(curlun)) { curlun 380 drivers/usb/gadget/function/storage_common.c LDBG(curlun, "read-only status change prevented\n"); curlun 384 drivers/usb/gadget/function/storage_common.c curlun->ro = ro; curlun 385 drivers/usb/gadget/function/storage_common.c curlun->initially_ro = ro; curlun 386 drivers/usb/gadget/function/storage_common.c LDBG(curlun, "read-only status set to %d\n", curlun->ro); curlun 391 drivers/usb/gadget/function/storage_common.c ssize_t fsg_store_ro(struct fsg_lun *curlun, struct rw_semaphore *filesem, curlun 406 drivers/usb/gadget/function/storage_common.c rc = _fsg_store_ro(curlun, ro); curlun 415 drivers/usb/gadget/function/storage_common.c ssize_t fsg_store_nofua(struct fsg_lun *curlun, const char *buf, size_t count) curlun 425 drivers/usb/gadget/function/storage_common.c if (!nofua && curlun->nofua) curlun 426 drivers/usb/gadget/function/storage_common.c fsg_lun_fsync_sub(curlun); curlun 428 drivers/usb/gadget/function/storage_common.c curlun->nofua = nofua; curlun 434 drivers/usb/gadget/function/storage_common.c ssize_t fsg_store_file(struct fsg_lun *curlun, struct rw_semaphore *filesem, curlun 439 drivers/usb/gadget/function/storage_common.c if (curlun->prevent_medium_removal && fsg_lun_is_open(curlun)) { curlun 440 drivers/usb/gadget/function/storage_common.c LDBG(curlun, "eject attempt prevented\n"); curlun 452 drivers/usb/gadget/function/storage_common.c rc = fsg_lun_open(curlun, buf); curlun 454 drivers/usb/gadget/function/storage_common.c curlun->unit_attention_data = curlun 456 drivers/usb/gadget/function/storage_common.c } else if (fsg_lun_is_open(curlun)) { curlun 457 drivers/usb/gadget/function/storage_common.c fsg_lun_close(curlun); curlun 458 drivers/usb/gadget/function/storage_common.c curlun->unit_attention_data = SS_MEDIUM_NOT_PRESENT; curlun 465 drivers/usb/gadget/function/storage_common.c ssize_t fsg_store_cdrom(struct fsg_lun *curlun, struct rw_semaphore *filesem, curlun 476 drivers/usb/gadget/function/storage_common.c ret = cdrom ? _fsg_store_ro(curlun, true) : 0; curlun 479 drivers/usb/gadget/function/storage_common.c curlun->cdrom = cdrom; curlun 488 drivers/usb/gadget/function/storage_common.c ssize_t fsg_store_removable(struct fsg_lun *curlun, const char *buf, curlun 498 drivers/usb/gadget/function/storage_common.c curlun->removable = removable; curlun 504 drivers/usb/gadget/function/storage_common.c ssize_t fsg_store_inquiry_string(struct fsg_lun *curlun, const char *buf, curlun 507 drivers/usb/gadget/function/storage_common.c const size_t len = min(count, sizeof(curlun->inquiry_string)); curlun 510 drivers/usb/gadget/function/storage_common.c curlun->inquiry_string[0] = 0; curlun 512 drivers/usb/gadget/function/storage_common.c snprintf(curlun->inquiry_string, curlun 513 drivers/usb/gadget/function/storage_common.c sizeof(curlun->inquiry_string), "%-28s", buf); curlun 514 drivers/usb/gadget/function/storage_common.c if (curlun->inquiry_string[len-1] == '\n') curlun 515 drivers/usb/gadget/function/storage_common.c curlun->inquiry_string[len-1] = ' '; curlun 125 drivers/usb/gadget/function/storage_common.h static inline bool fsg_lun_is_open(struct fsg_lun *curlun) curlun 127 drivers/usb/gadget/function/storage_common.h return curlun->filp != NULL; curlun 205 drivers/usb/gadget/function/storage_common.h void fsg_lun_close(struct fsg_lun *curlun); curlun 206 drivers/usb/gadget/function/storage_common.h int fsg_lun_open(struct fsg_lun *curlun, const char *filename); curlun 207 drivers/usb/gadget/function/storage_common.h int fsg_lun_fsync_sub(struct fsg_lun *curlun); curlun 209 drivers/usb/gadget/function/storage_common.h ssize_t fsg_show_ro(struct fsg_lun *curlun, char *buf); curlun 210 drivers/usb/gadget/function/storage_common.h ssize_t fsg_show_nofua(struct fsg_lun *curlun, char *buf); curlun 211 drivers/usb/gadget/function/storage_common.h ssize_t fsg_show_file(struct fsg_lun *curlun, struct rw_semaphore *filesem, curlun 213 drivers/usb/gadget/function/storage_common.h ssize_t fsg_show_inquiry_string(struct fsg_lun *curlun, char *buf); curlun 214 drivers/usb/gadget/function/storage_common.h ssize_t fsg_show_cdrom(struct fsg_lun *curlun, char *buf); curlun 215 drivers/usb/gadget/function/storage_common.h ssize_t fsg_show_removable(struct fsg_lun *curlun, char *buf); curlun 216 drivers/usb/gadget/function/storage_common.h ssize_t fsg_store_ro(struct fsg_lun *curlun, struct rw_semaphore *filesem, curlun 218 drivers/usb/gadget/function/storage_common.h ssize_t fsg_store_nofua(struct fsg_lun *curlun, const char *buf, size_t count); curlun 219 drivers/usb/gadget/function/storage_common.h ssize_t fsg_store_file(struct fsg_lun *curlun, struct rw_semaphore *filesem, curlun 221 drivers/usb/gadget/function/storage_common.h ssize_t fsg_store_cdrom(struct fsg_lun *curlun, struct rw_semaphore *filesem, curlun 223 drivers/usb/gadget/function/storage_common.h ssize_t fsg_store_removable(struct fsg_lun *curlun, const char *buf, curlun 225 drivers/usb/gadget/function/storage_common.h ssize_t fsg_store_inquiry_string(struct fsg_lun *curlun, const char *buf,