I am trying to debug an issue where the standard linux CDROMEJECT returns an error even though the disk ejected.
Standard eject command used.
ioctl(FP,CDROMEJECT)
When I look at the cdrom.c I can see the eject function and the errors (e.g: http://lxr.free-electrons.com/source/drivers/cdrom/cdrom.c#L2303). I am fine with where error codes are returned but you also have lines like this:
cdi->ops->lock_door(cdi, 0)
Now lock_door
is a function pointer (see header file here). My issue is I cannot for the life-of-me figure out which function the lock_door
pointer points to! I would expect this to point to a function that then sends a SCSI command to the CD/DVD drive.
I suspect I am missing some fundamental but really not sure what! Any idea where I find where the function pointers in struct cdrom_device_ops point to?
If you do an LXR "Freetext Search" for ".lock_door"
you can see
it being set for the scsi driver here
and if you click on sr_lock_door
you find it defined in sr_ioctl.c:
int sr_lock_door(struct cdrom_device_info *cdi, int lock) {
Scsi_CD *cd = cdi->handle;
return scsi_set_medium_removal(cd->device, lock ?
SCSI_REMOVAL_PREVENT : SCSI_REMOVAL_ALLOW);
}