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

Peter Krempa pkrempa at redhat.com
Tue Sep 3 12:08:28 UTC 2013


On 09/03/13 12:02, Martin Kletzander wrote:
> 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...

Right, I removed the parameter and pushed the rest of the series. Thanks.

Peter


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 901 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20130903/a5292bc9/attachment-0001.sig>


More information about the libvir-list mailing list