On Fri, 2008-10-10 at 16:58 +0100, Andy Whitcroft wrote: > Sort the output of the pool configuration listing --pool-list, and now > that the default size will not be first mark it in a new Default column. > > [should this new column be Flags and us be putting 'D' in there for instance?]
My feel is that a separate Default column is appropriate now. If we decide to add other fields later we can add 'Flags' at that time and still keep the 'Default' column. > > Signed-off-by: Andy Whitcroft <[EMAIL PROTECTED]> Acked-by: Adam Litke <[EMAIL PROTECTED]> > --- > hugeadm.c | 15 ++++++++++++--- > hugeutils.c | 5 ++++- > libhugetlbfs_internal.h | 1 + > 3 files changed, 17 insertions(+), 4 deletions(-) > > diff --git a/hugeadm.c b/hugeadm.c > index 86dc97b..c6d6554 100644 > --- a/hugeadm.c > +++ b/hugeadm.c > @@ -61,6 +61,13 @@ int opt_dry_run = 0; > #define LONG_POOL_LIST (LONG_POOL|'l') > > #define MAX_POOLS 32 > + > +static int cmpsizes(const void *p1, const void *p2) > +{ > + return ((struct hpage_pool *)p1)->pagesize_kb > > + ((struct hpage_pool *)p2)->pagesize_kb; > +} > + > void pool_list(void) > { > struct hpage_pool pools[MAX_POOLS]; > @@ -72,12 +79,14 @@ void pool_list(void) > ERROR("unable to obtain pools list"); > exit(EXIT_FAILURE); > } > + qsort(pools, cnt, sizeof(pools[0]), cmpsizes); > > - printf("%10s %8s %8s %8s\n", "Size", "Minimum", "Current", "Maximum"); > + printf("%10s %8s %8s %8s %8s\n", > + "Size", "Minimum", "Current", "Maximum", "Default"); > for (pos = 0; cnt--; pos++) { > - printf("%10ld %8ld %8ld %8ld\n", pools[pos].pagesize_kb, > + printf("%10ld %8ld %8ld %8ld %8s\n", pools[pos].pagesize_kb, > pools[pos].minimum, pools[pos].size, > - pools[pos].maximum); > + pools[pos].maximum, (pools[pos].is_default) ? "*" : ""); > } > } > > diff --git a/hugeutils.c b/hugeutils.c > index 0d2dba9..b413352 100644 > --- a/hugeutils.c > +++ b/hugeutils.c > @@ -496,6 +496,7 @@ static int get_pool_size(long size, struct hpage_pool > *pool) > pool->minimum = nr_static; > pool->maximum = nr_static + nr_over; > pool->size = nr_used + nr_resv; > + pool->is_default = 0; > > return 1; > } > @@ -513,8 +514,10 @@ int __lh_hpool_sizes(struct hpage_pool *pools, int pcnt) > default_size = size_to_smaller_unit(file_read_ulong(MEMINFO, > "Hugepagesize:")); > if (default_size >= 0 && which < pcnt) > - if (get_pool_size(default_size, &pools[which])) > + if (get_pool_size(default_size, &pools[which])) { > + pools[which].is_default = 1; > which++; > + } > > dir = opendir(SYSFS_HUGEPAGES_DIR); > if (dir) { > diff --git a/libhugetlbfs_internal.h b/libhugetlbfs_internal.h > index 2912c5e..6f47ab7 100644 > --- a/libhugetlbfs_internal.h > +++ b/libhugetlbfs_internal.h > @@ -94,6 +94,7 @@ struct hpage_pool { > unsigned long minimum; > unsigned long maximum; > unsigned long size; > + int is_default; > }; > > extern int __lh_hpool_sizes(struct hpage_pool *, int); -- 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