[PATCH 2/4] efi_runtime: Refactor ioctl code into helper functions
Borislav Petkov
bp at alien8.de
Fri Apr 4 07:34:56 UTC 2014
On Thu, Apr 03, 2014 at 03:23:21PM +0100, Matt Fleming wrote:
> From: Matt Fleming <matt.fleming at intel.com>
>
> efi_runtime_ioctl() has grown to be fairly unwieldy because it includes
> all the data objects and logic in one place. Make use of helper
> functions for each of the ioctl commands to make the code easier to read
> and maintain.
>
> There is no intended change to functionality, just code movement.
>
> Signed-off-by: Matt Fleming <matt.fleming at intel.com>
> ---
> efi_runtime/efi_runtime.c | 419 +++++++++++++++++++++++++++-------------------
> 1 file changed, 246 insertions(+), 173 deletions(-)
>
> diff --git a/efi_runtime/efi_runtime.c b/efi_runtime/efi_runtime.c
> index db46f1112597..94be99a0092d 100644
> --- a/efi_runtime/efi_runtime.c
> +++ b/efi_runtime/efi_runtime.c
...
> +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,1,0)
> + case EFI_RUNTIME_QUERY_VARIABLEINFO:
> + return efi_runtime_query_variableinfo(arg);
> +#endif
This #if thing is once here and also around
efi_runtime_query_variableinfo(). Wouldn't it be cleaner to put inside
the function?
In this case, even for older kernels, the function will be there
but return immediately, maybe even return an error code to say "not
implemented/supported" or so...
>
> - if (put_user(status, pquerycapsulecapabilities->status))
> - return -EFAULT;
> - if (status != EFI_SUCCESS)
> - return -EINVAL;
> + case EFI_RUNTIME_GET_NEXTHIGHMONOTONICCOUNT:
> + return efi_runtime_get_nexthighmonocount(arg);
>
> - return 0;
> +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,1,0)
> + case EFI_RUNTIME_QUERY_CAPSULECAPABILITIES:
> + return efi_runtime_query_capsulecaps(arg);
> #endif
Same here. Maybe it would be cleaner to hide that ifdeffery as much as
possible. Maybe in a patch on-top, as this one is a code reorg only.
Thanks.
--
Regards/Gruss,
Boris.
Sent from a fat crate under my desk. Formatting is fine.
--
More information about the fwts-devel
mailing list