ell.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/8] dhcp6-lease: Make getters argument const, cleanup
@ 2022-04-15 18:32 Andrew Zaborowski
  0 siblings, 0 replies; 2+ messages in thread
From: Andrew Zaborowski @ 2022-04-15 18:32 UTC (permalink / raw)
  To: ell

[-- Attachment #1: Type: text/plain, Size: 3823 bytes --]

Add "const" to the lifetime getters argument, drop dhcp6-private.h
declarations I probably added/renamed by mistake.
---
 ell/dhcp6-lease.c   | 13 +++++++------
 ell/dhcp6-private.h |  7 ++-----
 ell/dhcp6.h         |  7 ++++---
 3 files changed, 13 insertions(+), 14 deletions(-)

diff --git a/ell/dhcp6-lease.c b/ell/dhcp6-lease.c
index 6109af1..978176a 100644
--- a/ell/dhcp6-lease.c
+++ b/ell/dhcp6-lease.c
@@ -373,7 +373,7 @@ LIB_EXPORT uint8_t l_dhcp6_lease_get_prefix_length(
 }
 
 #define PICK_IA() \
-	struct dhcp6_ia *ia;		\
+	const struct dhcp6_ia *ia;	\
 					\
 	if (lease->have_na)		\
 		ia = &lease->ia_na;	\
@@ -382,7 +382,7 @@ LIB_EXPORT uint8_t l_dhcp6_lease_get_prefix_length(
 	else				\
 		return 0		\
 
-uint32_t _dhcp6_lease_get_t1(struct l_dhcp6_lease *lease)
+uint32_t _dhcp6_lease_get_t1(const struct l_dhcp6_lease *lease)
 {
 	PICK_IA();
 
@@ -395,7 +395,7 @@ uint32_t _dhcp6_lease_get_t1(struct l_dhcp6_lease *lease)
 	return ia->info.valid_lifetime / 2;
 }
 
-uint32_t _dhcp6_lease_get_t2(struct l_dhcp6_lease *lease)
+uint32_t _dhcp6_lease_get_t2(const struct l_dhcp6_lease *lease)
 {
 	PICK_IA();
 
@@ -409,7 +409,7 @@ uint32_t _dhcp6_lease_get_t2(struct l_dhcp6_lease *lease)
 }
 
 LIB_EXPORT uint32_t l_dhcp6_lease_get_valid_lifetime(
-						struct l_dhcp6_lease *lease)
+					const struct l_dhcp6_lease *lease)
 {
 	if (unlikely(!lease))
 		return 0;
@@ -421,7 +421,7 @@ LIB_EXPORT uint32_t l_dhcp6_lease_get_valid_lifetime(
 }
 
 LIB_EXPORT uint32_t l_dhcp6_lease_get_preferred_lifetime(
-						struct l_dhcp6_lease *lease)
+					const struct l_dhcp6_lease *lease)
 {
 	if (unlikely(!lease))
 		return 0;
@@ -433,7 +433,8 @@ LIB_EXPORT uint32_t l_dhcp6_lease_get_preferred_lifetime(
 }
 
 /* Get the reception timestamp, i.e. when lifetimes are counted from */
-LIB_EXPORT uint64_t l_dhcp6_lease_get_start_time(struct l_dhcp6_lease *lease)
+LIB_EXPORT uint64_t l_dhcp6_lease_get_start_time(
+					const struct l_dhcp6_lease *lease)
 {
 	if (unlikely(!lease))
 		return 0;
diff --git a/ell/dhcp6-private.h b/ell/dhcp6-private.h
index 52f4002..6b33e34 100644
--- a/ell/dhcp6-private.h
+++ b/ell/dhcp6-private.h
@@ -148,8 +148,5 @@ void _dhcp6_lease_free(struct l_dhcp6_lease *lease);
 struct l_dhcp6_lease *_dhcp6_lease_parse_options(
 					struct dhcp6_option_iter *iter,
 					const uint8_t expected_iaid[static 4]);
-uint32_t _dhcp6_lease_get_t1(struct l_dhcp6_lease *lease);
-uint32_t _dhcp6_lease_get_t2(struct l_dhcp6_lease *lease);
-uint32_t dhcp6_lease_get_valid_lifetime(struct l_dhcp6_lease *lease);
-uint32_t dhcp6_lease_get_preferred_lifetime(struct l_dhcp6_lease *lease);
-uint32_t dhcp6_lease_get_start_time(struct l_dhcp6_lease *lease);
+uint32_t _dhcp6_lease_get_t1(const struct l_dhcp6_lease *lease);
+uint32_t _dhcp6_lease_get_t2(const struct l_dhcp6_lease *lease);
diff --git a/ell/dhcp6.h b/ell/dhcp6.h
index 9819fad..5086a74 100644
--- a/ell/dhcp6.h
+++ b/ell/dhcp6.h
@@ -94,9 +94,10 @@ char *l_dhcp6_lease_get_address(const struct l_dhcp6_lease *lease);
 char **l_dhcp6_lease_get_dns(const struct l_dhcp6_lease *lease);
 char **l_dhcp6_lease_get_domains(const struct l_dhcp6_lease *lease);
 uint8_t l_dhcp6_lease_get_prefix_length(const struct l_dhcp6_lease *lease);
-uint32_t l_dhcp6_lease_get_valid_lifetime(struct l_dhcp6_lease *lease);
-uint32_t l_dhcp6_lease_get_preferred_lifetime(struct l_dhcp6_lease *lease);
-uint64_t l_dhcp6_lease_get_start_time(struct l_dhcp6_lease *lease);
+uint32_t l_dhcp6_lease_get_valid_lifetime(const struct l_dhcp6_lease *lease);
+uint32_t l_dhcp6_lease_get_preferred_lifetime(
+					const struct l_dhcp6_lease *lease);
+uint64_t l_dhcp6_lease_get_start_time(const struct l_dhcp6_lease *lease);
 
 #ifdef __cplusplus
 }
-- 
2.32.0

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

* Re: [PATCH 1/8] dhcp6-lease: Make getters argument const, cleanup
@ 2022-04-18 16:17 Denis Kenzior
  0 siblings, 0 replies; 2+ messages in thread
From: Denis Kenzior @ 2022-04-18 16:17 UTC (permalink / raw)
  To: ell

[-- Attachment #1: Type: text/plain, Size: 418 bytes --]

Hi Andrew,

On 4/15/22 13:32, Andrew Zaborowski wrote:
> Add "const" to the lifetime getters argument, drop dhcp6-private.h
> declarations I probably added/renamed by mistake.
> ---
>   ell/dhcp6-lease.c   | 13 +++++++------
>   ell/dhcp6-private.h |  7 ++-----
>   ell/dhcp6.h         |  7 ++++---
>   3 files changed, 13 insertions(+), 14 deletions(-)
> 

Patch 1,2 applied, thanks.

Regards,
-Denis

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

end of thread, other threads:[~2022-04-18 16:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-15 18:32 [PATCH 1/8] dhcp6-lease: Make getters argument const, cleanup Andrew Zaborowski
2022-04-18 16:17 Denis Kenzior

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).