Re: [Xen-devel] [PATCH 4/8] gnttab: drop pointless leading double underscores

2017-08-15 Thread Andrew Cooper
On 15/08/17 15:40, Jan Beulich wrote:
> They're violating name space rules, and we don't really need them. When
> followed by "gnttab_", also drop that.
>
> Signed-by: Jan Beulich 
>
> --- a/xen/common/grant_table.c
> +++ b/xen/common/grant_table.c
> @@ -233,8 +233,9 @@ static inline void active_entry_release(
> If rc == GNTST_okay, *page contains the page struct with a ref taken.
> Caller must do put_page(*page).
> If any error, *page = NULL, *frame = INVALID_MFN, no ref taken. */
> -static int __get_paged_frame(unsigned long gfn, unsigned long *frame, struct 
> page_info **page,
> -int readonly, struct domain *rd)
> +static int get_paged_frame(unsigned long gfn, unsigned long *frame,
> +   struct page_info **page, bool readonly,
> +   struct domain *rd)
>  {
>  int rc = GNTST_okay;
>  #if defined(P2M_PAGED_TYPES) || defined(P2M_SHARED_TYPES)
> @@ -300,7 +301,7 @@ double_gt_unlock(struct grant_table *lgt
>  #define INVALID_MAPTRACK_HANDLE UINT_MAX
>  
>  static inline grant_handle_t
> -__get_maptrack_handle(
> +_get_maptrack_handle(
>  struct grant_table *t,
>  struct vcpu *v)

Any chance of coalescent these parameters?  Theres no need for 4 lines
here, or in similar cases below.

Otherwise, Reviewed-by: Andrew Cooper 

___
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel


[Xen-devel] [PATCH 4/8] gnttab: drop pointless leading double underscores

2017-08-15 Thread Jan Beulich
They're violating name space rules, and we don't really need them. When
followed by "gnttab_", also drop that.

Signed-by: Jan Beulich 

--- a/xen/common/grant_table.c
+++ b/xen/common/grant_table.c
@@ -233,8 +233,9 @@ static inline void active_entry_release(
If rc == GNTST_okay, *page contains the page struct with a ref taken.
Caller must do put_page(*page).
If any error, *page = NULL, *frame = INVALID_MFN, no ref taken. */
-static int __get_paged_frame(unsigned long gfn, unsigned long *frame, struct 
page_info **page,
-int readonly, struct domain *rd)
+static int get_paged_frame(unsigned long gfn, unsigned long *frame,
+   struct page_info **page, bool readonly,
+   struct domain *rd)
 {
 int rc = GNTST_okay;
 #if defined(P2M_PAGED_TYPES) || defined(P2M_SHARED_TYPES)
@@ -300,7 +301,7 @@ double_gt_unlock(struct grant_table *lgt
 #define INVALID_MAPTRACK_HANDLE UINT_MAX
 
 static inline grant_handle_t
-__get_maptrack_handle(
+_get_maptrack_handle(
 struct grant_table *t,
 struct vcpu *v)
 {
@@ -361,7 +362,7 @@ static grant_handle_t steal_maptrack_han
 {
 grant_handle_t handle;
 
-handle = __get_maptrack_handle(t, currd->vcpu[i]);
+handle = _get_maptrack_handle(t, currd->vcpu[i]);
 if ( handle != INVALID_MAPTRACK_HANDLE )
 {
 maptrack_entry(t, handle).vcpu = curr->vcpu_id;
@@ -415,7 +416,7 @@ get_maptrack_handle(
 grant_handle_thandle;
 struct grant_mapping *new_mt = NULL;
 
-handle = __get_maptrack_handle(lgt, curr);
+handle = _get_maptrack_handle(lgt, curr);
 if ( likely(handle != INVALID_MAPTRACK_HANDLE) )
 return handle;
 
@@ -770,7 +771,7 @@ static unsigned int mapkind(
  * update, as indicated by the GNTMAP_contains_pte flag.
  */
 static void
-__gnttab_map_grant_ref(
+map_grant_ref(
 struct gnttab_map_grant_ref *op)
 {
 struct domain *ld, *rd, *owner = NULL;
@@ -869,8 +870,8 @@ __gnttab_map_grant_ref(
 shared_entry_v1(rgt, op->ref).frame :
 shared_entry_v2(rgt, op->ref).full_page.frame;
 
-rc = __get_paged_frame(gfn, &frame, &pg, 
-!!(op->flags & GNTMAP_readonly), rd);
+rc = get_paged_frame(gfn, &frame, &pg,
+ op->flags & GNTMAP_readonly, rd);
 if ( rc != GNTST_okay )
 goto unlock_out_clear;
 act->gfn = gfn;
@@ -900,7 +901,7 @@ __gnttab_map_grant_ref(
 active_entry_release(act);
 grant_read_unlock(rgt);
 
-/* pg may be set, with a refcount included, from __get_paged_frame */
+/* pg may be set, with a refcount included, from get_paged_frame(). */
 if ( !pg )
 {
 pg = mfn_valid(_mfn(frame)) ? mfn_to_page(frame) : NULL;
@@ -1109,7 +1110,7 @@ gnttab_map_grant_ref(
 return i;
 if ( unlikely(__copy_from_guest_offset(&op, uop, i, 1)) )
 return -EFAULT;
-__gnttab_map_grant_ref(&op);
+map_grant_ref(&op);
 if ( unlikely(__copy_to_guest_offset(uop, i, &op, 1)) )
 return -EFAULT;
 }
@@ -1118,7 +1119,7 @@ gnttab_map_grant_ref(
 }
 
 static void
-__gnttab_unmap_common(
+unmap_common(
 struct gnttab_unmap_common *op)
 {
 domid_t  dom;
@@ -1178,8 +1179,8 @@ __gnttab_unmap_common(
 /*
  * This ought to be impossible, as such a mapping should not have
  * been established (see the nr_grant_entries(rgt) bounds check in
- * __gnttab_map_grant_ref()). Doing this check only in
- * __gnttab_unmap_common_complete() - as it used to be done - would,
+ * gnttab_map_grant_ref()). Doing this check only in
+ * gnttab_unmap_common_complete() - as it used to be done - would,
  * however, be too late.
  */
 rc = GNTST_bad_gntref;
@@ -1293,7 +1294,7 @@ __gnttab_unmap_common(
 }
 
 static void
-__gnttab_unmap_common_complete(struct gnttab_unmap_common *op)
+unmap_common_complete(struct gnttab_unmap_common *op)
 {
 struct domain *ld, *rd = op->rd;
 struct grant_table *rgt;
@@ -1304,7 +1305,7 @@ __gnttab_unmap_common_complete(struct gn
 
 if ( !op->done )
 { 
-/* __gntab_unmap_common() didn't do anything - nothing to complete. */
+/* unmap_common() didn't do anything - nothing to complete. */
 return;
 }
 
@@ -1373,7 +1374,7 @@ __gnttab_unmap_common_complete(struct gn
 }
 
 static void
-__gnttab_unmap_grant_ref(
+unmap_grant_ref(
 struct gnttab_unmap_grant_ref *op,
 struct gnttab_unmap_common *common)
 {
@@ -1387,7 +1388,7 @@ __gnttab_unmap_grant_ref(
 common->rd = NULL;
 common->frame = 0;
 
-__gnttab_unmap_common(common);
+unmap_common(common);
 op->status = common->status;
 }
 
@@ -1409,7 +1410,7 @@ gnttab_unmap_grant_ref(
 {