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

Re: [Minios-devel] [UNIKRAFT PATCH] include/uk/arch: Rename ukarch_find_lsbit to ukarch_ffsl



Reviewed-by: Yuri Volchkov <yuri.volchkov@xxxxxxxxx>

Costin Lupu <costin.lupu@xxxxxxxxx> writes:

> A common convention for functions that find first set bit is to be named
> ffs. Keeping the old name would have brought confusion considering that
> the function that finds last set bit is usually called fls. Last l in
> the name stands for long.
>
> Signed-off-by: Costin Lupu <costin.lupu@xxxxxxxxx>
> ---
>  include/uk/arch/arm/atomic.h    | 4 ++--
>  include/uk/arch/x86_64/atomic.h | 4 ++--
>  lib/vfscore/fd.c                | 2 +-
>  plat/xen/hypervisor.c           | 4 ++--
>  4 files changed, 7 insertions(+), 7 deletions(-)
>
> diff --git a/include/uk/arch/arm/atomic.h b/include/uk/arch/arm/atomic.h
> index 9d54eea..93ac986 100644
> --- a/include/uk/arch/arm/atomic.h
> +++ b/include/uk/arch/arm/atomic.h
> @@ -32,12 +32,12 @@
>  #endif
>  
>  /**
> - * ukarch_find_lsbit - find first (lowest) set bit in word.
> + * ukarch_ffsl - find first (lowest) set bit in word.
>   * @word: The word to search
>   *
>   * Undefined if no bit exists, so code should check against 0 first.
>   */
> -static inline unsigned long ukarch_find_lsbit(unsigned long word)
> +static inline unsigned long ukarch_ffsl(unsigned long word)
>  {
>       int clz;
>  
> diff --git a/include/uk/arch/x86_64/atomic.h b/include/uk/arch/x86_64/atomic.h
> index 985c388..c5f30cc 100644
> --- a/include/uk/arch/x86_64/atomic.h
> +++ b/include/uk/arch/x86_64/atomic.h
> @@ -31,12 +31,12 @@
>  #endif
>  
>  /**
> - * ukarch_find_lsbit - find first (lowest) set bit in word.
> + * ukarch_ffsl - find first (lowest) set bit in word.
>   * @word: The word to search
>   *
>   * Undefined if no bit exists, so code should check against 0 first.
>   */
> -static inline unsigned long ukarch_find_lsbit(unsigned long word)
> +static inline unsigned long ukarch_ffsl(unsigned long word)
>  {
>       __asm__("bsfq %1,%0"
>               :"=r" (word)
> diff --git a/lib/vfscore/fd.c b/lib/vfscore/fd.c
> index 865a37a..07a69b5 100644
> --- a/lib/vfscore/fd.c
> +++ b/lib/vfscore/fd.c
> @@ -58,7 +58,7 @@ int vfscore_alloc_fd(void)
>       int ret;
>  
>       flags = ukplat_lcpu_save_irqf();
> -     ret = ukarch_find_lsbit(~fdtable.bitmap);
> +     ret = ukarch_ffsl(~fdtable.bitmap);
>  
>       if (!ret) {
>               ret = -ENFILE;
> diff --git a/plat/xen/hypervisor.c b/plat/xen/hypervisor.c
> index 4eca19d..ca16ed6 100644
> --- a/plat/xen/hypervisor.c
> +++ b/plat/xen/hypervisor.c
> @@ -70,11 +70,11 @@ void do_hypervisor_callback(struct __regs *regs)
>  #endif
>       l1 = ukarch_exchange_n(&vcpu_info->evtchn_pending_sel, 0);
>       while (l1 != 0) {
> -             l1i = ukarch_find_lsbit(l1);
> +             l1i = ukarch_ffsl(l1);
>               l1 &= ~(1UL << l1i);
>  
>               while ((l2 = active_evtchns(cpu, s, l1i)) != 0) {
> -                     l2i = ukarch_find_lsbit(l2);
> +                     l2i = ukarch_ffsl(l2);
>                       l2 &= ~(1UL << l2i);
>  
>                       port = (l1i * (sizeof(unsigned long) * 8)) + l2i;
> -- 
> 2.11.0
>

-- 
Yuri Volchkov
Software Specialist

NEC Europe Ltd
Kurfürsten-Anlage 36
D-69115 Heidelberg

_______________________________________________
Minios-devel mailing list
Minios-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/minios-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.