From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55366) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a7TWM-0007TM-C7 for qemu-devel@nongnu.org; Fri, 11 Dec 2015 14:38:27 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a7TWH-0007Jo-9h for qemu-devel@nongnu.org; Fri, 11 Dec 2015 14:38:26 -0500 Received: from domu-toccata.ens-lyon.fr ([140.77.166.138]:38280 helo=sonata.ens-lyon.org) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a7TWH-0007Jj-2j for qemu-devel@nongnu.org; Fri, 11 Dec 2015 14:38:21 -0500 Date: Fri, 11 Dec 2015 20:38:19 +0100 From: Samuel Thibault Message-ID: <20151211193819.GJ2764@var.home> References: <20151211001505.GV2905@var.home> <1449792930-27293-1-git-send-email-samuel.thibault@ens-lyon.org> <1449792930-27293-6-git-send-email-samuel.thibault@ens-lyon.org> <566AE66E.1030902@redhat.com> <20151211192944.GI2764@var.home> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20151211192944.GI2764@var.home> Subject: Re: [Qemu-devel] [PATCH 06/18] slirp: Factorizing and cleaning solookup() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Thomas Huth Cc: zhanghailiang , Li Zhijian , Stefan Hajnoczi , Jason Wang , qemu-devel@nongnu.org, Vasiliy Tolstov , Dave Gilbert , Gonglei , Jan Kiszka , Huangpeng , Yang Hongyang , Guillaume Subiron Samuel Thibault, on Fri 11 Dec 2015 20:29:44 +0100, wrote: > Thomas Huth, on Fri 11 Dec 2015 16:06:22 +0100, wrote: > > On 11/12/15 01:15, Samuel Thibault wrote: > > > From: Guillaume Subiron > > > > > > This patch makes solookup() compatible with varying address families. Also, > > > this function was only compatible with TCP. Having the socket list in > > > argument, it is now compatible with UDP too. Finally, some optimization > > > code is factorized inside the function (the function look at the last > > > returned result before browsing the complete socket list). > > > > > > This also adds a sockaddr_equal() function to compare two > > > sockaddr_storage. > > > > I'd maybe also split this patch into two - first introduce the > > sockaddr_equal() function, then do the other changes. If you do too much > > stuff in one patch, it gets more difficult to read. > > Actually I think I'll do the converse. solookup doesn't take a sockaddr > first, so introducing sockaddr_equal just to make it take separate > in_addr and lport would make both patches clumsy. Making solookup access > sockaddr first is however not too bad. Mmm, that's still clumsy: making solookup use sockaddr_storage without using solookup means putting all the casts there, it's really unreadable, while the version with sockaddr_equal is nice to read. And conversely, introducing sockaddr_equal first is clumsy. I'll however have a look at introducing the optimizations etc. first, so that both making solookup use sockaddr and introducing sockaddr_equal looks natural. Samuel