This comment is not specific to this patch, but the thought came into my head while reading this patch:
I think developers (myself included) will sometimes get confused as to whether their new function should go into libhugetlbfs_internal.h, libhugetlbfs_privutils.h, hugetlbfs.h, or no header at all. Perhaps this could be helped with a comment at the top of each header file: hugetlbfs.h: /* * Only functions and data types that are part of the libhugetlbfs API * should be defined here. */ libhugetlbfs_internal.h /* * Only functions and data types that are meant to be used internally by * libhugetlbfs belong in this header. */ libhugetlbfs_privutils.h /* * This header defines functions and data that is internal to libhugetlbfs * but is also exported for use by the test cases and utility programs via * the libhugetlbfs_privutils library. */ It might also be nice to document in each .c file if it is a part of a library and which one. That will make it easier for someone to figure out in which file a new function is to be implemented. On Fri, 2008-10-17 at 17:14 +0100, Andy Whitcroft wrote: > Signed-off-by: Andy Whitcroft <[EMAIL PROTECTED]> Acked-by: Adam Litke <[EMAIL PROTECTED]> > --- > Makefile | 2 +- > hugetlbfs.h | 9 --------- > kernel-features.c | 1 + > libhugetlbfs_privutils.h | 10 ++++++++++ > 4 files changed, 12 insertions(+), 10 deletions(-) > > diff --git a/Makefile b/Makefile > index 0b5821d..3a8e37f 100644 > --- a/Makefile > +++ b/Makefile > @@ -2,7 +2,7 @@ PREFIX = /usr/local > EXEDIR = /bin > > LIBOBJS = hugeutils.o version.o init.o morecore.o debug.o alloc.o shm.o > kernel-features.o > -LIBPUOBJS = hugeutils.o debug.o hugeutils.o > +LIBPUOBJS = hugeutils.o debug.o hugeutils.o kernel-features.o > INSTALL_OBJ_LIBS = libhugetlbfs.so libhugetlbfs.a libhugetlbfs_privutils.so > BIN_OBJ_DIR=obj > INSTALL_BIN = hugectl hugeedit hugeadm pagesize > diff --git a/hugetlbfs.h b/hugetlbfs.h > index 3dff758..06c427f 100644 > --- a/hugetlbfs.h > +++ b/hugetlbfs.h > @@ -53,13 +53,4 @@ typedef unsigned long ghp_t; > void *get_huge_pages(size_t len, ghp_t flags); > void free_huge_pages(void *ptr); > > -/* Kernel feature testing */ > -/* This enum defines the bits in a feature bitmask */ > -enum { > - /* Reservations are created for private mappings */ > - HUGETLB_FEATURE_PRIVATE_RESV, > - HUGETLB_FEATURE_NR, > -}; > -int hugetlbfs_test_feature(int feature_code); > - > #endif /* _HUGETLBFS_H */ > diff --git a/kernel-features.c b/kernel-features.c > index 8f105b4..12ca644 100644 > --- a/kernel-features.c > +++ b/kernel-features.c > @@ -27,6 +27,7 @@ > #include <sys/utsname.h> > #include "kernel-features.h" > #include "hugetlbfs.h" > +#include "libhugetlbfs_privutils.h" > #include "libhugetlbfs_internal.h" > #include "libhugetlbfs_debug.h" > > diff --git a/libhugetlbfs_privutils.h b/libhugetlbfs_privutils.h > index 9f0c479..1f4aae3 100644 > --- a/libhugetlbfs_privutils.h > +++ b/libhugetlbfs_privutils.h > @@ -42,4 +42,14 @@ int set_nr_overcommit_hugepages(long pagesize, unsigned > long val); > #define read_meminfo __pu_read_meminfo > long read_meminfo(const char *tag); > > +/* Kernel feature testing */ > +/* This enum defines the bits in a feature bitmask */ > +enum { > + /* Reservations are created for private mappings */ > + HUGETLB_FEATURE_PRIVATE_RESV, > + HUGETLB_FEATURE_NR, > +}; > +#define hugetlbfs_test_feature __pu_hugetlbfs_test_feature > +int hugetlbfs_test_feature(int feature_code); > + > #endif /* _LIBHUGETLBFS_PRIVUTILS_H */ -- Adam Litke - (agl at us.ibm.com) IBM Linux Technology Center ------------------------------------------------------------------------- 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