[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH 14/16] tmem: cleanup: drop useless functions from head file



>>> On 27.11.13 at 15:59, Andrew Cooper <andrew.cooper3@xxxxxxxxxx> 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 <bob.liu@xxxxxxxxxx>
>>>> ---
>>>>  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


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.