• Home
  • Raw
  • Download

Lines Matching refs:curlun

289 	struct fsg_lun		*curlun;  member
638 struct fsg_lun *curlun = common->curlun; in do_read() local
662 curlun->sense_data = SS_INVALID_FIELD_IN_CDB; in do_read()
666 if (lba >= curlun->num_sectors) { in do_read()
667 curlun->sense_data = SS_LOGICAL_BLOCK_ADDRESS_OUT_OF_RANGE; in do_read()
670 file_offset = ((loff_t) lba) << curlun->blkbits; in do_read()
686 curlun->file_length - file_offset); in do_read()
699 curlun->sense_data = in do_read()
701 curlun->sense_data_info = in do_read()
702 file_offset >> curlun->blkbits; in do_read()
703 curlun->info_valid = 1; in do_read()
711 nread = kernel_read(curlun->filp, bh->buf, amount, in do_read()
713 VLDBG(curlun, "file read %u @ %llu -> %d\n", amount, in do_read()
719 LDBG(curlun, "error in file read: %d\n", (int)nread); in do_read()
722 LDBG(curlun, "partial file read: %d/%u\n", in do_read()
724 nread = round_down(nread, curlun->blksize); in do_read()
740 curlun->sense_data = SS_UNRECOVERED_READ_ERROR; in do_read()
741 curlun->sense_data_info = in do_read()
742 file_offset >> curlun->blkbits; in do_read()
743 curlun->info_valid = 1; in do_read()
766 struct fsg_lun *curlun = common->curlun; in do_write() local
776 if (curlun->ro) { in do_write()
777 curlun->sense_data = SS_WRITE_PROTECTED; in do_write()
780 spin_lock(&curlun->filp->f_lock); in do_write()
781 curlun->filp->f_flags &= ~O_SYNC; /* Default is not to wait */ in do_write()
782 spin_unlock(&curlun->filp->f_lock); in do_write()
800 curlun->sense_data = SS_INVALID_FIELD_IN_CDB; in do_write()
803 if (!curlun->nofua && (common->cmnd[1] & 0x08)) { /* FUA */ in do_write()
804 spin_lock(&curlun->filp->f_lock); in do_write()
805 curlun->filp->f_flags |= O_SYNC; in do_write()
806 spin_unlock(&curlun->filp->f_lock); in do_write()
809 if (lba >= curlun->num_sectors) { in do_write()
810 curlun->sense_data = SS_LOGICAL_BLOCK_ADDRESS_OUT_OF_RANGE; in do_write()
816 file_offset = usb_offset = ((loff_t) lba) << curlun->blkbits; in do_write()
834 if (usb_offset >= curlun->file_length) { in do_write()
836 curlun->sense_data = in do_write()
838 curlun->sense_data_info = in do_write()
839 usb_offset >> curlun->blkbits; in do_write()
840 curlun->info_valid = 1; in do_write()
879 curlun->sense_data = SS_COMMUNICATION_FAILURE; in do_write()
880 curlun->sense_data_info = in do_write()
881 file_offset >> curlun->blkbits; in do_write()
882 curlun->info_valid = 1; in do_write()
887 if (curlun->file_length - file_offset < amount) { in do_write()
888 LERROR(curlun, "write %u @ %llu beyond end %llu\n", in do_write()
890 (unsigned long long)curlun->file_length); in do_write()
891 amount = curlun->file_length - file_offset; in do_write()
901 amount = round_down(amount, curlun->blksize); in do_write()
907 nwritten = kernel_write(curlun->filp, bh->buf, amount, in do_write()
909 VLDBG(curlun, "file write %u @ %llu -> %d\n", amount, in do_write()
915 LDBG(curlun, "error in file write: %d\n", in do_write()
919 LDBG(curlun, "partial file write: %d/%u\n", in do_write()
921 nwritten = round_down(nwritten, curlun->blksize); in do_write()
929 curlun->sense_data = SS_WRITE_ERROR; in do_write()
930 curlun->sense_data_info = in do_write()
931 file_offset >> curlun->blkbits; in do_write()
932 curlun->info_valid = 1; in do_write()
952 struct fsg_lun *curlun = common->curlun; in do_synchronize_cache() local
957 rc = fsg_lun_fsync_sub(curlun); in do_synchronize_cache()
959 curlun->sense_data = SS_WRITE_ERROR; in do_synchronize_cache()
966 static void invalidate_sub(struct fsg_lun *curlun) in invalidate_sub() argument
968 struct file *filp = curlun->filp; in invalidate_sub()
973 VLDBG(curlun, "invalidate_mapping_pages -> %ld\n", rc); in invalidate_sub()
978 struct fsg_lun *curlun = common->curlun; in do_verify() local
992 if (lba >= curlun->num_sectors) { in do_verify()
993 curlun->sense_data = SS_LOGICAL_BLOCK_ADDRESS_OUT_OF_RANGE; in do_verify()
1002 curlun->sense_data = SS_INVALID_FIELD_IN_CDB; in do_verify()
1011 amount_left = verification_length << curlun->blkbits; in do_verify()
1012 file_offset = ((loff_t) lba) << curlun->blkbits; in do_verify()
1015 fsg_lun_fsync_sub(curlun); in do_verify()
1019 invalidate_sub(curlun); in do_verify()
1033 curlun->file_length - file_offset); in do_verify()
1035 curlun->sense_data = in do_verify()
1037 curlun->sense_data_info = in do_verify()
1038 file_offset >> curlun->blkbits; in do_verify()
1039 curlun->info_valid = 1; in do_verify()
1045 nread = kernel_read(curlun->filp, bh->buf, amount, in do_verify()
1047 VLDBG(curlun, "file read %u @ %llu -> %d\n", amount, in do_verify()
1054 LDBG(curlun, "error in file verify: %d\n", (int)nread); in do_verify()
1057 LDBG(curlun, "partial file verify: %d/%u\n", in do_verify()
1059 nread = round_down(nread, curlun->blksize); in do_verify()
1062 curlun->sense_data = SS_UNRECOVERED_READ_ERROR; in do_verify()
1063 curlun->sense_data_info = in do_verify()
1064 file_offset >> curlun->blkbits; in do_verify()
1065 curlun->info_valid = 1; in do_verify()
1079 struct fsg_lun *curlun = common->curlun; in do_inquiry() local
1082 if (!curlun) { /* Unsupported LUNs are okay */ in do_inquiry()
1090 buf[0] = curlun->cdrom ? TYPE_ROM : TYPE_DISK; in do_inquiry()
1091 buf[1] = curlun->removable ? 0x80 : 0; in do_inquiry()
1098 if (curlun->inquiry_string[0]) in do_inquiry()
1099 memcpy(buf + 8, curlun->inquiry_string, in do_inquiry()
1100 sizeof(curlun->inquiry_string)); in do_inquiry()
1109 struct fsg_lun *curlun = common->curlun; in do_request_sense() local
1130 if (curlun && curlun->unit_attention_data != SS_NO_SENSE) { in do_request_sense()
1131 curlun->sense_data = curlun->unit_attention_data; in do_request_sense()
1132 curlun->unit_attention_data = SS_NO_SENSE; in do_request_sense()
1136 if (!curlun) { /* Unsupported LUNs are okay */ in do_request_sense()
1142 sd = curlun->sense_data; in do_request_sense()
1143 sdinfo = curlun->sense_data_info; in do_request_sense()
1144 valid = curlun->info_valid << 7; in do_request_sense()
1145 curlun->sense_data = SS_NO_SENSE; in do_request_sense()
1146 curlun->sense_data_info = 0; in do_request_sense()
1147 curlun->info_valid = 0; in do_request_sense()
1162 struct fsg_lun *curlun = common->curlun; in do_read_capacity() local
1169 curlun->sense_data = SS_INVALID_FIELD_IN_CDB; in do_read_capacity()
1173 put_unaligned_be32(curlun->num_sectors - 1, &buf[0]); in do_read_capacity()
1175 put_unaligned_be32(curlun->blksize, &buf[4]);/* Block length */ in do_read_capacity()
1181 struct fsg_lun *curlun = common->curlun; in do_read_header() local
1187 curlun->sense_data = SS_INVALID_FIELD_IN_CDB; in do_read_header()
1190 if (lba >= curlun->num_sectors) { in do_read_header()
1191 curlun->sense_data = SS_LOGICAL_BLOCK_ADDRESS_OUT_OF_RANGE; in do_read_header()
1203 struct fsg_lun *curlun = common->curlun; in do_read_toc() local
1214 curlun->sense_data = SS_INVALID_FIELD_IN_CDB; in do_read_toc()
1240 store_cdrom_address(&buf[16], msf, curlun->num_sectors); in do_read_toc()
1265 store_cdrom_address(&buf[7], msf, curlun->num_sectors); in do_read_toc()
1270 curlun->sense_data = SS_INVALID_FIELD_IN_CDB; in do_read_toc()
1277 struct fsg_lun *curlun = common->curlun; in do_mode_sense() local
1287 curlun->sense_data = SS_INVALID_FIELD_IN_CDB; in do_mode_sense()
1293 curlun->sense_data = SS_SAVING_PARAMETERS_NOT_SUPPORTED; in do_mode_sense()
1307 buf[2] = (curlun->ro ? 0x80 : 0x00); /* WP, DPOFUA */ in do_mode_sense()
1311 buf[3] = (curlun->ro ? 0x80 : 0x00); /* WP, DPOFUA */ in do_mode_sense()
1349 curlun->sense_data = SS_INVALID_FIELD_IN_CDB; in do_mode_sense()
1363 struct fsg_lun *curlun = common->curlun; in do_start_stop() local
1366 if (!curlun) { in do_start_stop()
1368 } else if (!curlun->removable) { in do_start_stop()
1369 curlun->sense_data = SS_INVALID_COMMAND; in do_start_stop()
1373 curlun->sense_data = SS_INVALID_FIELD_IN_CDB; in do_start_stop()
1385 if (!fsg_lun_is_open(curlun)) { in do_start_stop()
1386 curlun->sense_data = SS_MEDIUM_NOT_PRESENT; in do_start_stop()
1393 if (curlun->prevent_medium_removal) { in do_start_stop()
1394 LDBG(curlun, "unload attempt prevented\n"); in do_start_stop()
1395 curlun->sense_data = SS_MEDIUM_REMOVAL_PREVENTED; in do_start_stop()
1404 fsg_lun_close(curlun); in do_start_stop()
1413 struct fsg_lun *curlun = common->curlun; in do_prevent_allow() local
1416 if (!common->curlun) { in do_prevent_allow()
1418 } else if (!common->curlun->removable) { in do_prevent_allow()
1419 common->curlun->sense_data = SS_INVALID_COMMAND; in do_prevent_allow()
1425 curlun->sense_data = SS_INVALID_FIELD_IN_CDB; in do_prevent_allow()
1429 if (curlun->prevent_medium_removal && !prevent) in do_prevent_allow()
1430 fsg_lun_fsync_sub(curlun); in do_prevent_allow()
1431 curlun->prevent_medium_removal = prevent; in do_prevent_allow()
1438 struct fsg_lun *curlun = common->curlun; in do_read_format_capacities() local
1445 put_unaligned_be32(curlun->num_sectors, &buf[0]); in do_read_format_capacities()
1447 put_unaligned_be32(curlun->blksize, &buf[4]);/* Block length */ in do_read_format_capacities()
1454 struct fsg_lun *curlun = common->curlun; in do_mode_select() local
1457 if (curlun) in do_mode_select()
1458 curlun->sense_data = SS_INVALID_COMMAND; in do_mode_select()
1663 struct fsg_lun *curlun = common->curlun; in send_status() local
1676 if (curlun) { in send_status()
1677 sd = curlun->sense_data; in send_status()
1678 sdinfo = curlun->sense_data_info; in send_status()
1729 struct fsg_lun *curlun; in check_command() local
1796 curlun = common->curlun; in check_command()
1797 if (curlun) { in check_command()
1799 curlun->sense_data = SS_NO_SENSE; in check_command()
1800 curlun->sense_data_info = 0; in check_command()
1801 curlun->info_valid = 0; in check_command()
1821 if (curlun && curlun->unit_attention_data != SS_NO_SENSE && in check_command()
1824 curlun->sense_data = curlun->unit_attention_data; in check_command()
1825 curlun->unit_attention_data = SS_NO_SENSE; in check_command()
1833 if (curlun) in check_command()
1834 curlun->sense_data = SS_INVALID_FIELD_IN_CDB; in check_command()
1841 if (curlun && !fsg_lun_is_open(curlun) && needs_medium) { in check_command()
1842 curlun->sense_data = SS_MEDIUM_NOT_PRESENT; in check_command()
1854 if (common->curlun) in check_command_size_in_blocks()
1855 common->data_size_from_cmnd <<= common->curlun->blkbits; in check_command_size_in_blocks()
1982 if (!common->curlun || !common->curlun->cdrom) in do_scsi_command()
1994 if (!common->curlun || !common->curlun->cdrom) in do_scsi_command()
2113 common->curlun->sense_data = SS_INVALID_COMMAND; in do_scsi_command()
2204 common->curlun = common->luns[common->lun]; in received_cbw()
2206 common->curlun = NULL; in received_cbw()
2388 struct fsg_lun *curlun; in handle_exception() local
2450 curlun = common->luns[i]; in handle_exception()
2451 if (!curlun) in handle_exception()
2453 curlun->prevent_medium_removal = 0; in handle_exception()
2454 curlun->sense_data = SS_NO_SENSE; in handle_exception()
2455 curlun->unit_attention_data = SS_NO_SENSE; in handle_exception()
2456 curlun->sense_data_info = 0; in handle_exception()
2457 curlun->info_valid = 0; in handle_exception()
2564 struct fsg_lun *curlun = common->luns[i]; in fsg_main_thread() local
2566 if (curlun && fsg_lun_is_open(curlun)) in fsg_main_thread()
2567 fsg_lun_close(curlun); in fsg_main_thread()
2580 struct fsg_lun *curlun = fsg_lun_from_dev(dev); in ro_show() local
2582 return fsg_show_ro(curlun, buf); in ro_show()
2588 struct fsg_lun *curlun = fsg_lun_from_dev(dev); in nofua_show() local
2590 return fsg_show_nofua(curlun, buf); in nofua_show()
2596 struct fsg_lun *curlun = fsg_lun_from_dev(dev); in file_show() local
2599 return fsg_show_file(curlun, filesem, buf); in file_show()
2605 struct fsg_lun *curlun = fsg_lun_from_dev(dev); in ro_store() local
2608 return fsg_store_ro(curlun, filesem, buf, count); in ro_store()
2614 struct fsg_lun *curlun = fsg_lun_from_dev(dev); in nofua_store() local
2616 return fsg_store_nofua(curlun, buf, count); in nofua_store()
2622 struct fsg_lun *curlun = fsg_lun_from_dev(dev); in file_store() local
2625 return fsg_store_file(curlun, filesem, buf, count); in file_store()