Rename and export the pool counter update interface. Signed-off-by: Andy Whitcroft <[EMAIL PROTECTED]> --- hugetlbfs.h | 2 ++ hugeutils.c | 28 ++++++++++++++-------------- 2 files changed, 16 insertions(+), 14 deletions(-)
diff --git a/hugetlbfs.h b/hugetlbfs.h index 2103515..fbff43b 100644 --- a/hugetlbfs.h +++ b/hugetlbfs.h @@ -70,6 +70,8 @@ enum { /* The number of pages of a given size that ... */ HUGEPAGES_MAX_COUNTERS, }; long get_huge_page_counter(long pagesize, unsigned int counter); +int set_huge_page_counter(long pagesize, unsigned int counter, + unsigned long val); int set_nr_hugepages(long pagesize, unsigned long val); int set_nr_overcommit_hugepages(long pagesize, unsigned long val); long read_meminfo(const char *tag); diff --git a/hugeutils.c b/hugeutils.c index e5032da..21f788d 100644 --- a/hugeutils.c +++ b/hugeutils.c @@ -190,7 +190,7 @@ long file_read_ulong(char *file, const char *tag) p = buf; val = strtol(p, &q, 0); - if (! isspace(*q)) { + if (*q && ! isspace(*q)) { ERROR("Couldn't parse %s value\n", file); return -1; } @@ -257,17 +257,6 @@ int select_pool_counter(unsigned int counter, unsigned long pagesize, return 0; } -int set_pool_counter(unsigned long pagesize, unsigned int counter, - unsigned long val) -{ - char file[PATH_MAX+1]; - - if (select_pool_counter(counter, pagesize, file, NULL)) - return -1; - - return file_write_ulong(file, val); -} - static int hpage_size_to_index(unsigned long size) { int i; @@ -711,14 +700,25 @@ long get_huge_page_counter(long pagesize, unsigned int counter) return file_read_ulong(file, key); } +int set_huge_page_counter(long pagesize, unsigned int counter, + unsigned long val) +{ + char file[PATH_MAX+1]; + + if (select_pool_counter(counter, pagesize, file, NULL)) + return -1; + + return file_write_ulong(file, val); +} + int set_nr_hugepages(long pagesize, unsigned long val) { - return set_pool_counter(pagesize, HUGEPAGES_TOTAL, val); + return set_huge_page_counter(pagesize, HUGEPAGES_TOTAL, val); } int set_nr_overcommit_hugepages(long pagesize, unsigned long val) { - return set_pool_counter(pagesize, HUGEPAGES_OC, val); + return set_huge_page_counter(pagesize, HUGEPAGES_OC, val); } /********************************************************************/ -- 1.6.0.1.451.gc8d31 ------------------------------------------------------------------------- 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