*/
int __mem_sharing_unshare_page(struct domain *d,
unsigned long gfn,
- uint16_t flags)
+ bool destroy)
{
p2m_type_t p2mt;
mfn_t mfn;
* If the GFN is getting destroyed drop the references to MFN
* (possibly freeing the page), and exit early.
*/
- if ( flags & MEM_SHARING_DESTROY_GFN )
+ if ( destroy )
{
if ( !last_gfn )
mem_sharing_gfn_destroy(page, d, gfn_info);
mfn = p2m->get_entry(p2m, _gfn(gfn), &t, &a, 0, NULL, NULL);
if ( mfn_valid(mfn) && p2m_is_shared(t) )
{
- /* Does not fail with ENOMEM given the DESTROY flag */
- BUG_ON(__mem_sharing_unshare_page(
- d, gfn, MEM_SHARING_DESTROY_GFN));
+ /* Does not fail with ENOMEM given "destroy" is set to true */
+ BUG_ON(__mem_sharing_unshare_page(d, gfn, true));
/*
* Clear out the p2m entry so no one else may try to
* unshare. Must succeed: we just read the old entry and
unsigned int mem_sharing_get_nr_saved_mfns(void);
unsigned int mem_sharing_get_nr_shared_mfns(void);
-#define MEM_SHARING_DESTROY_GFN (1<<1)
/* Only fails with -ENOMEM. Enforce it with a BUG_ON wrapper. */
int __mem_sharing_unshare_page(struct domain *d,
unsigned long gfn,
- uint16_t flags);
+ bool destroy);
static inline int mem_sharing_unshare_page(struct domain *d,
unsigned long gfn)
{
- int rc = __mem_sharing_unshare_page(d, gfn, 0);
+ int rc = __mem_sharing_unshare_page(d, gfn, false);
BUG_ON(rc && (rc != -ENOMEM));
return rc;
}