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

Re: [PATCH v9 6/8] common/domain: add a domain context record for shared_info...



On 05.10.2020 12:39, Andrew Cooper wrote:
> On 24/09/2020 14:10, Paul Durrant wrote:
>> +static int load_shared_info(struct domain *d, struct domain_context *c)
>> +{
>> +    struct domain_shared_info_context ctxt;
>> +    size_t hdr_size = offsetof(typeof(ctxt), buffer);
>> +    unsigned int i;
>> +    int rc;
>> +
>> +    rc = DOMAIN_LOAD_BEGIN(SHARED_INFO, c, &i);
>> +    if ( rc )
>> +        return rc;
>> +
>> +    if ( i ) /* expect only a single instance */
>> +        return -ENXIO;
>> +
>> +    rc = domain_load_data(c, &ctxt, hdr_size);
>> +    if ( rc )
>> +        return rc;
>> +
>> +    if ( ctxt.buffer_size > sizeof(shared_info_t) ||
>> +         (ctxt.flags & ~DOMAIN_SAVE_32BIT_SHINFO) )
>> +        return -EINVAL;
>> +
>> +    if ( ctxt.flags & DOMAIN_SAVE_32BIT_SHINFO )
>> +    {
>> +#ifdef CONFIG_COMPAT
>> +        has_32bit_shinfo(d) = true;
> 
> d->arch.has_32bit_shinfo

But this is common code, i.e. using d->arch directly is a layering
violation. I know your dislike of lvalues disguised by function-
like macros, but what do you do?

Jan



 


Rackspace

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