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                 |    6 +++---
>  hugetlbfs.h              |   16 ----------------
>  hugeutils.c              |    6 +-----
>  init_privutils.c         |    2 ++
>  libhugetlbfs_internal.h  |   12 ++++++++++++
>  libhugetlbfs_privutils.h |   23 +++++++++++++++++++++++
>  6 files changed, 41 insertions(+), 24 deletions(-)
> 
> diff --git a/Makefile b/Makefile
> index 1bb4589..0b5821d 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 = init_privutils.o debug.o
> +LIBPUOBJS = hugeutils.o debug.o hugeutils.o
>  INSTALL_OBJ_LIBS = libhugetlbfs.so libhugetlbfs.a libhugetlbfs_privutils.so
>  BIN_OBJ_DIR=obj
>  INSTALL_BIN = hugectl hugeedit hugeadm pagesize
> @@ -285,13 +285,13 @@ $(BIN_OBJ_DIR)/hugeedit: $(BIN_OBJ_DIR)/hugeedit.o
>       mkdir -p $(BIN_OBJ_DIR)
>       $(CC) $(CPPFLAGS) $(CFLAGS) $(LIBPATHS) -o $@ $^
> 
> -HUGEADM_OBJ=hugeadm.o hugeutils.o debug.o
> +HUGEADM_OBJ=hugeadm.o libhugetlbfs_privutils.a
>  $(BIN_OBJ_DIR)/hugeadm: $(foreach file,$(HUGEADM_OBJ),$(BIN_OBJ_DIR)/$(file))
>       @$(VECHO) LDHOST $@
>       mkdir -p $(BIN_OBJ_DIR)
>       $(CC) $(CPPFLAGS) $(CFLAGS) $(LIBPATHS) -o $@ $^
> 
> -PAGESIZE_OBJ=pagesize.o hugeutils.o debug.o
> +PAGESIZE_OBJ=pagesize.o libhugetlbfs_privutils.a
>  $(BIN_OBJ_DIR)/pagesize: $(foreach 
> file,$(PAGESIZE_OBJ),$(BIN_OBJ_DIR)/$(file))
>       @$(VECHO) LDHOST $@
>       mkdir -p $(BIN_OBJ_DIR)
> diff --git a/hugetlbfs.h b/hugetlbfs.h
> index c2c88f1..3dff758 100644
> --- a/hugetlbfs.h
> +++ b/hugetlbfs.h
> @@ -62,20 +62,4 @@ enum {
>  };
>  int hugetlbfs_test_feature(int feature_code);
> 
> -/* Hugetlb pool counter operations */
> -/* Keys for reading hugetlb pool counters */
> -enum {                        /* The number of pages of a given size that 
> ... */
> -     HUGEPAGES_TOTAL, /*  are allocated to the pool */
> -     HUGEPAGES_FREE,  /*  are not in use */
> -     HUGEPAGES_RSVD,  /*  are reserved for possible future use */
> -     HUGEPAGES_SURP,  /*  are allocated to the pool on demand */
> -     HUGEPAGES_OC,    /*  can be allocated on demand - maximum */
> -     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);
>  #endif /* _HUGETLBFS_H */
> diff --git a/hugeutils.c b/hugeutils.c
> index b9e63ad..81a834a 100644
> --- a/hugeutils.c
> +++ b/hugeutils.c
> @@ -62,17 +62,13 @@ static int hpage_sizes_default_idx = -1;
>  #define BUF_SZ 256
>  #define MEMINFO_SIZE 2048
> 
> -#define MEMINFO "/proc/meminfo"
> -#define PROC_HUGEPAGES_DIR "/proc/sys/vm/"
> -#define SYSFS_HUGEPAGES_DIR "/sys/kernel/mm/hugepages/"
> -
>  /*
>   * Convert a quantity in a given unit to the next smallest unit by
>   * multiplying the quantity by 1024 (eg. convert 1MB to 1024kB).
>   * If the conversion would overflow the variable, return LONG_MAX to signify
>   * the error.
>   */
> -static inline long size_to_smaller_unit(long size)
> +long size_to_smaller_unit(long size)
>  {
>       if (size < 0 || size * 1024 < size)
>               return -1;
> diff --git a/init_privutils.c b/init_privutils.c
> index 6c9243d..f32d83b 100644
> --- a/init_privutils.c
> +++ b/init_privutils.c
> @@ -22,4 +22,6 @@
>  static void __attribute__ ((constructor)) setup_libhugetlbfs(void)
>  {
>       hugetlbfs_setup_debug();
> +     setup_mounts();
> +     setup_features();
>  }
> diff --git a/libhugetlbfs_internal.h b/libhugetlbfs_internal.h
> index 4e20885..da84234 100644
> --- a/libhugetlbfs_internal.h
> +++ b/libhugetlbfs_internal.h
> @@ -115,6 +115,14 @@ struct hpage_pool {
>       int is_default;
>  };
> 
> +#define size_to_smaller_unit __lh_size_to_smaller_unit
> +extern long size_to_smaller_unit(long size);
> +
> +#define file_read_ulong __lh_file_read_ulong
> +extern long file_read_ulong(char *file, const char *tag);
> +#define file_write_ulong __lh_file_write_ulong
> +extern int file_write_ulong(char *file, unsigned long val);
> +
>  #define hpool_sizes __lh_hpool_sizes
>  extern int hpool_sizes(struct hpage_pool *, int);
>  #define get_pool_size __lh_get_pool_size
> @@ -124,4 +132,8 @@ extern int get_pool_size(long, struct hpage_pool *);
>  extern int direct_syscall(int sysnum, ...);
>  extern ElfW(Word) plt_extrasz(ElfW(Dyn) *dyntab);
> 
> +#define MEMINFO "/proc/meminfo"
> +#define PROC_HUGEPAGES_DIR "/proc/sys/vm/"
> +#define SYSFS_HUGEPAGES_DIR "/sys/kernel/mm/hugepages/"
> +
>  #endif /* _LIBHUGETLBFS_INTERNAL_H */
> diff --git a/libhugetlbfs_privutils.h b/libhugetlbfs_privutils.h
> index 1a45ed0..9f0c479 100644
> --- a/libhugetlbfs_privutils.h
> +++ b/libhugetlbfs_privutils.h
> @@ -19,4 +19,27 @@
>  #ifndef _LIBHUGETLBFS_PRIVUTILS_H
>  #define _LIBHUGETLBFS_PRIVUTILS_H
> 
> +/* Hugetlb pool counter operations */
> +/* Keys for reading hugetlb pool counters */
> +enum {                        /* The number of pages of a given size that 
> ... */
> +     HUGEPAGES_TOTAL, /*  are allocated to the pool */
> +     HUGEPAGES_FREE,  /*  are not in use */
> +     HUGEPAGES_RSVD,  /*  are reserved for possible future use */
> +     HUGEPAGES_SURP,  /*  are allocated to the pool on demand */
> +     HUGEPAGES_OC,    /*  can be allocated on demand - maximum */
> +     HUGEPAGES_MAX_COUNTERS,
> +};
> +#define get_huge_page_counter __pu_get_huge_page_counter
> +long get_huge_page_counter(long pagesize, unsigned int counter);
> +#define set_huge_page_counter __pu_set_huge_page_counter
> +int set_huge_page_counter(long pagesize, unsigned int counter,
> +                                                     unsigned long val);
> +#define set_nr_hugepages __pu_set_nr_hugepages
> +int set_nr_hugepages(long pagesize, unsigned long val);
> +#define set_nr_overcommit_hugepages __pu_set_nr_overcommit_hugepages
> +int set_nr_overcommit_hugepages(long pagesize, unsigned long val);
> +
> +#define read_meminfo __pu_read_meminfo
> +long read_meminfo(const char *tag);
> +
>  #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

Reply via email to