qemu-trivial
[Top][All Lists]
Advanced

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

Re: [PATCH trvivial] linux-user/syscall.c: replace function pointers for


From: Michael Tokarev
Subject: Re: [PATCH trvivial] linux-user/syscall.c: replace function pointers for flock64 fcntl with macros
Date: Mon, 9 Sep 2024 08:26:49 +0300
User-agent: Mozilla Thunderbird

08.09.2024 20:39, Richard Henderson wrote:
On 9/8/24 00:16, Michael Tokarev wrote:
For 32bit ARM fcntl64 syscall there are 2 possible argument types,
depending on cpu_env->eabi.  For other architectures, it is plain
struct flock64 in all cases.  In order to solve this, old code
used to take address of the conversion function and and run it
through this pointer.  Instead, introduce 2 helper macros for
the flock64 conversion, and define them in the same block where
the oabi conversion functions are defined, and use these
helpers directly in the actual code, making each part more
self-contained and easier to read.

Also add comment to the block of code which itroduces the oabi
conversion functions.

Note also there was an inconsistency in the old code: different
the differences in single place we eliminate this difference.

While at it, replace tabs with spaces in nearby code.

Signed-off-by: Michael Tokarev<mjt@tls.msk.ru>
---
  linux-user/syscall.c | 40 +++++++++++++++++++++++-----------------
  1 file changed, 23 insertions(+), 17 deletions(-)

Why do you think this is an improvement?

It just feels more natural, so to say.

What was wrong with the function pointers?

Not exactly wrong.  It just hurts my eyes when I see an address
is taken of a function marked `inline` (though I understand well
this keyword is just a hint and the compiler is free to omit
inlining).  Also the typedefs are a bit ugly.

I come through this place when removing remnants of LFS, and
disliked this way.

Thanks,

/mjt



reply via email to

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