• Masahiro Yamada's avatar
    export: avoid code duplication in include/linux/export.h · c3a6cf19
    Masahiro Yamada authored
    include/linux/export.h has lots of code duplication between
    EXPORT_SYMBOL and EXPORT_SYMBOL_NS.
    
    To improve the maintainability and readability, unify the
    implementation.
    
    When the symbol has no namespace, pass the empty string "" to
    the 'ns' parameter.
    
    The drawback of this change is, it grows the code size.
    When the symbol has no namespace, sym->namespace was previously
    NULL, but it is now an empty string "". So, it increases 1 byte
    for every no namespace EXPORT_SYMBOL.
    
    A typical kernel configuration has 10K exported symbols, so it
    increases 10KB in rough estimation.
    
    I did not come up with a good idea to refactor it without increasing
    the code size.
    
    I am not sure how big a deal it is, but at least include/linux/export.h
    looks nicer.
    Reviewed-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
    [maennich: rebase on top of 3 fixes for the namespace feature]
    Signed-off-by: default avatarMatthias Maennich <maennich@google.com>
    Signed-off-by: default avatarJessica Yu <jeyu@kernel.org>
    c3a6cf19
export.h 4.9 KB