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]> --- Changes from V1: Rebase to libhuge 2.1 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 f8526d2..b83de12 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 fb283f2..bb86e7d 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 ------------------------------------------------------------------------------ SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada. The future of the web can't happen without you. Join us at MIX09 to help pave the way to the Next Web now. Learn more and register at http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/ _______________________________________________ Libhugetlbfs-devel mailing list Libhugetlbfs-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/libhugetlbfs-devel