mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] machine_id: Add getter of machine id hashables.
@ 2023-10-17 19:18 Christian Melki
  2023-10-18  8:20 ` Sascha Hauer
  0 siblings, 1 reply; 2+ messages in thread
From: Christian Melki @ 2023-10-17 19:18 UTC (permalink / raw)
  To: barebox

Add the possibility for reusing the registered
hashables for other functions beside machine id
and the truncated sha1 it offers.

Signed-off-by: Christian Melki <christian.melki@t2data.com>
---
 common/machine_id.c  | 5 +++++
 include/machine_id.h | 7 +++++++
 2 files changed, 12 insertions(+)

diff --git a/common/machine_id.c b/common/machine_id.c
index 8c273b9349..f0b148fb9b 100644
--- a/common/machine_id.c
+++ b/common/machine_id.c
@@ -16,6 +16,11 @@
 static void *__machine_id_hashable;
 static size_t __machine_id_hashable_length;
 
+const void *machine_id_get_hashable(size_t *len)
+{
+	*len = __machine_id_hashable_length;
+	return __machine_id_hashable;
+}
 
 void machine_id_set_hashable(const void *hashable, size_t len)
 {
diff --git a/include/machine_id.h b/include/machine_id.h
index e30bbada1a..9699e7f207 100644
--- a/include/machine_id.h
+++ b/include/machine_id.h
@@ -5,10 +5,17 @@
 
 #if IS_ENABLED(CONFIG_MACHINE_ID)
 
+const void *machine_id_get_hashable(size_t *len);
+
 void machine_id_set_hashable(const void *hashable, size_t len);
 
 #else
 
+static inline const void *machine_id_get_hashable(size_t *len)
+{
+	return NULL;
+}
+
 static inline void machine_id_set_hashable(const void *hashable, size_t len)
 {
 }
-- 
2.34.1




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

* Re: [PATCH] machine_id: Add getter of machine id hashables.
  2023-10-17 19:18 [PATCH] machine_id: Add getter of machine id hashables Christian Melki
@ 2023-10-18  8:20 ` Sascha Hauer
  0 siblings, 0 replies; 2+ messages in thread
From: Sascha Hauer @ 2023-10-18  8:20 UTC (permalink / raw)
  To: Christian Melki; +Cc: barebox

On Tue, Oct 17, 2023 at 09:18:33PM +0200, Christian Melki wrote:
> Add the possibility for reusing the registered
> hashables for other functions beside machine id
> and the truncated sha1 it offers.
> 
> Signed-off-by: Christian Melki <christian.melki@t2data.com>
> ---
>  common/machine_id.c  | 5 +++++
>  include/machine_id.h | 7 +++++++
>  2 files changed, 12 insertions(+)

Applied, thanks

Sascha

> 
> diff --git a/common/machine_id.c b/common/machine_id.c
> index 8c273b9349..f0b148fb9b 100644
> --- a/common/machine_id.c
> +++ b/common/machine_id.c
> @@ -16,6 +16,11 @@
>  static void *__machine_id_hashable;
>  static size_t __machine_id_hashable_length;
>  
> +const void *machine_id_get_hashable(size_t *len)
> +{
> +	*len = __machine_id_hashable_length;
> +	return __machine_id_hashable;
> +}
>  
>  void machine_id_set_hashable(const void *hashable, size_t len)
>  {
> diff --git a/include/machine_id.h b/include/machine_id.h
> index e30bbada1a..9699e7f207 100644
> --- a/include/machine_id.h
> +++ b/include/machine_id.h
> @@ -5,10 +5,17 @@
>  
>  #if IS_ENABLED(CONFIG_MACHINE_ID)
>  
> +const void *machine_id_get_hashable(size_t *len);
> +
>  void machine_id_set_hashable(const void *hashable, size_t len);
>  
>  #else
>  
> +static inline const void *machine_id_get_hashable(size_t *len)
> +{
> +	return NULL;
> +}
> +
>  static inline void machine_id_set_hashable(const void *hashable, size_t len)
>  {
>  }
> -- 
> 2.34.1
> 
> 
> 

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



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

end of thread, other threads:[~2023-10-18  8:22 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-17 19:18 [PATCH] machine_id: Add getter of machine id hashables Christian Melki
2023-10-18  8:20 ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox