On 29.11.2024 10:12, Luca Fancellu wrote:
> --- a/xen/include/xen/xvmalloc.h
> +++ b/xen/include/xen/xvmalloc.h
> @@ -40,20 +40,46 @@
>      ((typeof(ptr))_xvrealloc(ptr, offsetof(typeof(*(ptr)), field[nr]), \
>                               __alignof__(typeof(*(ptr)))))
>  
> +#ifdef CONFIG_HAS_VMAP
> +
>  /* Free any of the above. */
>  void xvfree(void *va);
>  
> +/* Underlying functions */
> +void *_xvmalloc(size_t size, unsigned int align);
> +void *_xvzalloc(size_t size, unsigned int align);
> +void *_xvrealloc(void *va, size_t size, unsigned int align);
> +
> +#else /* !CONFIG_HAS_VMAP */
> +
> +static inline void xvfree(void *va)
> +{
> +    xfree(va);
> +}
> +
> +static inline void *_xvmalloc(size_t size, unsigned int align)
> +{
> +    return _xmalloc(size, align);
> +}
> +
> +static inline void *_xvzalloc(size_t size, unsigned int align)
> +{
> +    return _xzalloc(size, align);
> +}
> +
> +static inline void *_xvrealloc(void *va, size_t size, unsigned int align)
> +{
> +    return _xrealloc(va, size, align);
> +}

Just to double check: Was it at least considered to use simple #define-s
to effect the aliasing? Wrapper functions like the above ones have the
downside of needing touching (easy to miss) when the wrapped function
types change in whichever minor way. (And yes, I do understand that we
generally aim at using inline functions in preference to macros.)

Jan

Reply via email to