All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Zaborowski <andrew.zaborowski at intel.com>
To: ell at lists.01.org
Subject: [PATCH 3/8] netconfig: Avoid returning internal l_queues
Date: Fri, 15 Apr 2022 20:32:06 +0200	[thread overview]
Message-ID: <20220415183211.987345-3-andrew.zaborowski@intel.com> (raw)
In-Reply-To: 20220415183211.987345-1-andrew.zaborowski@intel.com

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

Return const struct l_queue_entry pointers instead.
---
 ell/netconfig.c | 35 ++++++++++++++++++-----------------
 ell/netconfig.h | 20 +++++++++++---------
 2 files changed, 29 insertions(+), 26 deletions(-)

diff --git a/ell/netconfig.c b/ell/netconfig.c
index 72495ec..eb74aa5 100644
--- a/ell/netconfig.c
+++ b/ell/netconfig.c
@@ -1134,37 +1134,38 @@ LIB_EXPORT void l_netconfig_apply_rtnl(struct l_netconfig *netconfig,
 					NULL, NULL, NULL);
 }
 
-LIB_EXPORT struct l_queue *l_netconfig_get_addresses(
-						struct l_netconfig *netconfig,
-						struct l_queue **out_added,
-						struct l_queue **out_updated,
-						struct l_queue **out_removed)
+LIB_EXPORT const struct l_queue_entry *l_netconfig_get_addresses(
+					struct l_netconfig *netconfig,
+					const struct l_queue_entry **out_added,
+					const struct l_queue_entry **out_updated,
+					const struct l_queue_entry **out_removed)
 {
 	if (out_added)
-		*out_added = netconfig->addresses.added;
+		*out_added = l_queue_get_entries(netconfig->addresses.added);
 
 	if (out_updated)
-		*out_updated = netconfig->addresses.updated;
+		*out_updated = l_queue_get_entries(netconfig->addresses.updated);
 
 	if (out_removed)
-		*out_removed = netconfig->addresses.removed;
+		*out_removed = l_queue_get_entries(netconfig->addresses.removed);
 
-	return netconfig->addresses.current;
+	return l_queue_get_entries(netconfig->addresses.current);
 }
 
-LIB_EXPORT struct l_queue *l_netconfig_get_routes(struct l_netconfig *netconfig,
-						struct l_queue **out_added,
-						struct l_queue **out_updated,
-						struct l_queue **out_removed)
+LIB_EXPORT const struct l_queue_entry *l_netconfig_get_routes(
+					struct l_netconfig *netconfig,
+					const struct l_queue_entry **out_added,
+					const struct l_queue_entry **out_updated,
+					const struct l_queue_entry **out_removed)
 {
 	if (out_added)
-		*out_added = netconfig->routes.added;
+		*out_added = l_queue_get_entries(netconfig->routes.added);
 
 	if (out_updated)
-		*out_updated = netconfig->routes.updated;
+		*out_updated = l_queue_get_entries(netconfig->routes.updated);
 
 	if (out_removed)
-		*out_removed = netconfig->routes.removed;
+		*out_removed = l_queue_get_entries(netconfig->routes.removed);
 
-	return netconfig->routes.current;
+	return l_queue_get_entries(netconfig->routes.current);
 }
diff --git a/ell/netconfig.h b/ell/netconfig.h
index dc56bcb..b94107c 100644
--- a/ell/netconfig.h
+++ b/ell/netconfig.h
@@ -33,7 +33,7 @@ struct l_dhcp_client;
 struct l_dhcp6_client;
 struct l_icmp6_client;
 struct l_netlink;
-struct l_queue;
+struct l_queue_entry;
 struct l_netconfig;
 struct l_rtnl_address;
 struct l_rtnl_route;
@@ -87,14 +87,16 @@ void l_netconfig_set_event_handler(struct l_netconfig *netconfig,
 
 void l_netconfig_apply_rtnl(struct l_netconfig *netconfig,
 				struct l_netlink *rtnl);
-struct l_queue *l_netconfig_get_addresses(struct l_netconfig *netconfig,
-					struct l_queue **out_added,
-					struct l_queue **out_updated,
-					struct l_queue **out_removed);
-struct l_queue *l_netconfig_get_routes(struct l_netconfig *netconfig,
-					struct l_queue **out_added,
-					struct l_queue **out_updated,
-					struct l_queue **out_removed);
+const struct l_queue_entry *l_netconfig_get_addresses(
+				struct l_netconfig *netconfig,
+				const struct l_queue_entry **out_added,
+				const struct l_queue_entry **out_updated,
+				const struct l_queue_entry **out_removed);
+const struct l_queue_entry *l_netconfig_get_routes(
+				struct l_netconfig *netconfig,
+				const struct l_queue_entry **out_added,
+				const struct l_queue_entry **out_updated,
+				const struct l_queue_entry **out_removed);
 
 #ifdef __cplusplus
 }
-- 
2.32.0

                 reply	other threads:[~2022-04-15 18:32 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220415183211.987345-3-andrew.zaborowski@intel.com \
    --to=unknown@example.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.