From: "Jan Beulich" Subject: Re: [PATCH 14/16] tmem: cleanup: drop useless functions from head file Date: Wed, 27 Nov 2013 15:55:11 +0000 Message-ID: <529623EF0200007800107B03@nat28.tlf.novell.com> References: <1384937185-24749-1-git-send-email-bob.liu@oracle.com> <1384937185-24749-14-git-send-email-bob.liu@oracle.com> <529603CF.5060006@citrix.com> <20131127145227.GK4430@pegasus.dumpdata.com> <529608EC.1020402@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1VlhSL-00061v-K1 for xen-devel@lists.xenproject.org; Wed, 27 Nov 2013 15:55:13 +0000 In-Reply-To: <529608EC.1020402@citrix.com> Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Andrew Cooper , Konrad Rzeszutek Wilk Cc: xen-devel@lists.xenproject.org, Bob Liu , keir@xen.org, ian.campbell@citrix.com List-Id: xen-devel@lists.xenproject.org >>> On 27.11.13 at 15:59, Andrew Cooper wrote: > On 27/11/13 14:52, Konrad Rzeszutek Wilk wrote: >> On Wed, Nov 27, 2013 at 02:38:07PM +0000, Andrew Cooper wrote: >>> On 20/11/13 08:46, Bob Liu wrote: >>>> They are several one line functions in tmem_xen.h which are useless, this > patch >>>> embeded them into tmem.c directly. >>>> >>>> Signed-off-by: Bob Liu >>>> --- >>>> xen/common/tmem.c | 22 +++++++++++----------- >>>> xen/include/xen/tmem_xen.h | 27 --------------------------- >>>> 2 files changed, 11 insertions(+), 38 deletions(-) >>>> >>>> diff --git a/xen/common/tmem.c b/xen/common/tmem.c >>>> index bf0fa1b..2e807d4 100644 >>>> --- a/xen/common/tmem.c >>>> +++ b/xen/common/tmem.c >>>> @@ -1212,7 +1212,7 @@ obj_unlock: >>>> >>>> static int tmem_evict(void) >>>> { >>>> - struct client *client = tmem_client_from_current(); >>>> + struct client *client = (struct client *)current->domain->tmem; >>> domain->tmem is a void pointer. Therefore this explicit cast to (struct >>> client *) is redundant. >>> >>> I would however, suggest updating struct domain to have a struct client >>> pointer rather than a void pointer. >> That might bring more of #include in the file. That was I believe the initial >> reason for not doing that. But perhaps one can also just do: >> >> extern struct client; >> >> in the header that has domain struct (I always forget the name of it) >> and that would make this neater. > > just "struct client;" is the correct way to "extern" a struct in C. You don't need anything in the case here. Such forward declarations are only needed when the type would otherwise first appear in a function parameter declaration (since then its scope becomes only that of the function). > I might also suggest a rename to tmem_client ? And it not being that way is what I think was the reason not to expose the type outside of tmem files. Jan