[BusyBox] [PATCH] eject

Peter Willis psyphreak at phreaker.net
Wed May 11 21:44:48 UTC 2005


Mike Frysinger writes: 

> On Wednesday 11 May 2005 10:47 am, Rob Landley wrote:
>> On Wednesday 11 May 2005 11:49 am, Joshua Malone wrote:
>> > >>./busybox eject /dev/sr0
>> > >>eject: failed: Input/output error
>> > >
>> > > Not a good error message, though.
>> > >
>> > > How much size does calling the built-in umount applet add?  (No need to
>> > > duplicate anything, just a call to umount_main() as a regular function,
>> > > with appropriate arguments)...
>> >
>> > It seems to me that eject should fail if the media is still mounted
>> > rather than attempt to unmount it "behind your back".  Akin to pressing
>> > the eject putton and nothing happening.  Just my $0.02.

A few points: 

1. If we were really concerned about things going on 'behind our back' we'd 
probably need to check if it was mounted first and exit before any ioctl's 
were sent, otherwise who knows if an unscrupulous driver would eject the 
media before it was unmounted? 

2. The 'eject' command is typically used when A. you're too lazy to unmount 
and physically eject something yourself, B. when something needs to be 
ejected or changed in a specific or automated way (like a CD multi-loader), 
or C. when an application or installer is done using the disk. To say that 
in each of these cases the person or application using eject either didn't 
know they were using eject or didn't want it run right away is maybe a bit 
too much on the safe side... Besides, if something was using a file on the 
disk or chdir'ed into a mounted directory the filesystem wouldn't unmount 
and the disk wouldn't be ejected. 

If anything, unmounting first is a safety feature :-) However you could 
easily wrap around this with compile-time or run-time code to prevent the 
umount. 

>>
>> Except that's not how the standard eject command works.
> 
> yep, the eject man page says as much too
> -mike
> _______________________________________________
> busybox mailing list
> busybox at mail.busybox.net
> http://busybox.net/mailman/listinfo/busybox
 




More information about the busybox mailing list