Received: from eggs.gnu.org ([208.118.235.92]:60003) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SzkPS-0001bg-5b for qemu-devel@nongnu.org; Fri, 10 Aug 2012 04:17:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SzkPR-0002b2-6K for qemu-devel@nongnu.org; Fri, 10 Aug 2012 04:17:30 -0400 Received: from e06smtp11.uk.ibm.com ([195.75.94.107]:56142) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SzkPQ-0002ad-Tc for qemu-devel@nongnu.org; Fri, 10 Aug 2012 04:17:29 -0400 Received: from /spool/local by e06smtp11.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 10 Aug 2012 09:17:27 +0100 Received: from d06av04.portsmouth.uk.ibm.com (d06av04.portsmouth.uk.ibm.com [9.149.37.216]) by b06cxnps3075.portsmouth.uk.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id q7A8HJKD13107348 for ; Fri, 10 Aug 2012 08:17:19 GMT Received: from d06av04.portsmouth.uk.ibm.com (loopback [127.0.0.1]) by d06av04.portsmouth.uk.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id q7A8HPxk013977 for ; Fri, 10 Aug 2012 02:17:25 -0600 Date: Fri, 10 Aug 2012 08:20:16 +0100 From: Stefan Hajnoczi Message-ID: <20120810072016.GA2464@stefanha-thinkpad.localdomain> References: <1344564649-6272-1-git-send-email-coreyb@linux.vnet.ibm.com> <1344564649-6272-3-git-send-email-coreyb@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1344564649-6272-3-git-send-email-coreyb@linux.vnet.ibm.com> Subject: Re: [Qemu-devel] [PATCH v8 2/7] qapi: Introduce add-fd, remove-fd, query-fdsets List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Corey Bryant Cc: kwolf@redhat.com, aliguori@us.ibm.com, libvir-list@redhat.com, qemu-devel@nongnu.org, lcapitulino@redhat.com, pbonzini@redhat.com, eblake@redhat.com On Thu, Aug 09, 2012 at 10:10:44PM -0400, Corey Bryant wrote: > +void qmp_remove_fd(int64_t fdset_id, bool has_fd, int64_t fd, Error **errp) > +{ > + MonFdset *mon_fdset; > + MonFdsetFd *mon_fdset_fd; > + char fd_str[20]; > + > + QLIST_FOREACH(mon_fdset, &mon_fdsets, next) { > + if (mon_fdset->id != fdset_id) { > + continue; > + } > + QLIST_FOREACH(mon_fdset_fd, &mon_fdset->fds, next) { > + if (has_fd && mon_fdset_fd->fd != fd) { > + continue; > + } > + mon_fdset_fd->removed = true; > + if (has_fd) { > + break; > + } > + } > + monitor_fdset_cleanup(mon_fdset); > + return; > + } > + snprintf(fd_str, sizeof(fd_str), "%" PRId64, fd); > + error_set(errp, QERR_FD_NOT_FOUND, fd_str); fd is optional and may be uninitialized. I think the human-readable string should be: if has_fd: fd_str = '%s:%s' % (fdset_id, fd) else: fd_str = '%s' % fdset_id Otherwise, looks good.