bug-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 12/14] mach-defpager: turn dealloc_direct into a normal funct


From: Samuel Thibault
Subject: Re: [PATCH 12/14] mach-defpager: turn dealloc_direct into a normal function
Date: Sat, 9 Nov 2013 19:16:09 +0100
User-agent: Mutt/1.5.21+34 (58baf7c9f32f) (2010-12-30)

Justus Winter, le Fri 08 Nov 2013 21:24:20 +0100, a écrit :
> * mach-defpager/default_pager.c (dealloc_direct): Move function
>   definition outside of pager_truncate.

Ack.

> ---
>  mach-defpager/default_pager.c |   45 
> +++++++++++++++++++++--------------------
>  1 file changed, 23 insertions(+), 22 deletions(-)
> 
> diff --git a/mach-defpager/default_pager.c b/mach-defpager/default_pager.c
> index b445590..9dad4c2 100644
> --- a/mach-defpager/default_pager.c
> +++ b/mach-defpager/default_pager.c
> @@ -1061,6 +1061,29 @@ pager_extend(pager, new_size)
>       pthread_mutex_unlock(&pager->lock);
>  }
>  
> +/* This deallocates the pages necessary to truncate a direct map
> +   previously of size NEW_SIZE to the smaller size OLD_SIZE.  */
> +static void
> +dealloc_direct (dp_map_t mapptr,
> +             vm_size_t old_size, vm_size_t new_size)
> +{
> +  vm_size_t i;
> +
> +  if (!mapptr)
> +    return;
> +
> +  for (i = new_size; i < old_size; ++i)
> +    {
> +      const union dp_map entry = mapptr[i];
> +      if (!no_block(entry))
> +     {
> +       pager_dealloc_page(entry.block.p_index, entry.block.p_offset,
> +                          TRUE);
> +       invalidate_block(mapptr[i]);
> +     }
> +    }
> +}
> +
>  /* Truncate a memory object.  First, any pages between the new size
>     and the (larger) old size are deallocated.  Then, the size of
>     the pagemap may be reduced, an indirect map may be turned into
> @@ -1075,28 +1098,6 @@ pager_truncate(dpager_t pager, vm_size_t new_size)     
> /* in pages */
>    int i;
>    vm_size_t old_size;
>  
> -  /* This deallocates the pages necessary to truncate a direct map
> -     previously of size NEW_SIZE to the smaller size OLD_SIZE.  */
> -  inline void dealloc_direct (dp_map_t mapptr,
> -                           vm_size_t old_size, vm_size_t new_size)
> -    {
> -      vm_size_t i;
> -
> -      if (!mapptr)
> -        return;
> -
> -      for (i = new_size; i < old_size; ++i)
> -     {
> -       const union dp_map entry = mapptr[i];
> -       if (!no_block(entry))
> -         {
> -           pager_dealloc_page(entry.block.p_index, entry.block.p_offset,
> -                              TRUE);
> -           invalidate_block(mapptr[i]);
> -         }
> -     }
> -    }
> -
>    pthread_mutex_lock(&pager->lock);  /* XXX lock_write */
>  
>    if (!pager->map)
> -- 
> 1.7.10.4
> 
> 

-- 
Samuel
Actually, typing random strings in the Finder does the equivalent of
filename completion.
(Discussion in comp.os.linux.misc on the intuitiveness of commands: file
completion vs. the Mac Finder.)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]