osv at javad.ru
Fri Jan 12 15:58:18 UTC 2001
Jake Janovetz <janovetz at uiuc.edu> writes:
> Unfortunately, in many of my hooks, this leads to more complicated
> code and my code allocating the same buffer as before.
Then put common work that is currently implemented in FTPD in a function,
register your hooks with this function, and register the function itself as a
hook with FTPD ;-) 10-20 lines of C code, I believe.
Actually I don't insist on any approach because I don't use and don't plan to
use these hooks myself (I'd use RTEMS pseudo-device to do such work anyway),
but current solution seems so inflexible :-( There are a lot of algorithms
that require only sequential access to data. What if I need to feed large file
through such algorithm? Impossible with current approach, I think.
Anyway, advanced features such as hook support could be put under #ifdef for
those who don't use them and don't want to waste space for unused features.
> On Fri, Jan 12, 2001 at 11:07:50AM +0300, Sergei Organov wrote:
> > Jake,
> > I left hooks in place.
> > As for hooks implementation, I'd suggest to use fixed size buffer and call
> > hook 'write' routine multiple times while data are being received, the same
> > way it works when writing to a file. This is usual way to do such things and
> > doesn't depend on file size at all. Apparently open/close (or begin/end) hook
> > routines will be required in this case.
> > It does make hook routines more complex in some cases though, but then they
> > could decide themselves to allocate whatever buffer they need in 'open' hook,
> > fill it, then process it in 'close' hook.
> > Sergei.
More information about the users