[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [qemu-s390x] [PATCH v4 09/10] s390-ccw: read user input for boot ind
From: |
Thomas Huth |
Subject: |
Re: [qemu-s390x] [PATCH v4 09/10] s390-ccw: read user input for boot index via the SCLP console |
Date: |
Fri, 26 Jan 2018 11:44:02 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 |
On 23.01.2018 19:26, Collin L. Walling wrote:
> Implements an sclp_read function to capture input from the
> console and a wrapper function that handles parsing certain
> characters and adding input to a buffer. The input is checked
> for any erroneous values and is handled appropriately.
>
> A prompt will persist until input is entered or the timeout
> expires (if one was set). Example:
>
> Please choose (default will boot in 10 seconds):
>
> Correct input will boot the respective boot index. If the
> user's input is empty, 0, or if the timeout expires, then
> the default zipl entry will be chosen. If the input is
> within the range of available boot entries, then the
> selection will be booted. Any erroneous input will cancel
> the timeout and re-prompt the user.
>
> Signed-off-by: Collin L. Walling <address@hidden>
> ---
> pc-bios/s390-ccw/menu.c | 152
> +++++++++++++++++++++++++++++++++++++++++++-
> pc-bios/s390-ccw/s390-ccw.h | 2 +
> pc-bios/s390-ccw/sclp.c | 20 ++++++
> pc-bios/s390-ccw/virtio.c | 2 +-
> 4 files changed, 172 insertions(+), 4 deletions(-)
[...]
> +static int read_prompt(char *buf, size_t len)
> +{
> + char inp[2] = {};
> + uint8_t idx = 0;
> + uint64_t time;
> +
> + if (timeout) {
> + time = get_clock() + (timeout * TOD_CLOCK_SECOND);
Nit: Parentheses around "timeout * TOD_CLOCK_SECOND" are not required.
Apart from that, patch looks fine to me now.
Reviewed-by: Thomas Huth <address@hidden>
- Re: [qemu-s390x] [Qemu-devel] [PATCH v4 04/10] s390-ccw: update libc, (continued)
[qemu-s390x] [PATCH v4 06/10] s390-ccw: set up interactive boot menu parameters, Collin L. Walling, 2018/01/23
[qemu-s390x] [PATCH v4 05/10] s390-ccw: parse and set boot menu options, Collin L. Walling, 2018/01/23
[qemu-s390x] [PATCH v4 07/10] s390-ccw: read stage2 boot loader data to find menu, Collin L. Walling, 2018/01/23
[qemu-s390x] [PATCH v4 09/10] s390-ccw: read user input for boot index via the SCLP console, Collin L. Walling, 2018/01/23
[qemu-s390x] [PATCH v4 10/10] s390-ccw: interactive boot menu for scsi, Collin L. Walling, 2018/01/23
[qemu-s390x] [PATCH v4 08/10] s390-ccw: print zipl boot menu, Collin L. Walling, 2018/01/23