I would greatly value comments on a suggestion made earlier by Yoshifuji
regarding sharing code between udp.c and udplite.c which I am pursuing. 

I reduced diffs between ipv4/udp{,lite}.c to the minimum possible and
performed a line-by-line comparison between udp.c and udplite.c.

Result: out of 45 functions which re-appear from udp.c in udplite.c,
        * 26 can be derived without human thinking at all (sed/perl)
        * 10 require trivial interaction (sockopt/header names)
        *  8 require genuine modifications (in control flow and algorithm)
        *  1 function is missing in udplite.c (no equivalent of udp_check())


Problem: The UDP code (and in particular the replicated functions) operate 
         on the following globally visible symbols:
    
         EXPORT_SYMBOL(udp_hash);        /* would be udplite_hash       */
         EXPORT_SYMBOL(udp_hash_lock);   /* would be udplite_hash_lock  */ 
         EXPORT_SYMBOL(udp_port_rover);  /* would be udplite_port_rover */
    
        This would lead to clashes if udp.c/udplite.c use the same names.

          
Suggestion: #include code from udp.c in a much-reduced udplite.c, after
        re-defining symbols, so that the top of udplite.c looks like e.g.

          #include <linux/udplite.h>
          #define   udp_hash        udplite_hash        
          #define   udp_port_rover  udplite_port_rover
          #include "udp.c"          /* include the source code */


Inputs: The benefits are a much deflated patch, code reuse, increased
        clarity (only the diffs are visible). This comes at the cost
        of introducing a few #ifdefs in udp.c (otherwise no changes).
        However, I am not sure whether such an approach would find 
        acceptance and therefore I am asking for input. As currently the
        porting to ipv6/udplite.c is under way, I would like to take any
        suggestions on board which can reduce dependencies and inflated
        code.
        
Many thanks in advance,
--Gerrit 


NB: Details of the code analysis can be found on 
 http://www.erg.abdn.ac.uk/users/gerrit/udp-lite/udplite-comparison.html
and the diff-minimized variant of ipv4/udplite.c is in the latest tarball,
 http://www.erg.abdn.ac.uk/users/gerrit/udp-lite/files/udplite_linux.tar.gz
(any future patches will have the linelengths cut to 80 chars).
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to