* [PATCH] Cleanup page-type.c
@ 2012-05-02 14:41 Ulrich Drepper
2012-05-02 18:19 ` KOSAKI Motohiro
0 siblings, 1 reply; 4+ messages in thread
From: Ulrich Drepper @ 2012-05-02 14:41 UTC (permalink / raw)
To: akpm, dyoung, fengguang.wu, kosaki.motohiro, linux-kernel,
n-horiguchi
Compiling page-type.c with a recent compiler produces many warnings,
mostly related to signed/unsigned comparisons. This patch cleans up
most of them.
One remaining warning is about an unused parameter. The <compiler.h>
file doesn't define a __unused macro (or the like) yet. This can be
addressed later.
The line numbers for this patch correspond to the file changed to remove
the duplicate definitions of the KPF_* macros which is contained in
another patch. It should apply cleanly albeit with warnings even without
that patch applied first.
Signed-off-by: Ulrich Drepper <drepper@gmail.com>
page-types.c | 22 +++++++++++-----------
1 file changed, 11 insertions(+), 11 deletions(-)
diff -u b/tools/vm/page-types.c b/tools/vm/page-types.c
--- b/tools/vm/page-types.c
+++ b/tools/vm/page-types.c
@@ -300,7 +300,7 @@
{
static char buf[65];
int present;
- int i, j;
+ size_t i, j;
for (i = 0, j = 0; i < ARRAY_SIZE(page_flag_names); i++) {
present = (flags >> i) & 1;
@@ -318,7 +318,7 @@
static char *page_flag_longname(uint64_t flags)
{
static char buf[1024];
- int i, n;
+ size_t i, n;
for (i = 0, n = 0; i < ARRAY_SIZE(page_flag_names); i++) {
if (!page_flag_names[i])
@@ -376,7 +376,7 @@
static void show_summary(void)
{
- int i;
+ size_t i;
printf(" flags\tpage-count MB"
" symbolic-flags\t\t\tlong-symbolic-flags\n");
@@ -474,7 +474,7 @@
/* find the path to the mounted debugfs */
static const char *debugfs_find_mountpoint(void)
{
- const char **ptr;
+ const char *const *ptr;
char type[100];
FILE *fp;
@@ -511,7 +511,7 @@
static void debugfs_mount(void)
{
- const char **ptr;
+ const char *const *ptr;
/* see if it's already mounted */
if (debugfs_find_mountpoint())
@@ -588,10 +588,10 @@
* page frame walker
*/
-static int hash_slot(uint64_t flags)
+static size_t hash_slot(uint64_t flags)
{
- int k = HASH_KEY(flags);
- int i;
+ size_t k = HASH_KEY(flags);
+ size_t i;
/* Explicitly reserve slot 0 for flags 0: the following logic
* cannot distinguish an unoccupied slot from slot (flags==0).
@@ -644,7 +644,7 @@
{
uint64_t buf[KPAGEFLAGS_BATCH];
unsigned long batch;
- long pages;
+ unsigned long pages;
unsigned long i;
while (count) {
@@ -753,7 +753,7 @@
static void usage(void)
{
- int i, j;
+ size_t i, j;
printf(
"page-types [options]\n"
@@ -912,7 +912,7 @@
static uint64_t parse_flag_name(const char *str, int len)
{
- int i;
+ size_t i;
if (!*str || !len)
return 0;
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] Cleanup page-type.c
2012-05-02 14:41 [PATCH] Cleanup page-type.c Ulrich Drepper
@ 2012-05-02 18:19 ` KOSAKI Motohiro
2012-05-02 23:06 ` Fengguang Wu
0 siblings, 1 reply; 4+ messages in thread
From: KOSAKI Motohiro @ 2012-05-02 18:19 UTC (permalink / raw)
To: Ulrich Drepper
Cc: akpm, dyoung, fengguang.wu, kosaki.motohiro, linux-kernel,
n-horiguchi, kosaki.motohiro
(5/2/12 10:41 AM), Ulrich Drepper wrote:
> Compiling page-type.c with a recent compiler produces many warnings,
> mostly related to signed/unsigned comparisons. This patch cleans up
> most of them.
>
> One remaining warning is about an unused parameter. The<compiler.h>
> file doesn't define a __unused macro (or the like) yet. This can be
> addressed later.
>
> The line numbers for this patch correspond to the file changed to remove
> the duplicate definitions of the KPF_* macros which is contained in
> another patch. It should apply cleanly albeit with warnings even without
> that patch applied first.
>
>
> Signed-off-by: Ulrich Drepper<drepper@gmail.com>
>
> page-types.c | 22 +++++++++++-----------
> 1 file changed, 11 insertions(+), 11 deletions(-)
Looks good to me.
Acked-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
offtopic:
Wu, I have (unrelated) one question. page-type is used from production
systems nowadays. Why don't you want to move page-type.c into tools/ dir?
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] Cleanup page-type.c
2012-05-02 18:19 ` KOSAKI Motohiro
@ 2012-05-02 23:06 ` Fengguang Wu
2012-05-03 1:41 ` KOSAKI Motohiro
0 siblings, 1 reply; 4+ messages in thread
From: Fengguang Wu @ 2012-05-02 23:06 UTC (permalink / raw)
To: KOSAKI Motohiro
Cc: Ulrich Drepper, akpm, dyoung, kosaki.motohiro, linux-kernel,
n-horiguchi
On Wed, May 02, 2012 at 02:19:01PM -0400, KOSAKI Motohiro wrote:
> (5/2/12 10:41 AM), Ulrich Drepper wrote:
> > Compiling page-type.c with a recent compiler produces many warnings,
> > mostly related to signed/unsigned comparisons. This patch cleans up
> > most of them.
> >
> > One remaining warning is about an unused parameter. The<compiler.h>
> > file doesn't define a __unused macro (or the like) yet. This can be
> > addressed later.
> >
> > The line numbers for this patch correspond to the file changed to remove
> > the duplicate definitions of the KPF_* macros which is contained in
> > another patch. It should apply cleanly albeit with warnings even without
> > that patch applied first.
> >
> >
> > Signed-off-by: Ulrich Drepper<drepper@gmail.com>
> >
> > page-types.c | 22 +++++++++++-----------
> > 1 file changed, 11 insertions(+), 11 deletions(-)
>
> Looks good to me.
> Acked-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Acked-by: Fengguang Wu <fengguang.wu@intel.com>
> offtopic:
> Wu, I have (unrelated) one question. page-type is used from production
> systems nowadays. Why don't you want to move page-type.c into tools/ dir?
I was actually thinking the same with you, and the good news is, it's
recently moved into tools/ by Dave Young:
commit c6dd897f3bfc54a44942d742d6dfa842e33d88e0
Author: Dave Young <dyoung@redhat.com>
Date: Wed Mar 28 14:42:55 2012 -0700
mm: move page-types.c from Documentation to tools/vm
Thanks,
Fengguang
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] Cleanup page-type.c
2012-05-02 23:06 ` Fengguang Wu
@ 2012-05-03 1:41 ` KOSAKI Motohiro
0 siblings, 0 replies; 4+ messages in thread
From: KOSAKI Motohiro @ 2012-05-03 1:41 UTC (permalink / raw)
To: Fengguang Wu; +Cc: Ulrich Drepper, akpm, dyoung, linux-kernel, n-horiguchi
On Wed, May 2, 2012 at 7:06 PM, Fengguang Wu <fengguang.wu@intel.com> wrote:
> On Wed, May 02, 2012 at 02:19:01PM -0400, KOSAKI Motohiro wrote:
>> (5/2/12 10:41 AM), Ulrich Drepper wrote:
>> > Compiling page-type.c with a recent compiler produces many warnings,
>> > mostly related to signed/unsigned comparisons. This patch cleans up
>> > most of them.
>> >
>> > One remaining warning is about an unused parameter. The<compiler.h>
>> > file doesn't define a __unused macro (or the like) yet. This can be
>> > addressed later.
>> >
>> > The line numbers for this patch correspond to the file changed to remove
>> > the duplicate definitions of the KPF_* macros which is contained in
>> > another patch. It should apply cleanly albeit with warnings even without
>> > that patch applied first.
>> >
>> >
>> > Signed-off-by: Ulrich Drepper<drepper@gmail.com>
>> >
>> > page-types.c | 22 +++++++++++-----------
>> > 1 file changed, 11 insertions(+), 11 deletions(-)
>>
>> Looks good to me.
>> Acked-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
>
> Acked-by: Fengguang Wu <fengguang.wu@intel.com>
>
>> offtopic:
>> Wu, I have (unrelated) one question. page-type is used from production
>> systems nowadays. Why don't you want to move page-type.c into tools/ dir?
>
> I was actually thinking the same with you, and the good news is, it's
> recently moved into tools/ by Dave Young:
>
> commit c6dd897f3bfc54a44942d742d6dfa842e33d88e0
> Author: Dave Young <dyoung@redhat.com>
> Date: Wed Mar 28 14:42:55 2012 -0700
>
> mm: move page-types.c from Documentation to tools/vm
Nice! :)
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2012-05-03 1:41 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-05-02 14:41 [PATCH] Cleanup page-type.c Ulrich Drepper
2012-05-02 18:19 ` KOSAKI Motohiro
2012-05-02 23:06 ` Fengguang Wu
2012-05-03 1:41 ` KOSAKI Motohiro
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox