• Eric W. Biederman's avatar
    sysctl: Add register_sysctl_paths function · 29e796fd
    Eric W. Biederman authored
    There are a number of modules that register a sysctl table
    somewhere deeply nested in the sysctl hierarchy, such as
    fs/nfs, fs/xfs, dev/cdrom, etc.
    
    They all specify several dummy ctl_tables for the path name.
    This patch implements register_sysctl_path that takes
    an additional path name, and makes up dummy sysctl nodes
    for each component.
    
    This patch was originally written by Olaf Kirch and
    brought to my attention and reworked some by Olaf Hering.
    I have changed a few additional things so the bugs are mine.
    
    After converting all of the easy callers Olaf Hering observed
    allyesconfig ARCH=i386, the patch reduces the final binary size by 9369 bytes.
    
    .text +897
    .data -7008
    
       text    data     bss     dec     hex filename
       26959310        4045899 4718592 35723801        2211a19 ../vmlinux-vanilla
       26960207        4038891 4718592 35717690        221023a ../O-allyesconfig/vmlinux
    
    So this change is both a space savings and a code simplification.
    
    CC: Olaf Kirch <okir@suse.de>
    CC: Olaf Hering <olaf@aepfle.de>
    Signed-off-by: default avatarEric W. Biederman <ebiederm@xmission.com>
    Cc: Serge Hallyn <serue@us.ibm.com>
    Cc: Daniel Lezcano <dlezcano@fr.ibm.com>
    Cc: Cedric Le Goater <clg@fr.ibm.com>
    Cc: Pavel Emelyanov <xemul@openvz.org>
    Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
    Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    29e796fd
sysctl.c 65.8 KB