[patch] Supporting SCSI in eject
Bernhard Fischer
rep.dot.nop at gmail.com
Fri Feb 8 14:24:20 UTC 2008
On Fri, Feb 08, 2008 at 03:03:56PM +0100, Nico Erfurth wrote:
>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
I don't know, but 325 bytes sounds a bit much for what it really does.
Can you try out if my suggestions help the size? (I'd say 200 bytes is
the upper limit for such functionality :)
More information about the busybox
mailing list