All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] efi: mark input variables to funcs as const
@ 2015-12-05 20:25 Doug Goldstein
  2015-12-07 10:46 ` Jan Beulich
  0 siblings, 1 reply; 2+ messages in thread
From: Doug Goldstein @ 2015-12-05 20:25 UTC (permalink / raw)
  To: xen-devel; +Cc: Doug Goldstein, Jan Beulich

Variables that are input (IN) variables to EFI functions should be
marked as const. Just avoid potential problems of changing data that
shouldn't be changed.

Signed-off-by: Doug Goldstein <cardoe@cardoe.com>
---

So I find myself constantly doing something similar to this when
troubleshooting EFI because I like to put print statements to see data
and figure out where problems are. The EFI print functions all take const
data but much of the data is not marked as const. If you don't like this
that's fine but I was looking at the 3 different EFI branches I have locally
and this change is in all 3 in one shape or another.

---
 xen/include/efi/efidef.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/include/efi/efidef.h b/xen/include/efi/efidef.h
index 86a7e11..1d1c779 100644
--- a/xen/include/efi/efidef.h
+++ b/xen/include/efi/efidef.h
@@ -50,7 +50,7 @@ typedef VOID            *EFI_EVENT;
 //
 
 #ifndef IN
-    #define IN
+    #define IN const
     #define OUT
     #define OPTIONAL
 #endif
-- 
2.4.10

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] efi: mark input variables to funcs as const
  2015-12-05 20:25 [PATCH] efi: mark input variables to funcs as const Doug Goldstein
@ 2015-12-07 10:46 ` Jan Beulich
  0 siblings, 0 replies; 2+ messages in thread
From: Jan Beulich @ 2015-12-07 10:46 UTC (permalink / raw)
  To: Doug Goldstein; +Cc: xen-devel

>>> On 05.12.15 at 21:25, <cardoe@cardoe.com> wrote:
> Variables that are input (IN) variables to EFI functions should be
> marked as const. Just avoid potential problems of changing data that
> shouldn't be changed.

I don't think this is correct (there's no reason for a function to not
use its input arguments as variables), and it certainly should come
from upstream (i.e. UEFI -> gnu-efi -> Xen) if really meant to be
done this way. Also I think if you want this for debugging purposes,
overriding IN, OUT, and OPTIONAL in the source file(s) as intended
by the surrounding #ifdef would be the way to go.

Jan

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-12-07 10:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-12-05 20:25 [PATCH] efi: mark input variables to funcs as const Doug Goldstein
2015-12-07 10:46 ` Jan Beulich

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.