From: Andrew Zaborowski <andrew.zaborowski at intel.com>
To: ell at lists.01.org
Subject: [PATCH 06/17] netconfig: Avoid returning internal l_queues
Date: Sat, 14 May 2022 00:47:02 +0200 [thread overview]
Message-ID: <20220513224713.1447773-6-andrew.zaborowski@intel.com> (raw)
In-Reply-To: 20220513224713.1447773-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 990b166..94d3ed1 100644
--- a/ell/netconfig.c
+++ b/ell/netconfig.c
@@ -1231,37 +1231,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 f90ec81..d58dda1 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;
@@ -83,14 +83,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
next reply other threads:[~2022-05-13 22:47 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-13 22:47 Andrew Zaborowski [this message]
-- strict thread matches above, loose matches on Subject: below --
2022-05-18 18:54 [PATCH 06/17] netconfig: Avoid returning internal l_queues Denis Kenzior
2022-05-13 14:54 Andrew Zaborowski
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=20220513224713.1447773-6-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).