[PATCH] eject -T support

Denis Vlasenko vda.linux at googlemail.com
Sun Oct 8 08:36:33 PDT 2006


On Sunday 08 October 2006 11:18, Tito wrote:
> On Saturday 7 October 2006 23:14, Denis Vlasenko wrote:
> > On Saturday 07 October 2006 19:27, Rob Landley wrote:
> > > On Friday 06 October 2006 12:09 pm, Tito wrote:
> > > > 1)  something mounted OVER our cdrom:
> > > > 
> > > > /dev/hdd   on /media/cdrom1 type iso9660 (ro,noexec,nosuid,nodev)
> > > > /dev/hdb1 on /media/cdrom1 type reiserfs (rw)
> > > > 
> > > > ./busybox eject
> > > > eject: /dev/cdrom: Input/output error
> > > > 
> > > > /dev/hdd   on /media/cdrom1 type iso9660 (ro,noexec,nosuid,nodev)
> > > > 
> > > > the overmounted block device is unmounted and eject fails.
> > > 
> > > Doctor, it hurts when I poke myself in the eye with a fork!
> > > 
> > > Pilot error.
> > > 
> > > > 2)  cdrom is mounted many times:
> > > > 
> > > > /dev/hdd on /media/cdrom1 type iso9660 (ro)
> > > > /dev/hdd on /media/cdrom0 type iso9660 (ro)
> > > 
> > > Pilot error.
> > 
> > Yes, but we'd better fail instead of unmounting _something else_!
> > That's my proposal: just (try to) eject the thing, don't
> > try to do umount job.
> > --
> > vda
> 
> Hi Denis and Rob,
> This version of eject seems to get the job done!
> Bloat check is:
> function                                             old     new   delta
> eject_main                                           193     331    +138
> ------------------------------------------------------------------------------
> (add/remove: 0/0 grow/shrink: 1/0 up/down: 138/0)             Total: 138 bytes
> 
> Maybe we can make this umount stuff a config option (CONFIG_EJECT_UMOUNT or add it to CONFIG_DESKTOP)!?
> 
> It is tested with:
> 1) unmounted devices
> 2) mounted devices
> 3) devices mounted multiple times
> 4) devices overmounted by other block devices.
> 
> Hints, improvements, critics are always welcome.
> Attached is the whole file as drop in replacement for testing
> and review purpose, if you prefer a diff just ask and I will send
> one.

const char **mount_points = xmalloc(sizeof(char **));

Shouldn't it be xmalloc(sizeof(char *)) ? And you forgot to xrealloc() it
as you add stuff to the array. Apart from this looks good.

Can you try attached one?

Can you remind me what does not work in shell script solution?
If umount fails, it needs fixing anyway, and shell script solution
will be smaller.
--
vda
-------------- next part --------------
A non-text attachment was scrubbed...
Name: eject-2.c
Type: text/x-csrc
Size: 2894 bytes
Desc: not available
Url : http://busybox.net/lists/busybox/attachments/20061008/40624a92/attachment-0001.c 


More information about the busybox mailing list