Re: [PATCH 2/3] virsh: Rename vshMakeStdinRaw to vshTTYMakeRaw and move it to virsh.c

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 08/29/2013 06:36 PM, Peter Krempa wrote:
> Move the function to virsh.c to the rest of the TTY managing functions
> and change the code so that it mirrors the rest.
> ---
>  tools/virsh-console.c | 50 +++++---------------------------------------------
>  tools/virsh-console.h |  7 +++----
>  tools/virsh-domain.c  |  2 +-
>  tools/virsh.c         | 48 +++++++++++++++++++++++++++++++++++++++++++++---
>  tools/virsh.h         |  1 +
>  5 files changed, 55 insertions(+), 53 deletions(-)
> 
> diff --git a/tools/virsh-console.c b/tools/virsh-console.c
> index debf12c..cc9cc6a 100644
> --- a/tools/virsh-console.c
> +++ b/tools/virsh-console.c
[...]
> @@ -319,40 +306,13 @@ vshGetEscapeChar(const char *s)
> 
> 
>  int
> -vshMakeStdinRaw(struct termios *ttyattr, bool report_errors)
> -{
> -    struct termios rawattr;
> -    char ebuf[1024];
> -
> -    if (tcgetattr(STDIN_FILENO, ttyattr) < 0) {
> -        if (report_errors)
> -            VIR_ERROR(_("unable to get tty attributes: %s"),
> -                      virStrerror(errno, ebuf, sizeof(ebuf)));
> -        return -1;
> -    }
> -
> -    rawattr = *ttyattr;
> -    cfmakeraw(&rawattr);
> -
> -    if (tcsetattr(STDIN_FILENO, TCSAFLUSH, &rawattr) < 0) {
> -        if (report_errors)
> -            VIR_ERROR(_("unable to set tty attributes: %s"),
> -                      virStrerror(errno, ebuf, sizeof(ebuf)));
> -        return -1;
> -    }
> -
> -    return 0;
> -}
> -
> -
> -int
> -vshRunConsole(virDomainPtr dom,
> +vshRunConsole(vshControl *ctl,
> +              virDomainPtr dom,
>                const char *dev_name,
>                const char *escape_seq,

You can get rid of this one since we call it with ctl->excapeChar only.

The rest looks ok, but Michal already ACK'd it, so...

Martin

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]