On 15/11/2024 10:50 am, Luca Fancellu wrote:
> diff --git a/xen/include/xen/xvmalloc.h b/xen/include/xen/xvmalloc.h
> index 440d85a284bb..802be6687085 100644
> --- 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)))))
>
> +#if defined(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
> +
> +static inline void xvfree(void *va)
> +{
> + xfree(va);
> +}
> +
> +void *_xvmalloc(size_t size, unsigned int align)
> +{
> + return _xmalloc(size, align);
> +}
> +
> +void *_xvzalloc(size_t size, unsigned int align)
> +{
> + return _xzalloc(size, align);
> +}
> +
> +void *_xvrealloc(void *va, size_t size, unsigned int align)
> +{
> + return _xrealloc(va, size, align);
> +}
> +
> +#endif
Does this really compile with the wrappers not being static inline ?
That aside, could we not do this using conditional aliases, rather than
wrapping the functions? It would certainly be shorter, code wise.
~Andrew