To override shmget(), it is necessary for the symbol to be
unversioned. However, all unversioned symbols are given local scope to avoid
internal functions being called accidently. This patch marks the internal-only
export functions clearly with the prefix __lh_ and then versions them to
be only of local scope. Two unused functions are simply deleted.

Signed-off-by: Mel Gorman <[EMAIL PROTECTED]>
---

 debug.c                 |    2 +-
 elflink.c               |    4 ++--
 hugetlbfs.h             |    4 +---
 hugeutils.c             |   12 +-----------
 init.c                  |    6 +++---
 libhugetlbfs_internal.h |    6 +++---
 morecore.c              |    6 +++---
 version.lds             |    2 +-
 8 files changed, 15 insertions(+), 27 deletions(-)

diff -rup -X /usr/src/patchset-0.6/bin//dontdiff 
libhugetlbfs-gitlatest-clean/debug.c 
libhugetlbfs-gitlatest-0010-private-export/debug.c
--- libhugetlbfs-gitlatest-clean/debug.c        2008-07-29 19:52:52.000000000 
+0100
+++ libhugetlbfs-gitlatest-0010-private-export/debug.c  2008-07-30 
09:10:01.000000000 +0100
@@ -58,7 +58,7 @@ static void __hugetlbfs_init_debug(void)
        initialized = 1;
 }
 
-void __hugetlbfs_setup_debug(void)
+void __lh_hugetlbfs_setup_debug(void)
 {
        __hugetlbfs_init_debug();
 }
diff -rup -X /usr/src/patchset-0.6/bin//dontdiff 
libhugetlbfs-gitlatest-clean/elflink.c 
libhugetlbfs-gitlatest-0010-private-export/elflink.c
--- libhugetlbfs-gitlatest-clean/elflink.c      2008-07-29 19:52:52.000000000 
+0100
+++ libhugetlbfs-gitlatest-0010-private-export/elflink.c        2008-07-30 
09:10:01.000000000 +0100
@@ -581,7 +581,7 @@ static unsigned long hugetlb_prev_slice_
 /*
  * Store a copy of the given program header 
  */
-int save_phdr(int table_idx, int phnum, const ElfW(Phdr) *phdr)
+static int save_phdr(int table_idx, int phnum, const ElfW(Phdr) *phdr)
 {
        int prot = 0;
 
@@ -1179,7 +1179,7 @@ static int parse_elf()
        return 0;
 }
 
