hugetlb_setup_env will be called first during init. All environment variable parsing should happen in this function with values being saved for lateer use.
Signed-off-by: Eric B Munson <[EMAIL PROTECTED]> --- hugeutils.c | 11 +++++++++++ init.c | 1 + libhugetlbfs_internal.h | 7 +++++++ 3 files changed, 19 insertions(+), 0 deletions(-) diff --git a/hugeutils.c b/hugeutils.c index 1121966..d7b4b07 100644 --- a/hugeutils.c +++ b/hugeutils.c @@ -48,6 +48,8 @@ #include "libhugetlbfs_internal.h" #include "hugetlbfs.h" +struct libhugeopts_t __hugetlb_opts; + static int hugepagesize_errno; /* = 0 */ #define MAX_HPAGE_SIZES 10 @@ -228,6 +230,15 @@ int file_write_ulong(char *file, unsigned long val) } /* + * Reads the contents of hugetlb environment variables and save their + * values for later use. + */ +void hugetlbfs_setup_env() +{ + +} + +/* * Pool counters are typically exposed in sysfs in modern kernels, the * counters for the default page size are exposed in procfs in all kernels * supporting hugepages. Given a specific counter (e.g. HUGEPAGES_RSVD) diff --git a/init.c b/init.c index f9cd804..794e03c 100644 --- a/init.c +++ b/init.c @@ -21,6 +21,7 @@ static void __attribute__ ((constructor)) setup_libhugetlbfs(void) { + hugetlbfs_setup_env(); hugetlbfs_setup_debug(); setup_mounts(); setup_features(); diff --git a/libhugetlbfs_internal.h b/libhugetlbfs_internal.h index 6ebe9c0..c6774da 100644 --- a/libhugetlbfs_internal.h +++ b/libhugetlbfs_internal.h @@ -55,6 +55,9 @@ #define SLICE_HIGH_SHIFT 63 #endif +struct libhugeopts_t { +}; + /* * When adding a library local variable externalise the symbol as * normal, plus add a #define of the form below. This define effectively @@ -70,6 +73,8 @@ extern int __hugetlbfs_verbose; extern int __hugetlbfs_debug; #define __hugetlbfs_prefault __lh___hugetlbfs_prefault extern int __hugetlbfs_prefault; +#define hugetlbfs_setup_env __lh_hugetlbfs_setup_env +extern void hugetlbfs_setup_env(); #define hugetlbfs_setup_elflink __lh_hugetlbfs_setup_elflink extern void hugetlbfs_setup_elflink(); #define hugetlbfs_setup_morecore __lh_hugetlbfs_setup_morecore @@ -86,6 +91,8 @@ extern char __hugetlbfs_hostname[]; extern int hugetlbfs_prefault(int fd, void *addr, size_t length); #define parse_page_size __lh_parse_page_size extern long parse_page_size(const char *str); +#define __hugetlb_opts __lh__hugetlb_opts +extern struct libhugeopts_t __hugetlb_opts; #ifndef REPORT_UTIL #define REPORT_UTIL "libhugetlbfs" -- 1.6.0.3 ------------------------------------------------------------------------- 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