[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH v2 3/3] gnttab: clean up gnttab_set_version()
On 22/06/15 12:46, Jan Beulich wrote: > - drop pointless nr_grant_entries() check from loop over reserved > entries (adding suitable BUILD_BUG_ON()s to validate that) > - adjust types > - rename d to currd > - formatting > > Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx> Reviewed-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, with one suggestion. > @@ -2625,66 +2633,78 @@ gnttab_set_version(XEN_GUEST_HANDLE_PARA > break; > } > > - /* Preserve the first 8 entries (toolstack reserved grants) */ > - if ( gt->gt_version == 1 ) > - { > - memcpy(reserved_entries, &shared_entry_v1(gt, 0), > sizeof(reserved_entries)); > - } > - else if ( gt->gt_version == 2 ) > + /* Preserve the first 8 entries (toolstack reserved grants). */ > + switch ( gt->gt_version ) > { > - for ( i = 0; i < GNTTAB_NR_RESERVED_ENTRIES && i < > nr_grant_entries(gt); i++ ) > + case 1: > + memcpy(reserved_entries, &shared_entry_v1(gt, 0), > + sizeof(reserved_entries)); > + break; > + case 2: > + for ( i = 0; i < GNTTAB_NR_RESERVED_ENTRIES; i++ ) > { > - int flags = status_entry(gt, i); > - flags |= shared_entry_v2(gt, i).hdr.flags; > - if ((flags & GTF_type_mask) == GTF_permit_access) > + unsigned int flags = shared_entry_v2(gt, i).hdr.flags; > + > + switch ( flags & GTF_type_mask ) > { > - reserved_entries[i].flags = flags; > + case GTF_permit_access: > + reserved_entries[i].flags = flags | status_entry(gt, i); > reserved_entries[i].domid = shared_entry_v2(gt, i).hdr.domid; > reserved_entries[i].frame = shared_entry_v2(gt, > i).full_page.frame; > - } > - else > - { > - if ((flags & GTF_type_mask) != GTF_invalid) > - gdprintk(XENLOG_INFO, "d%d: bad flags %x in grant %d > when switching grant version\n", > - d->domain_id, flags, i); > + break; > + default: > + gdprintk(XENLOG_INFO, > + "bad flags %x in grant %u when switching version\n", > + flags, i); A 0x for flags, to avoid decimal confusion. _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |