Re: [PATCH v3 3/5] kdb: Remove special case logic from kdb_read()

From: Doug Anderson
Date: Thu Oct 17 2019 - 00:11:20 EST


Hi,

On Mon, Oct 14, 2019 at 8:46 AM Daniel Thompson
<daniel.thompson@xxxxxxxxxx> wrote:
>
> @@ -91,12 +92,17 @@ kdb_bt1(struct task_struct *p, unsigned long mask,
> kdb_ps1(p);
> kdb_show_stack(p, NULL);
> if (btaprompt) {
> - kdb_getstr(buffer, sizeof(buffer),
> - "Enter <q> to end, <cr> to continue:");
> - if (buffer[0] == 'q') {
> - kdb_printf("\n");
> + kdb_printf("Enter <q> to end, <cr> or <space> to continue:");
> + ch = kdb_getchar();
> + while (!strchr("\r\n q", ch))
> + ch = kdb_getchar();

nit: above 3 lines would be better with "do while", AKA:

do {
ch = kdb_getchar();
} while (!strchr("\r\n q", ch));


> @@ -50,14 +50,14 @@ static int kgdb_transition_check(char *buffer)
> }
>
> /*
> - * kdb_read_handle_escape
> + * kdb_handle_escape

Optional nit: while you're touching this comment, you could make it
kerneldoc complaint.


> @@ -152,7 +158,7 @@ static int kdb_read_get_key(char *buffer, size_t bufsize)
> return '\e';
>
> *ped++ = key;
> - key = kdb_read_handle_escape(escape_data,
> + key = kdb_handle_escape(escape_data,
> ped - escape_data);

nit: indentation no longer lines up for the "ped - escape_data" line.

Nothing here is terribly important, thus:

Reviewed-by: Douglas Anderson <dianders@xxxxxxxxxxxx>