[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

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);

I made a small change in grab_sg() in order to distinguish
a failed locking attempt from failure to get to that attempt.

#include <scsi/scsi.h>

int grab_sg (int blkfd)

            if (sgfd>=0)
            else if (errno == EBUSY)
                sgfd = -2;


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[7]) ) ||
               ( strncmp (ioctl_device, "/dev/scd", 8) == 0
                        && isdigit(ioctl_device[8]) )
           ) )
                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));

I will now use this variation of growisofs 7.0 for my daily
backups. It will last a few days until i get opportunity
to test it on kernel 2.6 and /dev/hdX.
If my code is as intended then this should not even call
grab_sg(), and of course never abort.

Give me a note as soon as you decided for a final implementation
and i will test as good as i can.

Have a nice day :)


PS: About -Z /dev/sr1=imagefile :

    My ext3 is ok as source for image files.
    My reiserfs is not. ":-( write failed: Invalid argument".
    Mangling #ifdef O_DIRECT in growisofs.c enabled burning from
    that reiserfs too.
    Only good i watch other people's problems on this list. :))

Reply to: