All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michael Tokarev <mjt@tls.msk.ru>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] use different fd variables for device and socket, unbreak qemu-nbd -c
Date: Sun, 15 Jan 2012 17:01:01 +0400	[thread overview]
Message-ID: <4F12CE0D.4040501@msgid.tls.msk.ru> (raw)
In-Reply-To: <jeuaou$cul$1@dough.gmane.org>

On 15.01.2012 14:45, Paolo Bonzini wrote:
> On 01/14/2012 12:41 PM, Michael Tokarev wrote:
>> commit a61c67828dea7c64edaf226cadb45b4ffcc1d411
>> Author: Paolo Bonzini<pbonzini@redhat.com>
>> Date:   Mon Sep 12 17:28:11 2011 +0200
>>
>>      qemu-nbd: use common main loop
>>
>>      Using a single main loop for sockets will help yielding from the socket
>>      coroutine back to the main loop, and later reentering it.
>>
>> changed code to use local variable "fd" in qemu-nbd.c:main()
>> in two places: for /dev/nbd device and for control socket.
>> The result is that qemu-nbd -c $device does not work anymore.
>>
>> Use two variables - devfs and sockfd - for the two purposes,
>> instead of one fd.
>>
>> Signed-Off-By: Michael Tokarev<mjt@tls.msk.ru>
>> ---
>>   qemu-nbd.c |   26 +++++++++++++-------------
>>   1 files changed, 13 insertions(+), 13 deletions(-)
>>
>> diff --git a/qemu-nbd.c b/qemu-nbd.c
>> index eb61c33..e76c782 100644
>> --- a/qemu-nbd.c
>> +++ b/qemu-nbd.c
>> @@ -301,7 +301,7 @@ int main(int argc, char **argv)
>>       int flags = BDRV_O_RDWR;
>>       int partition = -1;
>>       int ret;
>> -    int fd;
>> +    int sockfd, devfd;
>>       int persistent = 0;
>>       pthread_t client_thread;
>>
>> @@ -401,13 +401,13 @@ int main(int argc, char **argv)
>>       }
>>
>>       if (disconnect) {
>> -        fd = open(argv[optind], O_RDWR);
>> -        if (fd == -1)
>> +        sockfd = open(argv[optind], O_RDWR);
>> +        if (sockfd == -1)
>>               err(EXIT_FAILURE, "Cannot open %s", argv[optind]);
>>
>> -        nbd_disconnect(fd);
>> +        nbd_disconnect(sockfd);
>>
>> -        close(fd);
>> +        close(sockfd);
>>
>>           printf("%s disconnected\n", argv[optind]);
> 
> This should be devfd.

Yes indeed.  In that case make it nbdfd not devfd - there are other
variables prefixed "nbd" already.

[]
> Otherwise looks good, I'll fix up and send for inclusion.

Thanks!

FWIW, it is not -stable material, since 1.0 isn't broken yet ;)

/mjt

      reply	other threads:[~2012-01-15 13:01 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-14 11:41 [Qemu-devel] [PATCH] use different fd variables for device and socket, unbreak qemu-nbd -c Michael Tokarev
2012-01-15 10:45 ` Paolo Bonzini
2012-01-15 13:01   ` Michael Tokarev [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4F12CE0D.4040501@msgid.tls.msk.ru \
    --to=mjt@tls.msk.ru \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.