-void __hugetlbfs_setup_elflink(void)
+void __lh_hugetlbfs_setup_elflink(void)
 {
        int i, ret;
 
diff -rup -X /usr/src/patchset-0.6/bin//dontdiff 
libhugetlbfs-gitlatest-clean/hugetlbfs.h 
libhugetlbfs-gitlatest-0010-private-export/hugetlbfs.h
--- libhugetlbfs-gitlatest-clean/hugetlbfs.h    2008-07-29 19:52:52.000000000 
+0100
+++ libhugetlbfs-gitlatest-0010-private-export/hugetlbfs.h      2008-07-30 
09:10:01.000000000 +0100
@@ -27,9 +27,7 @@ const char *hugetlbfs_find_path(void);
 int hugetlbfs_unlinked_fd(void);
 
 /* Diagnoses/debugging only functions */
-long hugetlbfs_num_free_pages(void);
-long hugetlbfs_num_pages(void);
-long dump_proc_pid_maps(void);
+long __lh_dump_proc_pid_maps(void);
 
 #define PF_LINUX_HUGETLB       0x100000
 
diff -rup -X /usr/src/patchset-0.6/bin//dontdiff 
libhugetlbfs-gitlatest-clean/hugeutils.c 
libhugetlbfs-gitlatest-0010-private-export/hugeutils.c
--- libhugetlbfs-gitlatest-clean/hugeutils.c    2008-07-29 19:52:52.000000000 
+0100
+++ libhugetlbfs-gitlatest-0010-private-export/hugeutils.c      2008-07-30 
09:10:01.000000000 +0100
@@ -264,18 +264,8 @@ int hugetlbfs_unlinked_fd(void)
 /* Library user visible DIAGNOSES/DEBUGGING ONLY functions          */
 /********************************************************************/
 
-long hugetlbfs_num_free_pages(void)
-{
-       return read_meminfo("HugePages_Free:");
-}
-
-long hugetlbfs_num_pages(void)
-{
-       return read_meminfo("HugePages_Total:");
-}
-
 #define MAPS_BUF_SZ 4096
-long dump_proc_pid_maps()
+long __lh_dump_proc_pid_maps()
 {
        FILE *f;
        char line[MAPS_BUF_SZ];
diff -rup -X /usr/src/patchset-0.6/bin//dontdiff 
libhugetlbfs-gitlatest-clean/init.c 
libhugetlbfs-gitlatest-0010-private-export/init.c
--- libhugetlbfs-gitlatest-clean/init.c 2008-07-29 19:52:52.000000000 +0100
+++ libhugetlbfs-gitlatest-0010-private-export/init.c   2008-07-30 
09:10:01.000000000 +0100
@@ -21,9 +21,9 @@
 
 static void __attribute__ ((constructor)) setup_libhugetlbfs(void)
 {
-       __hugetlbfs_setup_debug();
+       __lh_hugetlbfs_setup_debug();
 #ifndef NO_ELFLINK
-       __hugetlbfs_setup_elflink();
+       __lh_hugetlbfs_setup_elflink();
 #endif
-       __hugetlbfs_setup_morecore();
+       __lh_hugetlbfs_setup_morecore();
 }
diff -rup -X /usr/src/patchset-0.6/bin//dontdiff 
libhugetlbfs-gitlatest-clean/libhugetlbfs_internal.h 
libhugetlbfs-gitlatest-0010-private-export/libhugetlbfs_internal.h
--- libhugetlbfs-gitlatest-clean/libhugetlbfs_internal.h        2008-07-29 
19:52:52.000000000 +0100
+++ libhugetlbfs-gitlatest-0010-private-export/libhugetlbfs_internal.h  
2008-07-30 09:10:01.000000000 +0100
@@ -43,9 +43,9 @@
 extern int __hugetlbfs_verbose;
 extern int __hugetlbfs_debug;
 extern int __hugetlbfs_prefault;
-extern void __hugetlbfs_setup_elflink();
-extern void __hugetlbfs_setup_morecore();
-extern void __hugetlbfs_setup_debug();
+extern void __lh_hugetlbfs_setup_elflink();
+extern void __lh_hugetlbfs_setup_morecore();
+extern void __lh_hugetlbfs_setup_debug();
 extern char __hugetlbfs_hostname[];
 
 #ifndef REPORT
diff -rup -X /usr/src/patchset-0.6/bin//dontdiff 
libhugetlbfs-gitlatest-clean/morecore.c 
libhugetlbfs-gitlatest-0010-private-export/morecore.c
--- libhugetlbfs-gitlatest-clean/morecore.c     2008-07-29 19:52:52.000000000 
+0100
+++ libhugetlbfs-gitlatest-0010-private-export/morecore.c       2008-07-30 
09:10:01.000000000 +0100
@@ -114,7 +114,7 @@ static void *hugetlbfs_morecore(ptrdiff_
                                WARNING("Heap originates at %p instead of %p\n",
                                        p, heapbase);
                                if (__hugetlbfs_debug)
-                                       dump_proc_pid_maps();
+                                       __lh_dump_proc_pid_maps();
                        }
                        /* then setup the heap variables */
                        heapbase = heaptop = p;
@@ -124,7 +124,7 @@ static void *hugetlbfs_morecore(ptrdiff_
                        WARNING("New heap segment mapped at %p instead of %p\n",
                              p, heapbase + mapsize);
                        if (__hugetlbfs_debug)
-                               dump_proc_pid_maps();
+                               __lh_dump_proc_pid_maps();
                        return NULL;
                }
 
@@ -224,7 +224,7 @@ static void *hugetlbfs_morecore(ptrdiff_
        return p;
 }
 
-void __hugetlbfs_setup_morecore(void)
+void __lh_hugetlbfs_setup_morecore(void)
 {
        char *env, *ep;
        unsigned long heapaddr;
diff -rup -X /usr/src/patchset-0.6/bin//dontdiff 
libhugetlbfs-gitlatest-clean/version.lds 
libhugetlbfs-gitlatest-0010-private-export/version.lds
--- libhugetlbfs-gitlatest-clean/version.lds    2008-07-29 19:52:52.000000000 
+0100
+++ libhugetlbfs-gitlatest-0010-private-export/version.lds      2008-07-30 
09:10:01.000000000 +0100
@@ -5,7 +5,7 @@ VERS_1.0 {
                hugetlbfs_find_path;
                hugetlbfs_unlinked_fd;
        local:
-               *;
+               __lh_*;
 };
 
 HTLBFS_2.0 {

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Libhugetlbfs-devel mailing list
Libhugetlbfs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libhugetlbfs-devel

Reply via email to