Re: Request for cooperation with all burn backends
> > int grab_sg (int blkfd)
> Seems to work well for me and my two drives sr0 and sr1.
> I threw out two of my three functions and made
> try_to_lock_linux_sg() using grab_sg() instead.
> The call in builtin_dd() has changed a bit:
> if (i == 3 && fd >= 0)
> try_to_lock_linux_sg(ioctl_device, fd);
> void try_to_lock_linux_sg(char *ioctl_device, int ioctl_dev_fd)
> int fd_sg = -1;
> if ( ( ( strncmp (ioctl_device, "/dev/sr", 7) == 0
> && isdigit(ioctl_device) ) ||
> ( strncmp (ioctl_device, "/dev/scd", 8) == 0
> && isdigit(ioctl_device) )
> ) )
> fd_sg = grab_sg(ioctl_dev_fd);
> if(fd_sg == -2)
> fprintf (stderr,":-( unable to O_EXCL sg equivalent of %s: "
> "Other burn program active on drive ?\n",
> exit (FATAL_START(errno));
Forget about this "method". It is known not to work reliably on Linux
and similar moethods will not work at all on other OS.
The problem on Linux is device aliasing that results in many independent
BTW: any attempt to completely lock the device would prevent correct usability
even if there war no device aliasing.
Cooperative locking is needed in a way that allows and is based not on device
nodes but on real hardware targets.
EMail:firstname.lastname@example.org (home) Jörg Schilling D-13353 Berlin
email@example.com (work) Blog: http://schily.blogspot.com/
URL: http://cdrecord.berlios.de/old/private/ ftp://ftp.berlios.de/pub/schily