($INBOX_DIR/description missing)
 help / color / mirror / Atom feed
From: Andrew Zaborowski <andrew.zaborowski at intel.com>
To: ell at lists.01.org
Subject: [PATCH 02/15] netconfig: Avoid returning internal l_queues
Date: Fri, 20 May 2022 17:43:25 +0200	[thread overview]
Message-ID: <20220520154338.2056273-2-andrew.zaborowski@intel.com> (raw)
In-Reply-To: 20220520154338.2056273-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 8026c81..2a1b3ed 100644
--- a/ell/netconfig.c
+++ b/ell/netconfig.c
@@ -1249,37 +1249,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 a50a895..7796a2f 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-05-20 15:43 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=20220520154338.2056273-2-andrew.zaborowski@intel.com \
    --to=ell@lists.linux.dev \
    /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 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 read-only IMAP folder(s) and NNTP newsgroup(s).