qemu-devel
[Top][All Lists]
Advanced

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

Re: [PATCH v2] CODING_STYLE.rst: flesh out our naming conventions.


From: Cornelia Huck
Subject: Re: [PATCH v2] CODING_STYLE.rst: flesh out our naming conventions.
Date: Tue, 11 Aug 2020 13:56:11 +0200

On Tue, 11 Aug 2020 12:48:38 +0100
Alex Bennée <alex.bennee@linaro.org> wrote:

> If I re-arrange slightly we can roll from qemu_ to public functions:
> 
>   Function Naming Conventions
>   ---------------------------
> 
>   The ``qemu_`` prefix is used for utility functions that are widely
>   called from across the code-base. This includes wrapped versions of
>   standard library functions (e.g. ``qemu_strtol``) where the prefix is
>   added to the library function name to alert readers that they are
>   seeing a wrapped version.
> 
>   Public functions from a file or subsystem (declared in headers) tend
>   to have a consistent prefix to show where they came from. For example,
>   ``tlb_`` for functions from ``cputlb.c`` or ``cpu_`` for functions
>   from cpus.c.
> 
>   If there are two versions of a function to be called with or without a
>   lock held, the function that expects the lock to be already held
>   usually uses the suffix ``_locked``.
> 
> What do you think?

There naturally are places that don't follow the convention (for
example, hw/intc/s390_flic.c is using the qemu_ prefix to mark the
non-kvm functions), but this makes sense for new code. Looks good to me.




reply via email to

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