Dne 27.7.2017 v 10:58 Yuriy M. Kaminskiy napsal(a): >> case ENOMEDIUM: >> + cdrom = open(mnt_context_get_source(cxt), O_RDONLY | O_NONBLOCK); >> + if (cdrom != -1) { >> + if (retries < CRDOM_TRAYOPEN_RETRIES && >> + (ioctl(cdrom, CDROM_GET_CAPABILITY, NULL) & CDC_CLOSE_TRAY) && > > If ioctl is not supported, and ioctl() returns -1, (ioctl() & FOO) is > true. Yes, ugly code, but even if -1 passes the check, CDROM_DRIVE_STATUS will not return CDS_TRAY_OPEN. > I guess this should be something like > + (rc = ioctl(cdrom, CDROM_GET_CAPABILITY, NULL)) != -1 && > + (rc & CDC_CLOSE_TRAY) && > instead. That would be cleaner but more complicated. > (And, I used cdrom a long time ago, but IIRC there were some driver > settings to automatically close tray on device open, so that this patch > should not be needed?) Thanks for this hint. Yes, you are true: /proc/sys/dev/cdrom/autoclose /proc/sys/dev/cdrom/autoeject But this does not work with the current mount. The mount request will expire on timeout earlier than the tray of ordinary CDROM closes. But yes, it is possible to implement a different, simpler patch that will make the autoclose feature working, and not cause delays in case of no medium. -- Best Regards / S pozdravem, Stanislav Brabec software developer --------------------------------------------------------------------- SUSE LINUX, s. r. o. e-mail: sbrabec@xxxxxxxx Křižíkova 148/34 (Corso IIa) tel: +49 911 7405384547 186 00 Praha 8-Karlín fax: +420 284 084 001 Czech Republic http://www.suse.cz/ PGP: 830B 40D5 9E05 35D8 5E27 6FA3 717C 209F A04F CD76 -- To unsubscribe from this list: send the line "unsubscribe util-linux" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html