From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Xie, Huawei" Subject: Re: [PATCH RFC v2 07/12] lib/librte_vhost: async event and callback Date: Wed, 17 Dec 2014 17:51:51 +0000 Message-ID: References: <1418247477-13920-1-git-send-email-huawei.xie@intel.com> <1418247477-13920-8-git-send-email-huawei.xie@intel.com> <548E6F9C.1000807@igel.co.jp> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable To: Tetsuya Mukawa , "dev-VfR2kkLFssw@public.gmane.org" Return-path: In-Reply-To: <548E6F9C.1000807-AlSX/UN32fvPDbFq/vQRIQ@public.gmane.org> Content-Language: en-US List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces-VfR2kkLFssw@public.gmane.org Sender: "dev" >=20 > I got error from checkpatch.pl like followings. >=20 > ERROR: trailing statements should be on next line > #74: FILE: lib/librte_vhost/vhost_user/fd_man.c:61: > + for (i =3D 0; i < pfdset->num && pfdset->fd[i].fd !=3D fd; i++); Thanks. This is RFC, so maybe it is far from perfection, :). > > + int num =3D MAX_FDS; >=20 > Is it possible to use pfdset->num? >=20 Had considered this. It is not performance critical code, and it is easier to use MAX_FDS. We could improve this after we have processed all the critical things. > > + > > + int added =3D 0; >=20 > Need a line? Thanks! >=20 > > + if (pfdentry->rcb && rfset) { > > + FD_SET(pfdentry->fd, rfset); > > + added =3D 1; > > + =09 > > + fd_set rfds,wfds; >=20 > Need a space between rfds and wfds. Agree. >=20 > > + int i, maxfds; > > + struct fdentry *pfdentry; > > + int num =3D MAX_FDS; >=20 > Is it possible to use pfdset->num? > > > + > > + if (pfdset =3D=3D NULL) > > + return; > > + > > + while (1) { > > + FD_ZERO(&rfds); > > + FD_ZERO(&wfds); > > + maxfds =3D fdset_fill(&rfds, &wfds, pfdset); > > + if (maxfds =3D=3D -1) { > > + return; > > + } > > + > > + select(maxfds + 1, &rfds, &wfds, NULL, NULL); > > + > > + for (i =3D 0; i < num; i++) { > > + pfdentry =3D &pfdset->fd[i]; > > + if (FD_ISSET(pfdentry->fd, &rfds) && pfdentry->rcb) > > + pfdentry->rcb(pfdentry->fd, pfdentry->dat); > > + if (FD_ISSET(pfdentry->fd, &wfds) && pfdentry->wcb) > > + pfdentry->wcb(pfdentry->fd, pfdentry->dat); > > + } > > + } > > +}