Lines Matching defs:curlun
296 #define fsg_lun_is_open(curlun) ((curlun)->filp != NULL)
575 static int fsg_lun_open(struct fsg_lun *curlun, const char *filename)
586 ro = curlun->initially_ro;
595 LINFO(curlun, "unable to open backing file: %s\n", filename);
608 LINFO(curlun, "invalid file type: %s\n", filename);
617 LINFO(curlun, "file not readable: %s\n", filename);
625 LINFO(curlun, "unable to find file size: %s\n", filename);
631 if (curlun->cdrom) {
636 LINFO(curlun, "file too big: %s\n", filename);
637 LINFO(curlun, "using only first %d blocks\n",
642 LINFO(curlun, "file too small: %s\n", filename);
648 curlun->ro = ro;
649 curlun->filp = filp;
650 curlun->file_length = size;
651 curlun->num_sectors = num_sectors;
652 LDBG(curlun, "open backing file: %s\n", filename);
661 static void fsg_lun_close(struct fsg_lun *curlun)
663 if (curlun->filp) {
664 LDBG(curlun, "close backing file\n");
665 fput(curlun->filp);
666 curlun->filp = NULL;
677 static int fsg_lun_fsync_sub(struct fsg_lun *curlun)
679 struct file *filp = curlun->filp;
681 if (curlun->ro || !filp)
711 struct fsg_lun *curlun = fsg_lun_from_dev(dev);
713 return sprintf(buf, "%d\n", fsg_lun_is_open(curlun)
714 ? curlun->ro
715 : curlun->initially_ro);
721 struct fsg_lun *curlun = fsg_lun_from_dev(dev);
723 return sprintf(buf, "%u\n", curlun->nofua);
729 struct fsg_lun *curlun = fsg_lun_from_dev(dev);
735 if (fsg_lun_is_open(curlun)) { /* Get the complete pathname */
736 p = d_path(&curlun->filp->f_path, buf, PAGE_SIZE - 1);
758 struct fsg_lun *curlun = fsg_lun_from_dev(dev);
770 if (fsg_lun_is_open(curlun)) {
771 LDBG(curlun, "read-only status change prevented\n");
774 curlun->ro = ro;
775 curlun->initially_ro = ro;
776 LDBG(curlun, "read-only status set to %d\n", curlun->ro);
786 struct fsg_lun *curlun = fsg_lun_from_dev(dev);
793 if (!nofua && curlun->nofua)
794 fsg_lun_fsync_sub(curlun);
796 curlun->nofua = nofua;
804 struct fsg_lun *curlun = fsg_lun_from_dev(dev);
808 if (curlun->prevent_medium_removal && fsg_lun_is_open(curlun)) {
809 LDBG(curlun, "eject attempt prevented\n");
819 if (fsg_lun_is_open(curlun)) {
820 fsg_lun_close(curlun);
821 curlun->unit_attention_data = SS_MEDIUM_NOT_PRESENT;
826 rc = fsg_lun_open(curlun, buf);
828 curlun->unit_attention_data =