From damailings at mcbf.net Thu Apr 24 22:42:22 2008 From: damailings at mcbf.net (David Mohr) Date: Thu Apr 24 22:42:32 2008 Subject: [Libburn-cutters] Revival! And also question about burn_drive_scan with busy drives Message-ID: <472d4b250804242042x73bf77abwb8d4e079daff2cd4@mail.gmail.com> Hi, so I'm working on xfburn, and I have been talking a lot to Mario already. Thomas might remember me from some obscure bug reports ;-). When the drive is mounted, and xfburn is started, then I can't get access to the drive and burn_drive_scan returns 0 drives found. What I'm missing is a way to enumerate drives even when they are currently busy. I've looked through the API and I didn't see anything that would get me that at the moment. So I could get this list through i.e. HAL, but I'd rather keep my core code libburn only. Is there a way that I could get that functionality into libburn? The reason is that in a GUI program I can't just bail out because the drive is currently mounted. Rather the behavior that I want to get is to list the drive, and try to automatically unmount it. I know the unmounting is out of the scope of libburn, and I can deal with that separately, but it would make things much cleaner if I could go through libburn to maintain my main list of drives in the system. Thanks, ~David From scdbackup at gmx.net Fri Apr 25 03:09:32 2008 From: scdbackup at gmx.net (Thomas Schmitt) Date: Fri Apr 25 03:10:13 2008 Subject: [Libburn-cutters] Re: Revival! And also question about burn_drive_scan with busy drives In-Reply-To: <472d4b250804242042x73bf77abwb8d4e079daff2cd4@mail.gmail.com> References: <472d4b250804242042x73bf77abwb8d4e079daff2cd4@mail.gmail.com> Message-ID: <101847718410002@212.46.126.165> Hi, > When the drive is mounted, and xfburn is started, then I can't get > access to the drive and burn_drive_scan returns 0 drives found. What > I'm missing is a way to enumerate drives even when they are currently > busy. I've looked through the API and I didn't see anything that would > get me that at the moment. > ... > So I could get this list through i.e. HAL, but I'd rather keep my core > code libburn only. Is there a way that I could get that functionality > into libburn? That would be API call burn_preset_device_open(0, 0, 0); but be warned that this might be a bad idea. Normally libburn stays away from any drive that is opened with O_EXCL flag. Afaik, mount does this to indicate that it works on the drive. libburn itself uses open(O_EXCL) to coordinate with other instances of itself or with other burn programs which use O_EXCL too. The problem with accessing busy drives is that even the slightest glimpse might spoil an ongoing burn run. It's like quantum mechanics: you do not know before you disturbed a potentially delicate state. > The reason is that in a GUI program I can't just bail out because the > drive is currently mounted. Rather the behavior that I want to get is > to list the drive, and try to automatically unmount it. Seems ok for the mount case but not ok for the case of concurrently running burn programs. If you touch a burning drive then the burn might fail immediately. With the case of a mounted drive i would advise to set burn_preset_device_open(0, 0, 0) only for getting an overview, to afterwards give up all found drives by burn_drive_info_free() and to re-enable the exclusive locking by burn_preset_device_open(1, 0, 0); before doing a normal aquiration of drives. This gives you the best chances not to collide with other programs on a drive. It is still not overly user-safe, i must say. > So I could get this list through i.e. HAL, Do you have experience with HAL ? Do you know a way to tell HAL to stay away from a particular drive for a while ? For now, HAL is the biggest menace to libburn. On my SuSE 10.2 i have to shoot the processes hald-addon-storage which guard my drives. If i let them live, then they grope my drives which spoils my burns. I would like to send HAL a message when libburn grabs a drive and another message when the drive gets released. Inbetween it shall not touch my drive in what way ever. Any hint is welcome. Have a nice day :) Thomas