Re: un-boolean_t sys/ddb/

2019-11-05 Thread Jasper Lievisse Adriaanse


> On 5 Nov 2019, at 13:55, Martin Pieuchot  wrote:
> 
> Take the safe approach of converting `boolean_t' to `int', `TRUE' to `1'
> and `FALSE' to `0'.
> 
> This is to reduce the typedef mess that requires pulling MD/MI headers.
> 
> Per-arch ddb code will follow, ok?
I’m ok with the diff (yay for cleaning that mess), a few trivial nits:

> Index: ddb/db_command.c
> @@ -199,15 +199,14 @@ db_command(struct db_command **last_cmdp
>   int t;
>   charmodif[TOK_STRING_SIZE];
>   db_expr_t   addr, count;
> - boolean_t   have_addr = FALSE;
> - int result;
> + int result, have_addr = 0;

You could merge this with the ‘int t’ a few lines above.

> Index: ddb/db_examine.c
> @@ -145,7 +145,7 @@ db_examine(db_addr_t addr, char *fmt, in
>   for (i = 0; i < size; i++) {
>   value =
>   db_get_value(addr+bytes, 1,
> - FALSE);
> + 0);
This and the next ones can now go on the same line as db_get_value(), no?

>   db_printf("%02lx",
>   (long)value);
>   bytes++;
> @@ -159,7 +159,7 @@ db_examine(db_addr_t addr, char *fmt, in
>   /* Print chars, use . for non-printables */
>   while (bytes--) {
>   value = db_get_value(addr + incr, 1,
> - FALSE);
> + 0);
Idem.

> @@ -198,7 +198,7 @@ db_examine(db_addr_t addr, char *fmt, in
>   incr = 0;
>   for (;;) {
>   value = db_get_value(addr + incr, 1,
> - FALSE);
> + 0);
Idem.

Cheers,
Jasper



un-boolean_t sys/ddb/

2019-11-05 Thread Martin Pieuchot
Take the safe approach of converting `boolean_t' to `int', `TRUE' to `1'
and `FALSE' to `0'.

This is to reduce the typedef mess that requires pulling MD/MI headers.

Per-arch ddb code will follow, ok?

Index: ddb/db_command.c
===
RCS file: /cvs/src/sys/ddb/db_command.c,v
retrieving revision 1.86
diff -u -p -r1.86 db_command.c
--- ddb/db_command.c1 Apr 2019 09:28:24 -   1.86
+++ ddb/db_command.c5 Nov 2019 12:15:59 -
@@ -69,7 +69,7 @@ label_t   *db_recover;
  * and '+' points to next line.
  * Otherwise: 'dot' points to next item, '..' points to last.
  */
-boolean_t  db_ed_style = TRUE;
+intdb_ed_style = 1;
 
 db_addr_t  db_dot; /* current location */
 db_addr_t  db_last_addr;   /* last explicit address typed */
@@ -112,8 +112,8 @@ voiddb_show_panic_cmd(db_expr_t, int, d
 void   db_bcstats_print_cmd(db_expr_t, int, db_expr_t, char *);
 void   db_struct_offset_cmd(db_expr_t, int, db_expr_t, char *);
 void   db_ctf_show_struct(db_expr_t, int, db_expr_t, char *);
-void   db_show_regs(db_expr_t, boolean_t, db_expr_t, char *);
-void   db_write_cmd(db_expr_t, boolean_t, db_expr_t, char *);
+void   db_show_regs(db_expr_t, int, db_expr_t, char *);
+void   db_write_cmd(db_expr_t, int, db_expr_t, char *);
 void   db_witness_display(db_expr_t, int, db_expr_t, char *);
 void   db_witness_list(db_expr_t, int, db_expr_t, char *);
 void   db_witness_list_all(db_expr_t, int, db_expr_t, char *);
@@ -199,15 +199,14 @@ db_command(struct db_command **last_cmdp
int t;
charmodif[TOK_STRING_SIZE];
db_expr_t   addr, count;
-   boolean_t   have_addr = FALSE;
-   int result;
+   int result, have_addr = 0;
 
t = db_read_token();
if (t == tEOL) {
/* empty line repeats last command, at 'next' */
cmd = *last_cmdp;
addr = (db_expr_t)db_next;
-   have_addr = FALSE;
+   have_addr = 0;
count = 1;
modif[0] = '\0';
}
@@ -273,11 +272,11 @@ db_command(struct db_command **last_cmdp
if (db_expression()) {
db_dot = (db_addr_t) addr;
db_last_addr = db_dot;
-   have_addr = TRUE;
+   have_addr = 1;
}
else {
addr = (db_expr_t) db_dot;
-   have_addr = FALSE;
+   have_addr = 0;
}
t = db_read_token();
if (t == tCOMMA) {
@@ -329,10 +328,10 @@ db_command(struct db_command **last_cmdp
 void
 db_buf_print_cmd(db_expr_t addr, int have_addr, db_expr_t count, char *modif)
 {
-   boolean_t full = FALSE;
+   int full = 0;
 
if (modif[0] == 'f')
-   full = TRUE;
+   full = 1;
 
vfs_buf_print((void *) addr, full, db_printf);
 }
@@ -341,10 +340,10 @@ db_buf_print_cmd(db_expr_t addr, int hav
 void
 db_map_print_cmd(db_expr_t addr, int have_addr, db_expr_t count, char *modif)
 {
-boolean_t full = FALSE;
+int full = 0;
 
 if (modif[0] == 'f')
-full = TRUE;
+full = 1;
 
 uvm_map_printit((struct vm_map *) addr, full, db_printf);
 }
@@ -374,10 +373,10 @@ db_socket_print_cmd(db_expr_t addr, int 
 void
 db_mount_print_cmd(db_expr_t addr, int have_addr, db_expr_t count, char *modif)
 {
-   boolean_t full = FALSE;
+   int full = 0;
 
if (modif[0] == 'f')
-   full = TRUE;
+   full = 1;
 
vfs_mount_print((struct mount *) addr, full, db_printf);
 }
@@ -385,11 +384,11 @@ db_mount_print_cmd(db_expr_t addr, int h
 void
 db_show_all_mounts(db_expr_t addr, int have_addr, db_expr_t count, char *modif)
 {
-   boolean_t full = FALSE;
+   int full = 0;
struct mount *mp;
 
if (modif[0] == 'f')
-   full = TRUE;
+   full = 1;
 
TAILQ_FOREACH(mp, , mnt_list) {
db_printf("mountpoint %p\n", mp);
@@ -401,10 +400,10 @@ extern struct pool vnode_pool;
 void
 db_show_all_vnodes(db_expr_t addr, int have_addr, db_expr_t count, char *modif)
 {
-   boolean_t full = FALSE;
+   int full = 0;
 
if (modif[0] == 'f')
-   full = TRUE;
+   full = 1;
 
pool_walk(_pool, full, db_printf, vfs_vnode_print);
 }
@@ -413,10 +412,10 @@ extern struct pool bufpool;
 void
 db_show_all_bufs(db_expr_t addr, int have_addr, db_expr_t count, char *modif)
 {
-   boolean_t full = FALSE;
+   int full = 0;
 
if (modif[0] == 'f')
-   full = TRUE;
+   full = 1;
 
pool_walk(, full, db_printf, vfs_buf_print);
 }
@@ -425,10 +424,10 @@ db_show_all_bufs(db_expr_t addr, int hav
 void
 db_object_print_cmd(db_expr_t addr, int have_addr, db_expr_t count, char 
*modif)
 {
-