|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH 4/5] xen: events, exposes evtchn_alloc_unbound_domain
On 9 August 2012 11:35, Tim Deegan <tim@xxxxxxx> wrote:
> At 11:23 +0100 on 09 Aug (1344511426), Ian Campbell wrote:
>> On Thu, 2012-08-09 at 11:06 +0100, Tim Deegan wrote:
>> > At 20:50 +0100 on 03 Aug (1344027053), Jean Guyader wrote:
>> > >
>> > > Exposes evtchn_alloc_unbound_domain to the rest of
>> > > Xen so we can create allocated unbound evtchn within Xen.
>> > >
>> > > Signed-off-by: Jean Guyader <jean.guyader@xxxxxxxxxx>
>> >
>> > > @@ -161,18 +163,18 @@ static long
>> > > evtchn_alloc_unbound(evtchn_alloc_unbound_t *alloc)
>> > > {
>> > > struct evtchn *chn;
>> > > struct domain *d;
>> > > - int port;
>> > > + evtchn_port_t port;
>> > > domid_t dom = alloc->dom;
>> > > - long rc;
>> > > + int rc;
>> >
>> > The function returns long; if you're tidying this up to be an int, might
>> > as well change the return type too.
>>
>> I'm not sure if this is relevant but Jan just sent a patch to "make all
>> (native) hypercalls consistently have "long" return type". I
>> think/suspect this rc here turns into the result of the hypercall?
>>
>> Jan's patch was motivated by something to do with sign extension when a
>> hypercall's int return is written to the long in the multicall arg
>> struct which causes strangeness. Perhaps not totally relevant to
>> evtchn_alloc which is unlikely to be in a MC.
>
> Yes, this eventually ends up in a hypercall handler, but s/long/int/
> here doesn't cause problems because
> - rc is only ever set to an 'int' value here so we can't lose data
> from the type being too narrow; and
> - Those int values get cast up to long (either in here or in the
> caller) directly, which will sign-extend the.
>
> It really doesn't matter whether this function returns an int or a long,
> but it's a bit untidy to change it half-way.
>
The main reason why I changed it only base ERROR_EXIT_DOM expects an int based
on the format string. I guess I could cast the long in int for the
call to ERROR_EXIT_DOM
but that doesn't really look nice either.
Jean
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |