(scombo.domid != ldomid) ||
(!readonly && (scombo.flags & GTF_readonly)) )
{
- gnttab_clear_flags(rd, GTF_writing, status);
- gnttab_clear_flags(rd, GTF_reading, status);
+ gnttab_clear_flags(rd, GTF_writing | GTF_reading, status);
PIN_FAIL(done, GNTST_general_error,
"Unstable flags (%x) or dom (%d); expected d%d (r/w: %d)\n",
scombo.flags, scombo.domid, ldomid, !readonly);
int rc = GNTST_okay;
u32 old_pin;
u32 act_pin;
- unsigned int cache_flags, refcnt = 0, typecnt = 0;
+ unsigned int cache_flags, clear_flags = 0, refcnt = 0, typecnt = 0;
bool host_map_created = false;
struct active_grant_entry *act = NULL;
struct grant_mapping *mt;
unlock_out_clear:
if ( !(op->flags & GNTMAP_readonly) &&
!(act->pin & (GNTPIN_hstw_mask|GNTPIN_devw_mask)) )
- gnttab_clear_flags(rd, GTF_writing, status);
+ clear_flags |= GTF_writing;
if ( !act->pin )
- gnttab_clear_flags(rd, GTF_reading, status);
+ clear_flags |= GTF_reading;
+
+ if ( clear_flags )
+ gnttab_clear_flags(rd, clear_flags, status);
act_release_out:
active_entry_release(act);
grant_entry_header_t *sha;
struct page_info *pg;
uint16_t *status;
+ unsigned int clear_flags = 0;
if ( !op->done )
{
if ( ((act->pin & (GNTPIN_devw_mask|GNTPIN_hstw_mask)) == 0) &&
!(op->done & GNTMAP_readonly) )
- gnttab_clear_flags(rd, GTF_writing, status);
+ clear_flags |= GTF_writing;
if ( act->pin == 0 )
- gnttab_clear_flags(rd, GTF_reading, status);
+ clear_flags |= GTF_reading;
+
+ if ( clear_flags )
+ gnttab_clear_flags(rd, clear_flags, status);
active_entry_release(act);
grant_read_unlock(rgt);
uint16_t *status;
grant_ref_t trans_gref;
struct domain *td;
+ unsigned int clear_flags = 0;
grant_read_lock(rgt);
act->pin -= GNTPIN_hstw_inc;
if ( !(act->pin & (GNTPIN_devw_mask|GNTPIN_hstw_mask)) )
- gnttab_clear_flags(rd, GTF_writing, status);
+ clear_flags |= GTF_writing;
}
if ( !act->pin )
- gnttab_clear_flags(rd, GTF_reading, status);
+ clear_flags |= GTF_reading;
+
+ if ( clear_flags )
+ gnttab_clear_flags(rd, clear_flags, status);
active_entry_release(act);
grant_read_unlock(rgt);
const struct active_grant_entry *act,
uint16_t *status)
{
+ unsigned int clear_flags = 0;
+
if ( !(act->pin & (GNTPIN_hstw_mask | GNTPIN_devw_mask)) )
- gnttab_clear_flags(rd, GTF_writing, status);
+ clear_flags |= GTF_writing;
if ( !act->pin )
- gnttab_clear_flags(rd, GTF_reading, status);
+ clear_flags |= GTF_reading;
+
+ if ( clear_flags )
+ gnttab_clear_flags(rd, clear_flags, status);
}
/*
uint16_t trans_length;
bool is_sub_page;
s16 rc = GNTST_okay;
+ unsigned int clear_flags = 0;
*page = NULL;
unlock_out_clear:
if ( !(readonly) &&
!(act->pin & (GNTPIN_hstw_mask | GNTPIN_devw_mask)) )
- gnttab_clear_flags(rd, GTF_writing, status);
+ clear_flags |= GTF_writing;
if ( !act->pin )
- gnttab_clear_flags(rd, GTF_reading, status);
+ clear_flags |= GTF_reading;
+
+ if ( clear_flags )
+ gnttab_clear_flags(rd, clear_flags, status);
unlock_out:
active_entry_release(act);
for ( handle = 0; handle < gt->maptrack_limit; handle++ )
{
+ unsigned int clear_flags = 0;
+
map = &maptrack_entry(gt, handle);
if ( !(map->flags & (GNTMAP_device_map|GNTMAP_host_map)) )
continue;
}
if ( (act->pin & (GNTPIN_devw_mask|GNTPIN_hstw_mask)) == 0 )
- gnttab_clear_flags(rd, GTF_writing, status);
+ clear_flags |= GTF_writing;
}
if ( act->pin == 0 )
- gnttab_clear_flags(rd, GTF_reading, status);
+ clear_flags |= GTF_reading;
+
+ if ( clear_flags )
+ gnttab_clear_flags(rd, clear_flags, status);
active_entry_release(act);
grant_read_unlock(rgt);