diff mbox series

mm: adjust get_page()'s types

Message ID ba4a5dcf-3d43-09bd-870e-46a540850cc3@suse.com (mailing list archive)
State New, archived
Headers show
Series mm: adjust get_page()'s types | expand

Commit Message

Jan Beulich Sept. 16, 2020, 7:28 a.m. UTC
The passed in domain doesn't get altered and hence can be const. While
modifying its prototype anyway, also switch to bool.

Signed-off-by: Jan Beulich <jbeulich@suse.com>

Comments

Roger Pau Monné Sept. 16, 2020, 7:47 a.m. UTC | #1
On Wed, Sep 16, 2020 at 09:28:47AM +0200, Jan Beulich wrote:
> The passed in domain doesn't get altered and hence can be const. While
> modifying its prototype anyway, also switch to bool.
> 
> Signed-off-by: Jan Beulich <jbeulich@suse.com>

Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>

Thanks, Roger.
Julien Grall Sept. 16, 2020, 7:49 a.m. UTC | #2
Hi Jan,

On 16/09/2020 08:28, Jan Beulich wrote:
> The passed in domain doesn't get altered and hence can be const. While
> modifying its prototype anyway, also switch to bool.

Reviewed-by: Julien Grall <jgrall@amazon.com>

Cheers,

> Signed-off-by: Jan Beulich <jbeulich@suse.com>
> 
> --- a/xen/arch/arm/mm.c
> +++ b/xen/arch/arm/mm.c
> @@ -1560,17 +1560,17 @@ void put_page(struct page_info *page)
>       }
>   }
>   
> -int get_page(struct page_info *page, struct domain *domain)
> +bool get_page(struct page_info *page, const struct domain *domain)
>   {
> -    struct domain *owner = page_get_owner_and_reference(page);
> +    const struct domain *owner = page_get_owner_and_reference(page);
>   
>       if ( likely(owner == domain) )
> -        return 1;
> +        return true;
>   
>       if ( owner != NULL )
>           put_page(page);
>   
> -    return 0;
> +    return false;
>   }
>   
>   /* Common code requires get_page_type and put_page_type.
> --- a/xen/arch/x86/mm.c
> +++ b/xen/arch/x86/mm.c
> @@ -2510,12 +2510,12 @@ struct domain *page_get_owner_and_refere
>   }
>   
>   
> -int get_page(struct page_info *page, struct domain *domain)
> +bool get_page(struct page_info *page, const struct domain *domain)
>   {
> -    struct domain *owner = page_get_owner_and_reference(page);
> +    const struct domain *owner = page_get_owner_and_reference(page);
>   
>       if ( likely(owner == domain) )
> -        return 1;
> +        return true;
>   
>       if ( !paging_mode_refcounts(domain) && !domain->is_dying )
>           gprintk(XENLOG_INFO,
> @@ -2526,7 +2526,7 @@ int get_page(struct page_info *page, str
>       if ( owner )
>           put_page(page);
>   
> -    return 0;
> +    return false;
>   }
>   
>   /*
> --- a/xen/include/xen/mm.h
> +++ b/xen/include/xen/mm.h
> @@ -151,7 +151,7 @@ TYPE_SAFE(unsigned long, pfn);
>   struct page_info;
>   
>   void put_page(struct page_info *);
> -int get_page(struct page_info *, struct domain *);
> +bool get_page(struct page_info *, const struct domain *);
>   struct domain *__must_check page_get_owner_and_reference(struct page_info *);
>   
>   /* Boot-time allocator. Turns into generic allocator after bootstrap. */
>
diff mbox series

Patch

--- a/xen/arch/arm/mm.c
+++ b/xen/arch/arm/mm.c
@@ -1560,17 +1560,17 @@  void put_page(struct page_info *page)
     }
 }
 
-int get_page(struct page_info *page, struct domain *domain)
+bool get_page(struct page_info *page, const struct domain *domain)
 {
-    struct domain *owner = page_get_owner_and_reference(page);
+    const struct domain *owner = page_get_owner_and_reference(page);
 
     if ( likely(owner == domain) )
-        return 1;
+        return true;
 
     if ( owner != NULL )
         put_page(page);
 
-    return 0;
+    return false;
 }
 
 /* Common code requires get_page_type and put_page_type.
--- a/xen/arch/x86/mm.c
+++ b/xen/arch/x86/mm.c
@@ -2510,12 +2510,12 @@  struct domain *page_get_owner_and_refere
 }
 
 
-int get_page(struct page_info *page, struct domain *domain)
+bool get_page(struct page_info *page, const struct domain *domain)
 {
-    struct domain *owner = page_get_owner_and_reference(page);
+    const struct domain *owner = page_get_owner_and_reference(page);
 
     if ( likely(owner == domain) )
-        return 1;
+        return true;
 
     if ( !paging_mode_refcounts(domain) && !domain->is_dying )
         gprintk(XENLOG_INFO,
@@ -2526,7 +2526,7 @@  int get_page(struct page_info *page, str
     if ( owner )
         put_page(page);
 
-    return 0;
+    return false;
 }
 
 /*
--- a/xen/include/xen/mm.h
+++ b/xen/include/xen/mm.h
@@ -151,7 +151,7 @@  TYPE_SAFE(unsigned long, pfn);
 struct page_info;
 
 void put_page(struct page_info *);
-int get_page(struct page_info *, struct domain *);
+bool get_page(struct page_info *, const struct domain *);
 struct domain *__must_check page_get_owner_and_reference(struct page_info *);
 
 /* Boot-time allocator. Turns into generic allocator after bootstrap. */