Bernhard Fischer schrieb:

>>      dev = xopen(device, O_RDONLY|O_NONBLOCK);
> 
> device_open()

Taken from the original eject.c code, but I can change that, I.

>> +#if ENABLE_FEATURE_EJECT_SCSI
>> +  if (flags & FLAG_SCSI) 
>> +    eject_scsi(dev);
>> +  else
>> +#endif
>> +    eject_cdrom(dev, flags, device);
> 
> Is it smaller if you use a functor here?
>       void (*do_eject_fn)(const int fd, const unsigned long flags,
>                               const char *dev);
>       do_eject_fn = eject_cdrom;
>       if (ENABLE_FEATURE_EJECT_SCSI && flags & FLAG_SCSI)
>               do_eject_fn = eject_scsi;
>       /* Just Do It (tm) */
>       do_eject_fn(fd, flags, dev);
>>      if (ENABLE_FEATURE_CLEAN_UP)
>>              close(dev);

My gcc inlines both functions, so most probably the functor version
would be bigger.

> What's the size(1) with and without scsi support?

The size didn't change compared to the original version, when
SCSI-Support is disabled.

Output of bloatcheck with SCSI enabled is:
make bloatcheck
...

function                                             old     new   delta
eject_main                                           135     369    +234
.rodata                                              941    1014     +73
static.C                                               -      18     +18
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 2/0 up/down: 325/0)             Total: 325
bytes
   text    data     bss     dec     hex filename
   6679     365      60    7104    1bc0 busybox_old
   7010     369      60    7439    1d0f busybox_unstripped


Without scsi its exactly the same as the old version.

Nico
_______________________________________________
busybox mailing list
[email protected]
http://busybox.net/cgi-bin/mailman/listinfo/busybox

Reply via email to