Skip to contentSkip to conversation

tools/mm: use <stdbool.h> in page_owner_sort.c

PATCH Superseded Ye Liu 2 participants 3 messages Oct 15, 2025 Memory management

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Ye Liu

author
#0 lore raw

PATCH 1/1 tools/mm: use <stdbool.h> in page_owner_sort.c

From: Ye Liu <[email protected]>

Use standard <stdbool.h> instead of manually defining bool, true and false.

---
 tools/mm/page_owner_sort.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
tools/mm/page_owner_sort.c +4 -3
index 880e36df0c11..cbd195d7b5da 100644
@@ -13,6 +13,7 @@
 
 #include <stdio.h>
 #include <stdlib.h>
+#include <stdbool.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <fcntl.h>
@@ -23,9 +24,9 @@
 #include <linux/types.h>
 #include <getopt.h>
 
-#define bool int
-#define true 1
-#define false 0
+//#define bool int
+//#define true 1
+//#define false 0
 #define TASK_COMM_LEN 16
 
 struct block_list {
Signature · 1 line
2.43.0
#1 lore raw
Quoted 22 lines · Ye Liu

From: Ye Liu <[email protected]>

Use standard <stdbool.h> instead of manually defining bool, true and false.

---
  tools/mm/page_owner_sort.c | 7 ++++---
  1 file changed, 4 insertions(+), 3 deletions(-)
tools/mm/page_owner_sort.c +1 -0
index 880e36df0c11..cbd195d7b5da 100644
@@ -13,6 +13,7 @@
 
  #include <stdio.h>
  #include <stdlib.h>
+#include <stdbool.h>
  #include <sys/types.h>
  #include <sys/stat.h>
  #include <fcntl.h>

tools/mm/page_owner_sort.c line 30

Quoted 10 lines
tools/mm/page_owner_sort.c +3 -3
@@ -23,9 +24,9 @@
  #include <linux/types.h>
  #include <getopt.h>
 
-#define bool int
-#define true 1
-#define false 0
+//#define bool int
+//#define true 1
+//#define false 0
  #define TASK_COMM_LEN 16

You forgot to remove these :)

Quoted 2 lines
tools/mm/page_owner_sort.c +0 -0
  struct block_list {
author
#2 lore raw
Quoted 26 lines · Dev Jain
Quoted 24 lines · Ye Liu

From: Ye Liu <[email protected]>

Use standard <stdbool.h> instead of manually defining bool, true and false.

---
  tools/mm/page_owner_sort.c | 7 ++++---

  1 file changed, 4 insertions(+), 3 deletions(-)
tools/mm/page_owner_sort.c +1 -0
index 880e36df0c11..cbd195d7b5da 100644
@@ -13,6 +13,7 @@
     #include <stdio.h>
   #include <stdlib.h>
+#include <stdbool.h>
   #include <sys/types.h>
   #include <sys/stat.h>
   #include <fcntl.h>
@@ -23,9 +24,9 @@
   #include <linux/types.h>
   #include <getopt.h>

  -#define bool int

Quoted 8 lines
Quoted 6 lines
tools/mm/page_owner_sort.c +3 -2
-#define true 1
-#define false 0
+//#define bool int
+//#define true 1
+//#define false 0

  #define TASK_COMM_LEN 16

You forgot to remove these :)

Oops, you're right — I’ll drop those lines and send a v2. :) Thanks!>

Quoted 1 line
Quoted 1 line

    struct block_list {

Signature · 2 lines
Thanks,
Ye Liu