[PATCH v2 1/3] watchlist: added watchlist functionality
by James Prestwood
These two files (watchlist.[ch]) were copied from IWD, and public
API's changed to l_ prefix.
---
Makefile.am | 6 +-
ell/ell.h | 1 +
ell/watchlist.c | 149 ++++++++++++++++++++++++++++++++++++++++++++++++
ell/watchlist.h | 129 +++++++++++++++++++++++++++++++++++++++++
4 files changed, 283 insertions(+), 2 deletions(-)
create mode 100644 ell/watchlist.c
create mode 100644 ell/watchlist.h
diff --git a/Makefile.am b/Makefile.am
index 0a8d0f6..31612a7 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -48,7 +48,8 @@ pkginclude_HEADERS = ell/ell.h \
ell/file.h \
ell/dir.h \
ell/net.h \
- ell/dhcp.h
+ ell/dhcp.h \
+ ell/watchlist.h
lib_LTLIBRARIES = ell/libell.la
@@ -109,7 +110,8 @@ ell_libell_la_SOURCES = $(linux_headers) \
ell/dhcp-private.h \
ell/dhcp.c \
ell/dhcp-transport.c \
- ell/dhcp-lease.c
+ ell/dhcp-lease.c \
+ ell/watchlist.c
ell_libell_la_LDFLAGS = -no-undefined \
-Wl,--version-script=$(top_srcdir)/ell/ell.sym \
diff --git a/ell/ell.h b/ell/ell.h
index ba1928d..0d8e74e 100644
--- a/ell/ell.h
+++ b/ell/ell.h
@@ -56,3 +56,4 @@
#include <ell/dbus-service.h>
#include <ell/dbus-client.h>
#include <ell/dhcp.h>
+#include <ell/watchlist.h>
diff --git a/ell/watchlist.c b/ell/watchlist.c
new file mode 100644
index 0000000..d300756
--- /dev/null
+++ b/ell/watchlist.c
@@ -0,0 +1,149 @@
+/*
+ *
+ * Wireless daemon for Linux
+ *
+ * Copyright (C) 2016 Intel Corporation. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <ell/ell.h>
+
+static bool watchlist_item_match(const void *a, const void *b)
+{
+ const struct l_watchlist_item *item = a;
+ uint32_t id = L_PTR_TO_UINT(b);
+
+ return item->id == id;
+}
+
+static void __watchlist_item_free(struct l_watchlist *watchlist,
+ struct l_watchlist_item *item)
+{
+ if (item->destroy)
+ item->destroy(item->notify_data);
+
+ if (watchlist->ops && watchlist->ops->item_free)
+ watchlist->ops->item_free(item);
+ else
+ l_free(item);
+}
+
+struct l_watchlist *l_watchlist_new(const struct l_watchlist_ops *ops)
+{
+ struct l_watchlist *watchlist;
+
+ watchlist = l_new(struct l_watchlist, 1);
+ watchlist->items = l_queue_new();
+ watchlist->ops = ops;
+ return watchlist;
+}
+
+void l_watchlist_init(struct l_watchlist *watchlist,
+ const struct l_watchlist_ops *ops)
+{
+ watchlist->next_id = 0;
+ watchlist->items = l_queue_new();
+ watchlist->ops = ops;
+}
+
+unsigned int l_watchlist_link(struct l_watchlist *watchlist,
+ struct l_watchlist_item *item,
+ void *notify, void *notify_data,
+ l_watchlist_item_destroy_func_t destroy)
+{
+ item->id = ++watchlist->next_id;
+ item->notify = notify;
+ item->notify_data = notify_data;
+ item->destroy = destroy;
+
+ l_queue_push_tail(watchlist->items, item);
+
+ return item->id;
+}
+
+unsigned int l_watchlist_add(struct l_watchlist *watchlist, void *notify,
+ void *notify_data,
+ l_watchlist_item_destroy_func_t destroy)
+{
+ struct l_watchlist_item *item;
+
+ item = l_new(struct l_watchlist_item, 1);
+ return l_watchlist_link(watchlist, item, notify, notify_data, destroy);
+}
+
+bool l_watchlist_remove(struct l_watchlist *watchlist, unsigned int id)
+{
+ struct l_watchlist_item *item;
+
+ if (watchlist->in_notify) {
+ item = l_queue_find(watchlist->items, watchlist_item_match,
+ L_UINT_TO_PTR(id));
+ if (!item)
+ return false;
+
+ item->id = 0; /* Mark stale */
+ watchlist->stale_items = true;
+
+ return true;
+ }
+
+ item = l_queue_remove_if(watchlist->items, watchlist_item_match,
+ L_UINT_TO_PTR(id));
+ if (!item)
+ return false;
+
+ __watchlist_item_free(watchlist, item);
+
+ return true;
+}
+
+static void __watchlist_clear(struct l_watchlist *watchlist)
+{
+ struct l_watchlist_item *item;
+
+ while ((item = l_queue_pop_head(watchlist->items)))
+ __watchlist_item_free(watchlist, item);
+}
+
+void l_watchlist_destroy(struct l_watchlist *watchlist)
+{
+ __watchlist_clear(watchlist);
+ l_queue_destroy(watchlist->items, NULL);
+ watchlist->items = NULL;
+}
+
+void l_watchlist_free(struct l_watchlist *watchlist)
+{
+ __watchlist_clear(watchlist);
+ l_queue_destroy(watchlist->items, NULL);
+ l_free(watchlist);
+}
+
+void __watchlist_prune_stale(struct l_watchlist *watchlist)
+{
+ struct l_watchlist_item *item;
+
+ while ((item = l_queue_remove_if(watchlist->items, watchlist_item_match,
+ L_UINT_TO_PTR(0))))
+ __watchlist_item_free(watchlist, item);
+
+ watchlist->stale_items = false;
+}
diff --git a/ell/watchlist.h b/ell/watchlist.h
new file mode 100644
index 0000000..89a6374
--- /dev/null
+++ b/ell/watchlist.h
@@ -0,0 +1,129 @@
+/*
+ *
+ * Wireless daemon for Linux
+ *
+ * Copyright (C) 2016-2017 Intel Corporation. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+#ifndef __ELL_WATCHLIST_H
+#define __ELL_WATCHLIST_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef void (*l_watchlist_item_destroy_func_t)(void *data);
+
+struct l_watchlist_item {
+ unsigned int id;
+ void *notify;
+ void *notify_data;
+ l_watchlist_item_destroy_func_t destroy;
+};
+
+struct l_watchlist_ops {
+ void (*item_free)(struct l_watchlist_item *item);
+};
+
+struct l_watchlist {
+ int next_id;
+ struct l_queue *items;
+ bool in_notify : 1;
+ bool stale_items : 1;
+ const struct l_watchlist_ops *ops;
+};
+
+struct l_watchlist *l_watchlist_new(const struct l_watchlist_ops *ops);
+void l_watchlist_init(struct l_watchlist *watchlist,
+ const struct l_watchlist_ops *ops);
+unsigned int l_watchlist_add(struct l_watchlist *watchlist, void *notify,
+ void *notify_data,
+ l_watchlist_item_destroy_func_t destroy);
+unsigned int l_watchlist_link(struct l_watchlist *watchlist,
+ struct l_watchlist_item *item,
+ void *notify, void *notify_data,
+ l_watchlist_item_destroy_func_t destroy);
+bool l_watchlist_remove(struct l_watchlist *watchlist, unsigned int id);
+void l_watchlist_destroy(struct l_watchlist *watchlist);
+void l_watchlist_free(struct l_watchlist *watchlist);
+
+void __watchlist_prune_stale(struct l_watchlist *watchlist);
+
+#define L_WATCHLIST_NOTIFY(watchlist, type, args...) \
+ do { \
+ const struct l_queue_entry *entry = \
+ l_queue_get_entries((watchlist)->items);\
+ \
+ (watchlist)->in_notify = true; \
+ for (; entry; entry = entry->next) { \
+ struct l_watchlist_item *item = entry->data; \
+ type t = item->notify; \
+ if (item->id == 0) \
+ continue; \
+ t(args, item->notify_data); \
+ } \
+ (watchlist)->in_notify = false; \
+ if ((watchlist)->stale_items) \
+ __watchlist_prune_stale(watchlist); \
+ } while (false) \
+
+#define L_WATCHLIST_NOTIFY_MATCHES(watchlist, match, match_data, type, args...) \
+ do { \
+ const struct l_queue_entry *entry = \
+ l_queue_get_entries((watchlist)->items);\
+ \
+ (watchlist)->in_notify = true; \
+ for (; entry; entry = entry->next) { \
+ struct l_watchlist_item *item = entry->data; \
+ type t = item->notify; \
+ \
+ if (item->id == 0) \
+ continue; \
+ if (!match(item, match_data)) \
+ continue; \
+ \
+ t(args, item->notify_data); \
+ } \
+ (watchlist)->in_notify = false; \
+ if ((watchlist)->stale_items) \
+ __watchlist_prune_stale(watchlist); \
+ } while (false)
+
+#define L_WATCHLIST_NOTIFY_NO_ARGS(watchlist, type) \
+ do { \
+ const struct l_queue_entry *entry = \
+ l_queue_get_entries((watchlist)->items);\
+ \
+ (watchlist)->in_notify = true; \
+ for (; entry; entry = entry->next) { \
+ struct l_watchlist_item *item = entry->data; \
+ type t = item->notify; \
+ if (item->id == 0) \
+ continue; \
+ t(item->notify_data); \
+ } \
+ (watchlist)->in_notify = false; \
+ if ((watchlist)->stale_items) \
+ __watchlist_prune_stale(watchlist); \
+ } while (false)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __ELL_WATCHLIST_H */
\ No newline at end of file
--
2.17.1
2 years, 2 months
[PATCH 0/5] C99 related fixes
by Ossama Othman
This set of patches addresses some issues related to C library
features that were disabled, or were at least affected, by explicitly
enabling C99 in gcc via the -std=c99 command line option.
ELL itself won't build cleanly when constrained solely to C99. A
successful build in that case requires defining the appropriate
feature test macro(s) (e.g. _POSIX_SOURCE, _POSIX_C_SOURCE, etc)
either in ELL's config.h header, the build command line, or individual
source files that require the disabled C library feature.
Ossama Othman (5):
ell: Use __typeof__ instead of typeof in headers.
settings: Include strings.h for strcasecmp() proto
dbus-client: Only include required ELL headers.
ell: Make tls-private.h header self-contained.
tools: Only include required ELL headers.
ell/cipher.h | 1 +
ell/dbus-client.c | 4 +++-
ell/private.h | 2 +-
ell/settings.c | 1 +
ell/tls-private.h | 4 ++++
ell/util.h | 8 ++++----
tools/certchain-verify.c | 5 ++++-
7 files changed, 18 insertions(+), 7 deletions(-)
--
2.17.1
2 years, 2 months
[PATCH] dhcp: Free the old transport when setting, not the new one
by Mat Martineau
_dhcp_client_set_transport() would mistakenly free the new transport if
the client had an existing transport. This private function is only used
in a unit test, and only with a client that has an empty transport, so
it was a latent bug.
---
ell/dhcp.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/ell/dhcp.c b/ell/dhcp.c
index 0d99f74..5b46b0e 100644
--- a/ell/dhcp.c
+++ b/ell/dhcp.c
@@ -935,7 +935,7 @@ bool _dhcp_client_set_transport(struct l_dhcp_client *client,
return false;
if (client->transport)
- _dhcp_transport_free(transport);
+ _dhcp_transport_free(client->transport);
client->transport = transport;
return true;
--
2.19.1
2 years, 2 months
[PATCH 1/2] genl: rework l_genl_family to avoid extra lookups
by James Prestwood
Instead of looking up and re-allocating an entirely new l_genl_family
with each call to l_genl_family_new, we can use a previous lookup that
matches our family name.
A new internal structure was introduced, genl_parent, which holds all
the lookup information for a given family name. Now, when
l_genl_famil_new is called, we allocate a smaller child structure
(l_genl_family) which holds a pointer back to the parent object in order
to send and receive messages. This child structure only holds callback
information and the (new) group ID (gid).
Messages are now tagged with child group ID which allows for cancelling
all requets on a given child object without affecting other children of
the same parent. Cancelling all requets on a child object is as simple
as destroying the l_genl_family object (l_genl_family_unref).
---
ell/genl.c | 369 +++++++++++++++++++++++++++++++++++------------------
1 file changed, 245 insertions(+), 124 deletions(-)
diff --git a/ell/genl.c b/ell/genl.c
index 3a0281a..1dfdf1f 100644
--- a/ell/genl.c
+++ b/ell/genl.c
@@ -63,8 +63,9 @@ struct l_genl {
struct l_queue *notify_list;
unsigned int next_request_id;
unsigned int next_notify_id;
+ unsigned int next_gid;
struct l_queue *family_list;
- struct l_genl_family *nlctrl;
+ struct genl_parent *nlctrl;
struct genl_unicast_notify *unicast_notify;
l_genl_debug_func_t debug_callback;
l_genl_destroy_func_t debug_destroy;
@@ -85,6 +86,7 @@ struct l_genl_msg {
struct genl_request {
unsigned int id;
+ unsigned int gid;
uint16_t type;
uint16_t flags;
uint32_t seq;
@@ -114,8 +116,7 @@ struct genl_mcast {
unsigned int users;
};
-struct l_genl_family {
- int ref_count;
+struct genl_parent {
struct l_genl *genl;
char name[GENL_NAMSIZ];
uint16_t id;
@@ -124,11 +125,19 @@ struct l_genl_family {
uint32_t maxattr;
struct l_queue *op_list;
struct l_queue *mcast_list;
+ unsigned int nlctrl_cmd;
+ struct l_queue *children;
+ bool live;
+};
+
+struct l_genl_family {
+ struct genl_parent *parent;
+ int ref_count;
+ unsigned int gid;
l_genl_watch_func_t watch_appeared;
l_genl_watch_func_t watch_vanished;
l_genl_destroy_func_t watch_destroy;
void *watch_data;
- unsigned int nlctrl_cmd;
};
static void destroy_request(void *data)
@@ -153,20 +162,31 @@ static void destroy_notify(void *data)
l_free(notify);
}
-static struct l_genl_family *family_alloc(struct l_genl *genl,
- const char *name)
+static struct l_genl_family *family_alloc_child(struct genl_parent *parent)
{
- struct l_genl_family *family;
+ struct l_genl_family *family = l_new(struct l_genl_family, 1);
- family = l_new(struct l_genl_family, 1);
+ family->parent = parent;
+ family->gid = parent->genl->next_gid++;
- family->genl = genl;
- strncpy(family->name, name, GENL_NAMSIZ);
+ l_queue_push_tail(parent->children, family);
- family->op_list = l_queue_new();
- family->mcast_list = l_queue_new();
+ return family;
+}
- return l_genl_family_ref(family);
+static struct genl_parent *family_alloc_parent(struct l_genl *genl,
+ const char *name)
+{
+ struct genl_parent *parent = l_new(struct genl_parent, 1);
+
+ parent->genl = genl;
+ strncpy(parent->name, name, GENL_NAMSIZ);
+
+ parent->op_list = l_queue_new();
+ parent->mcast_list = l_queue_new();
+ parent->children = l_queue_new();
+
+ return parent;
}
static void op_free(void *data)
@@ -191,16 +211,63 @@ static void mcast_free(void *data, void *user_data)
l_free(mcast);
}
-static void family_free(void *data)
+static bool request_match_gid(const void *a, const void *b)
{
- struct l_genl_family *family = data;
+ const struct genl_request *request = a;
+ unsigned int gid = L_PTR_TO_UINT(b);
+
+ if (request->gid == gid)
+ return true;
+
+ return false;
+}
+
+static void cancel_all_requests(struct l_genl_family *child)
+{
+ struct l_genl *genl = child->parent->genl;
+ struct genl_request *request;
+
+ /* genl has already been cleaned up */
+ if (!genl->request_queue)
+ return;
+
+ while ((request = l_queue_find(genl->request_queue, request_match_gid,
+ L_UINT_TO_PTR(child->gid))))
+ l_genl_family_cancel(child, request->id);
+}
+
+static void child_free(void *data)
+{
+ struct l_genl_family *child = data;
+
+ cancel_all_requests(child);
+
+ if (child->parent->id > 0 && child->watch_vanished)
+ child->watch_vanished(child->watch_data);
+
+ if (child->watch_destroy)
+ child->watch_destroy(child->watch_data);
+
+
+ l_free(child);
+}
+
+static void parent_free(void *data)
+{
+ struct genl_parent *parent = data;
+
+ l_queue_destroy(parent->children, child_free);
+
+ l_queue_destroy(parent->op_list, op_free);
- family->genl = NULL;
+ l_queue_foreach(parent->mcast_list, mcast_free, parent->genl);
+ l_queue_destroy(parent->mcast_list, NULL);
+ parent->mcast_list = NULL;
- l_genl_family_unref(family);
+ l_free(parent);
}
-static void family_add_op(struct l_genl_family *family, uint32_t id,
+static void family_add_op(struct genl_parent *parent, uint32_t id,
uint32_t flags)
{
struct genl_op *op;
@@ -210,7 +277,7 @@ static void family_add_op(struct l_genl_family *family, uint32_t id,
op->id = id;
op->flags = flags;
- l_queue_push_tail(family->op_list, op);
+ l_queue_push_tail(parent->op_list, op);
}
static bool match_mcast_name(const void *a, const void *b)
@@ -221,16 +288,16 @@ static bool match_mcast_name(const void *a, const void *b)
return !strcmp(mcast->name, name);
}
-static void family_add_mcast(struct l_genl_family *family, const char *name,
+static void family_add_mcast(struct genl_parent *parent, const char *name,
uint32_t id)
{
- struct l_genl *genl = family->genl;
+ struct l_genl *genl = parent->genl;
struct genl_mcast *mcast;
if (!genl)
return;
- mcast = l_queue_find(family->mcast_list, match_mcast_name,
+ mcast = l_queue_find(parent->mcast_list, match_mcast_name,
(char *) name);
if (mcast)
return;
@@ -241,7 +308,26 @@ static void family_add_mcast(struct l_genl_family *family, const char *name,
mcast->id = id;
mcast->users = 0;
- l_queue_push_tail(family->mcast_list, mcast);
+ l_queue_push_tail(parent->mcast_list, mcast);
+}
+
+/* special initializer for the nlctrl object */
+static struct genl_parent *family_alloc_ctrl(struct l_genl *genl)
+{
+ struct genl_parent *nlctrl;
+
+ nlctrl = l_new(struct genl_parent, 1);
+
+ nlctrl->genl = genl;
+ strncpy(nlctrl->name, "nlctrl", GENL_NAMSIZ);
+
+ nlctrl->op_list = l_queue_new();
+ nlctrl->mcast_list = l_queue_new();
+ nlctrl->id = GENL_ID_CTRL;
+
+ family_add_mcast(nlctrl, "notify", GENL_ID_CTRL);
+
+ return nlctrl;
}
static struct l_genl_msg *msg_alloc(uint8_t cmd, uint8_t version, uint32_t size)
@@ -549,13 +635,7 @@ LIB_EXPORT struct l_genl *l_genl_new(int fd)
genl->fd = fd;
genl->close_on_unref = false;
- genl->nlctrl = family_alloc(genl, "nlctrl");
-
- genl->nlctrl->id = GENL_ID_CTRL;
-
- family_add_mcast(genl->nlctrl, "notify", GENL_ID_CTRL);
-
- l_queue_push_tail(genl->family_list, genl->nlctrl);
+ genl->nlctrl = family_alloc_ctrl(genl);
genl->io = l_io_new(genl->fd);
@@ -632,6 +712,7 @@ LIB_EXPORT void l_genl_unref(struct l_genl *genl)
l_queue_destroy(genl->notify_list, destroy_notify);
l_queue_destroy(genl->pending_list, destroy_request);
l_queue_destroy(genl->request_queue, destroy_request);
+ genl->request_queue = NULL;
l_io_set_write_handler(genl->io, NULL, NULL, NULL);
l_io_set_read_handler(genl->io, NULL, NULL, NULL);
@@ -639,9 +720,9 @@ LIB_EXPORT void l_genl_unref(struct l_genl *genl)
l_io_destroy(genl->io);
genl->io = NULL;
- l_genl_family_unref(genl->nlctrl);
+ parent_free(genl->nlctrl);
- l_queue_destroy(genl->family_list, family_free);
+ l_queue_destroy(genl->family_list, parent_free);
if (genl->close_on_unref)
close(genl->fd);
@@ -984,7 +1065,7 @@ LIB_EXPORT bool l_genl_attr_recurse(struct l_genl_attr *attr,
return true;
}
-static void family_ops(struct l_genl_family *family, struct l_genl_attr *attr)
+static void family_ops(struct genl_parent *parent, struct l_genl_attr *attr)
{
uint16_t type, len;
const void *data;
@@ -1007,11 +1088,11 @@ static void family_ops(struct l_genl_family *family, struct l_genl_attr *attr)
}
if (id > 0)
- family_add_op(family, id, flags);
+ family_add_op(parent, id, flags);
}
}
-static void family_mcast_groups(struct l_genl_family *family,
+static void family_mcast_groups(struct genl_parent *parent,
struct l_genl_attr *attr)
{
uint16_t type, len;
@@ -1036,21 +1117,30 @@ static void family_mcast_groups(struct l_genl_family *family,
}
if (name && id > 0)
- family_add_mcast(family, name, id);
+ family_add_mcast(parent, name, id);
}
}
+static void family_notify_appeared(void *data, void *user_data)
+{
+ struct l_genl_family *family = data;
+
+ if (family->watch_appeared)
+ family->watch_appeared(family->watch_data);
+}
+
static void get_family_callback(struct l_genl_msg *msg, void *user_data)
{
struct l_genl_family *family = user_data;
+ struct genl_parent *parent = family->parent;
struct l_genl_attr attr, nested;
uint16_t type, len;
const void *data;
int error;
- family->nlctrl_cmd = 0;
+ parent->nlctrl_cmd = 0;
- if (family->id > 0)
+ if (parent->id > 0)
return;
error = l_genl_msg_get_error(msg);
@@ -1066,38 +1156,86 @@ static void get_family_callback(struct l_genl_msg *msg, void *user_data)
while (l_genl_attr_next(&attr, &type, &len, &data)) {
switch (type) {
case CTRL_ATTR_FAMILY_ID:
- family->id = *((uint16_t *) data);
+ parent->id = *((uint16_t *) data);
break;
case CTRL_ATTR_FAMILY_NAME:
- strncpy(family->name, data, GENL_NAMSIZ);
+ strncpy(parent->name, data, GENL_NAMSIZ);
break;
case CTRL_ATTR_VERSION:
- family->version = *((uint32_t *) data);
+ parent->version = *((uint32_t *) data);
break;
case CTRL_ATTR_HDRSIZE:
- family->hdrsize = *((uint32_t *) data);
+ parent->hdrsize = *((uint32_t *) data);
break;
case CTRL_ATTR_MAXATTR:
- family->maxattr = *((uint32_t *) data);
+ parent->maxattr = *((uint32_t *) data);
break;
case CTRL_ATTR_OPS:
if (l_genl_attr_recurse(&attr, &nested))
- family_ops(family, &nested);
+ family_ops(parent, &nested);
break;
case CTRL_ATTR_MCAST_GROUPS:
if (l_genl_attr_recurse(&attr, &nested))
- family_mcast_groups(family, &nested);
+ family_mcast_groups(parent, &nested);
break;
}
}
- if (family->watch_appeared)
- family->watch_appeared(family->watch_data);
+ parent->live = true;
+
+ l_queue_foreach(parent->children, family_notify_appeared, NULL);
+}
+
+static bool match_family_name(const void *a, const void *b)
+{
+ const struct genl_parent *parent = a;
+
+ return !strncmp(parent->name, (const char *)b, GENL_NAMSIZ);
+}
+
+static unsigned int send_common(struct genl_parent *parent, uint16_t flags,
+ struct l_genl_msg *msg, unsigned int gid,
+ l_genl_msg_func_t callback, void *user_data,
+ l_genl_destroy_func_t destroy)
+{
+ struct l_genl *genl;
+ struct genl_request *request;
+
+ if (!parent || !msg)
+ return 0;
+
+ genl = parent->genl;
+ if (!genl)
+ return 0;
+
+ request = l_new(struct genl_request, 1);
+
+ request->type = parent->id;
+ request->flags = NLM_F_REQUEST | flags;
+
+ request->msg = msg;
+ request->gid = gid;
+
+ request->callback = callback;
+ request->destroy = destroy;
+ request->user_data = user_data;
+
+ if (genl->next_request_id < 1)
+ genl->next_request_id = 1;
+
+ request->id = genl->next_request_id++;
+
+ l_queue_push_tail(genl->request_queue, request);
+
+ wakeup_writer(genl);
+
+ return request->id;
}
LIB_EXPORT struct l_genl_family *l_genl_family_new(struct l_genl *genl,
const char *name)
{
+ struct genl_parent *parent;
struct l_genl_family *family;
struct l_genl_msg *msg;
@@ -1105,26 +1243,38 @@ LIB_EXPORT struct l_genl_family *l_genl_family_new(struct l_genl *genl,
unlikely(strlen(name) >= GENL_NAMSIZ))
return NULL;
- family = family_alloc(genl, name);
- if (!family)
+ parent = l_queue_find(genl->family_list, match_family_name, name);
+ if (parent) {
+ family = family_alloc_child(parent);
+ goto done;
+ }
+
+ parent = family_alloc_parent(genl, name);
+
+ if (!parent)
return NULL;
+ family = family_alloc_child(parent);
+
+ /* family has not yet been looked up */
msg = l_genl_msg_new_sized(CTRL_CMD_GETFAMILY, NLA_HDRLEN + GENL_NAMSIZ);
l_genl_msg_append_attr(msg, CTRL_ATTR_FAMILY_NAME,
- GENL_NAMSIZ, family->name);
+ GENL_NAMSIZ, parent->name);
- family->nlctrl_cmd = l_genl_family_send(genl->nlctrl, msg,
- get_family_callback, family, NULL);
+ parent->nlctrl_cmd = send_common(genl->nlctrl, NLM_F_ACK, msg, 0,
+ get_family_callback, family,
+ NULL);
- if (!family->nlctrl_cmd) {
- family_free(family);
+ if (!parent->nlctrl_cmd) {
+ parent_free(parent);
return NULL;
}
- l_queue_push_tail(genl->family_list, family);
+ l_queue_push_tail(genl->family_list, parent);
- return family;
+done:
+ return l_genl_family_ref(family);
}
LIB_EXPORT struct l_genl_family *l_genl_family_ref(
@@ -1141,34 +1291,35 @@ LIB_EXPORT struct l_genl_family *l_genl_family_ref(
LIB_EXPORT void l_genl_family_unref(struct l_genl_family *family)
{
struct l_genl *genl;
+ struct genl_parent *parent;
if (unlikely(!family))
return;
+ parent = family->parent;
+
if (__sync_sub_and_fetch(&family->ref_count, 1))
return;
- if (family->nlctrl_cmd > 0)
- l_genl_family_cancel(family, family->nlctrl_cmd);
-
- genl = family->genl;
- if (genl)
- l_queue_remove(genl->family_list, family);
-
- l_queue_destroy(family->op_list, op_free);
-
- l_queue_foreach(family->mcast_list, mcast_free, genl);
+ if (!l_queue_remove(parent->children, family))
+ return;
- l_queue_destroy(family->mcast_list, NULL);
- family->mcast_list = NULL;
+ /* parent still has children, just free this child instance */
+ if (!l_queue_isempty(parent->children)) {
+ child_free(family);
+ return;
+ }
- if (family->id > 0 && family->watch_vanished)
- family->watch_vanished(family->watch_data);
+ if (parent->nlctrl_cmd > 0)
+ l_genl_family_cancel(family, parent->nlctrl_cmd);
- if (family->watch_destroy)
- family->watch_destroy(family->watch_data);
+ genl = parent->genl;
+ if (genl)
+ l_queue_remove(genl->family_list, parent);
- l_free(family);
+ /* child is no longer in 'children' list, free manually */
+ child_free(family);
+ parent_free(parent);
}
LIB_EXPORT bool l_genl_family_set_watches(struct l_genl_family *family,
@@ -1188,6 +1339,10 @@ LIB_EXPORT bool l_genl_family_set_watches(struct l_genl_family *family,
family->watch_destroy = destroy;
family->watch_data = user_data;
+ /* if the parent has already been looked up, we notify immediately */
+ if (family->parent->live)
+ family->watch_appeared(family->watch_data);
+
return true;
}
@@ -1196,7 +1351,7 @@ LIB_EXPORT uint32_t l_genl_family_get_version(struct l_genl_family *family)
if (unlikely(!family))
return 0;
- return family->version;
+ return family->parent->version;
}
LIB_EXPORT struct l_genl *l_genl_family_get_genl(struct l_genl_family *family)
@@ -1204,7 +1359,7 @@ LIB_EXPORT struct l_genl *l_genl_family_get_genl(struct l_genl_family *family)
if (unlikely(!family))
return 0;
- return family->genl;
+ return family->parent->genl;
}
static bool match_op_id(const void *a, const void *b)
@@ -1223,7 +1378,8 @@ LIB_EXPORT bool l_genl_family_can_send(struct l_genl_family *family,
if (unlikely(!family))
return false;
- op = l_queue_find(family->op_list, match_op_id, L_UINT_TO_PTR(cmd));
+ op = l_queue_find(family->parent->op_list, match_op_id,
+ L_UINT_TO_PTR(cmd));
if (!op)
return false;
@@ -1241,7 +1397,8 @@ LIB_EXPORT bool l_genl_family_can_dump(struct l_genl_family *family,
if (!family)
return false;
- op = l_queue_find(family->op_list, match_op_id, L_UINT_TO_PTR(cmd));
+ op = l_queue_find(family->parent->op_list, match_op_id,
+ L_UINT_TO_PTR(cmd));
if (!op)
return false;
@@ -1251,51 +1408,14 @@ LIB_EXPORT bool l_genl_family_can_dump(struct l_genl_family *family,
return false;
}
-static unsigned int send_common(struct l_genl_family *family, uint16_t flags,
- struct l_genl_msg *msg, l_genl_msg_func_t callback,
- void *user_data, l_genl_destroy_func_t destroy)
-{
- struct l_genl *genl;
- struct genl_request *request;
-
- if (!family || !msg)
- return 0;
-
- genl = family->genl;
- if (!genl)
- return 0;
-
- request = l_new(struct genl_request, 1);
-
- request->type = family->id;
- request->flags = NLM_F_REQUEST | flags;
-
- request->msg = msg;
-
- request->callback = callback;
- request->destroy = destroy;
- request->user_data = user_data;
-
- if (genl->next_request_id < 1)
- genl->next_request_id = 1;
-
- request->id = genl->next_request_id++;
-
- l_queue_push_tail(genl->request_queue, request);
-
- wakeup_writer(genl);
-
- return request->id;
-}
-
LIB_EXPORT unsigned int l_genl_family_send(struct l_genl_family *family,
struct l_genl_msg *msg,
l_genl_msg_func_t callback,
void *user_data,
l_genl_destroy_func_t destroy)
{
- return send_common(family, NLM_F_ACK, msg, callback,
- user_data, destroy);
+ return send_common(family->parent, NLM_F_ACK, msg, family->gid,
+ callback, user_data, destroy);
}
LIB_EXPORT unsigned int l_genl_family_dump(struct l_genl_family *family,
@@ -1304,8 +1424,9 @@ LIB_EXPORT unsigned int l_genl_family_dump(struct l_genl_family *family,
void *user_data,
l_genl_destroy_func_t destroy)
{
- return send_common(family, NLM_F_ACK | NLM_F_DUMP, msg, callback,
- user_data, destroy);
+ return send_common(family->parent, NLM_F_ACK | NLM_F_DUMP, msg,
+ family->gid, callback,
+ user_data, destroy);
}
static bool match_request_id(const void *a, const void *b)
@@ -1325,7 +1446,7 @@ LIB_EXPORT bool l_genl_family_cancel(struct l_genl_family *family,
if (unlikely(!family) || unlikely(!id))
return false;
- genl = family->genl;
+ genl = family->parent->genl;
if (!genl)
return false;
@@ -1367,7 +1488,7 @@ LIB_EXPORT bool l_genl_family_has_group(struct l_genl_family *family,
if (unlikely(!family))
return false;
- mcast = l_queue_find(family->mcast_list, match_mcast_name,
+ mcast = l_queue_find(family->parent->mcast_list, match_mcast_name,
(char *) group);
if (!mcast)
return false;
@@ -1388,18 +1509,18 @@ LIB_EXPORT unsigned int l_genl_family_register(struct l_genl_family *family,
if (unlikely(!family) || unlikely(!group))
return 0;
- genl = family->genl;
+ genl = family->parent->genl;
if (!genl)
return 0;
- mcast = l_queue_find(family->mcast_list, match_mcast_name,
+ mcast = l_queue_find(family->parent->mcast_list, match_mcast_name,
(char *) group);
if (!mcast)
return 0;
notify = l_new(struct genl_mcast_notify, 1);
- notify->type = family->id;
+ notify->type = family->parent->id;
notify->group = mcast->id;
notify->callback = callback;
@@ -1435,7 +1556,7 @@ LIB_EXPORT bool l_genl_family_unregister(struct l_genl_family *family,
if (!family || !id)
return false;
- genl = family->genl;
+ genl = family->parent->genl;
if (!genl)
return false;
--
2.17.1
2 years, 2 months
[PATCH] build: Add all remaining exported symbols to the library script
by Mat Martineau
Only a subset of the LIB_EXPORT symbols reported by
tools/extract-symbols.sh were included in the initial version of
ell/ell.sym
---
The current ell.sym breaks the link step for our non-iwd project.
Let me know (or just edit before committing) if the ELL_0.10 version
needs to be updated too.
ell/ell.sym | 336 ++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 336 insertions(+)
diff --git a/ell/ell.sym b/ell/ell.sym
index 71ec669..9696129 100644
--- a/ell/ell.sym
+++ b/ell/ell.sym
@@ -94,6 +94,342 @@ global:
l_main_quit;
l_main_run_with_signal;
l_main_get_epoll_fd;
+ /* base64 */
+ l_base64_decode;
+ l_base64_encode;
+ /* checksum */
+ l_checksum_new;
+ l_checksum_new_cmac_aes;
+ l_checksum_new_hmac;
+ l_checksum_clone;
+ l_checksum_free;
+ l_checksum_reset;
+ l_checksum_update;
+ l_checksum_updatev;
+ l_checksum_get_digest;
+ l_checksum_get_string;
+ l_checksum_is_supported;
+ l_checksum_cmac_aes_supported;
+ /* cipher */
+ l_cipher_new;
+ l_aead_cipher_new;
+ l_cipher_free;
+ l_aead_cipher_free;
+ l_cipher_encrypt;
+ l_cipher_encryptv;
+ l_cipher_decrypt;
+ l_cipher_decryptv;
+ l_cipher_set_iv;
+ l_aead_cipher_encrypt;
+ l_aead_cipher_decrypt;
+ l_cipher_is_supported;
+ l_aead_cipher_is_supported;
+ /* dbus */
+ l_dbus_proxy_get_path;
+ l_dbus_proxy_get_interface;
+ l_dbus_proxy_get_property;
+ l_dbus_proxy_set_property;
+ l_dbus_proxy_method_call;
+ l_dbus_client_new;
+ l_dbus_client_destroy;
+ l_dbus_client_set_connect_handler;
+ l_dbus_client_set_disconnect_handler;
+ l_dbus_client_set_ready_handler;
+ l_dbus_client_set_proxy_handlers;
+ l_dbus_message_set_no_reply;
+ l_dbus_message_get_no_reply;
+ l_dbus_message_set_no_autostart;
+ l_dbus_message_get_no_autostart;
+ l_dbus_message_new_method_call;
+ l_dbus_message_new_signal;
+ l_dbus_message_new_method_return;
+ l_dbus_message_new_error_valist;
+ l_dbus_message_new_error;
+ l_dbus_message_ref;
+ l_dbus_message_unref;
+ l_dbus_message_get_error;
+ l_dbus_message_is_error;
+ l_dbus_message_get_arguments_valist;
+ l_dbus_message_get_arguments;
+ l_dbus_message_set_arguments;
+ l_dbus_message_set_arguments_valist;
+ l_dbus_message_get_path;
+ l_dbus_message_get_interface;
+ l_dbus_message_get_member;
+ l_dbus_message_get_destination;
+ l_dbus_message_get_sender;
+ l_dbus_message_get_signature;
+ l_dbus_message_iter_next_entry;
+ l_dbus_message_iter_get_variant;
+ l_dbus_message_iter_get_fixed_array;
+ l_dbus_message_builder_new;
+ l_dbus_message_builder_destroy;
+ l_dbus_message_builder_append_basic;
+ l_dbus_message_builder_enter_container;
+ l_dbus_message_builder_leave_container;
+ l_dbus_message_builder_enter_struct;
+ l_dbus_message_builder_leave_struct;
+ l_dbus_message_builder_enter_array;
+ l_dbus_message_builder_leave_array;
+ l_dbus_message_builder_enter_dict;
+ l_dbus_message_builder_leave_dict;
+ l_dbus_message_builder_enter_variant;
+ l_dbus_message_builder_leave_variant;
+ l_dbus_message_builder_append_from_iter;
+ l_dbus_message_builder_append_from_valist;
+ l_dbus_message_builder_finalize;
+ l_dbus_interface_method;
+ l_dbus_interface_signal;
+ l_dbus_interface_property;
+ l_dbus_property_changed;
+ l_dbus_new;
+ l_dbus_new_default;
+ l_dbus_destroy;
+ l_dbus_set_ready_handler;
+ l_dbus_set_disconnect_handler;
+ l_dbus_set_debug;
+ l_dbus_send_with_reply;
+ l_dbus_send;
+ l_dbus_cancel;
+ l_dbus_register;
+ l_dbus_unregister;
+ l_dbus_method_call;
+ l_dbus_register_interface;
+ l_dbus_unregister_interface;
+ l_dbus_register_object;
+ l_dbus_unregister_object;
+ l_dbus_object_add_interface;
+ l_dbus_object_remove_interface;
+ l_dbus_object_manager_enable;
+ l_dbus_add_disconnect_watch;
+ l_dbus_add_service_watch;
+ l_dbus_remove_watch;
+ l_dbus_add_signal_watch;
+ l_dbus_remove_signal_watch;
+ l_dbus_name_acquire;
+ /* dhcp */
+ l_dhcp_lease_get_address;
+ l_dhcp_lease_get_gateway;
+ l_dhcp_lease_get_netmask;
+ l_dhcp_lease_get_broadcast;
+ l_dhcp_lease_get_server_id;
+ l_dhcp_lease_get_t1;
+ l_dhcp_lease_get_t2;
+ l_dhcp_lease_get_lifetime;
+ l_dhcp_client_new;
+ l_dhcp_client_destroy;
+ l_dhcp_client_add_request_option;
+ l_dhcp_client_set_address;
+ l_dhcp_client_set_interface_name;
+ l_dhcp_client_set_hostname;
+ l_dhcp_client_get_lease;
+ l_dhcp_client_start;
+ l_dhcp_client_stop;
+ l_dhcp_client_set_event_handler;
+ /* dir */
+ l_dir_watch_new;
+ l_dir_watch_destroy;
+ /* file */
+ l_file_get_contents;
+ /* genl */
+ l_genl_new;
+ l_genl_new_default;
+ l_genl_ref;
+ l_genl_unref;
+ l_genl_set_debug;
+ l_genl_set_close_on_unref;
+ l_genl_set_unicast_handler;
+ l_genl_msg_new;
+ l_genl_msg_new_sized;
+ l_genl_msg_ref;
+ l_genl_msg_unref;
+ l_genl_msg_get_command;
+ l_genl_msg_get_version;
+ l_genl_msg_get_error;
+ l_genl_msg_append_attr;
+ l_genl_msg_append_attrv;
+ l_genl_msg_enter_nested;
+ l_genl_msg_leave_nested;
+ l_genl_attr_init;
+ l_genl_attr_next;
+ l_genl_attr_recurse;
+ l_genl_family_new;
+ l_genl_family_ref;
+ l_genl_family_unref;
+ l_genl_family_set_watches;
+ l_genl_family_get_version;
+ l_genl_family_get_genl;
+ l_genl_family_can_send;
+ l_genl_family_can_dump;
+ l_genl_family_send;
+ l_genl_family_dump;
+ l_genl_family_cancel;
+ l_genl_family_has_group;
+ l_genl_family_register;
+ l_genl_family_unregister;
+ /* hwdb */
+ l_hwdb_new;
+ l_hwdb_new_default;
+ l_hwdb_ref;
+ l_hwdb_unref;
+ l_hwdb_lookup;
+ l_hwdb_lookup_valist;
+ l_hwdb_lookup_free;
+ l_hwdb_foreach;
+ /* idle */
+ l_idle_create;
+ l_idle_oneshot;
+ l_idle_remove;
+ /* io */
+ l_io_new;
+ l_io_destroy;
+ l_io_get_fd;
+ l_io_set_close_on_destroy;
+ l_io_set_read_handler;
+ l_io_set_write_handler;
+ l_io_set_disconnect_handler;
+ l_io_set_debug;
+ /* key */
+ l_key_new;
+ l_key_free;
+ l_key_free_norevoke;
+ l_key_update;
+ l_key_extract;
+ l_key_get_payload_size;
+ l_key_get_info;
+ l_key_compute_dh_public;
+ l_key_compute_dh_secret;
+ l_key_encrypt;
+ l_key_decrypt;
+ l_key_sign;
+ l_key_verify;
+ l_keyring_new;
+ l_keyring_restrict;
+ l_keyring_free;
+ l_keyring_free_norevoke;
+ l_keyring_link;
+ l_keyring_unlink;
+ l_key_is_supported;
+ /* log */
+ l_log_set_ident;
+ l_log_set_handler;
+ l_log_set_null;
+ l_log_set_stderr;
+ l_log_set_syslog;
+ l_log_set_journal;
+ l_log_with_location;
+ l_debug_add_section;
+ l_debug_enable_full;
+ l_debug_disable;
+ /* net */
+ l_net_get_mac_address;
+ l_net_get_name;
+ /* netlink */
+ l_netlink_new;
+ l_netlink_destroy;
+ l_netlink_send;
+ l_netlink_cancel;
+ l_netlink_register;
+ l_netlink_unregister;
+ l_netlink_set_debug;
+ /* pem */
+ l_pem_load_buffer;
+ l_pem_load_file;
+ l_pem_load_certificate;
+ l_pem_load_private_key;
+ /* pkcs5 */
+ l_pkcs5_pbkdf1;
+ l_pkcs5_pbkdf2;
+ /* plugin */
+ l_plugin_add;
+ l_plugin_load;
+ l_plugin_unload;
+ /* getrandom */
+ l_getrandom;
+ l_getrandom_is_supported;
+ /* ringbuf */
+ l_ringbuf_new;
+ l_ringbuf_free;
+ l_ringbuf_set_input_tracing;
+ l_ringbuf_capacity;
+ l_ringbuf_len;
+ l_ringbuf_drain;
+ l_ringbuf_peek;
+ l_ringbuf_write;
+ l_ringbuf_avail;
+ l_ringbuf_printf;
+ l_ringbuf_vprintf;
+ l_ringbuf_read;
+ /* settings */
+ l_settings_new;
+ l_settings_free;
+ l_settings_load_from_data;
+ l_settings_to_data;
+ l_settings_load_from_file;
+ l_settings_set_debug;
+ l_settings_get_groups;
+ l_settings_has_group;
+ l_settings_get_keys;
+ l_settings_has_key;
+ l_settings_get_value;
+ l_settings_set_value;
+ l_settings_get_bool;
+ l_settings_set_bool;
+ l_settings_get_int;
+ l_settings_set_int;
+ l_settings_get_uint;
+ l_settings_set_uint;
+ l_settings_get_int64;
+ l_settings_set_int64;
+ l_settings_get_uint64;
+ l_settings_set_uint64;
+ l_settings_get_string;
+ l_settings_set_string;
+ l_settings_get_string_list;
+ l_settings_set_string_list;
+ l_settings_get_double;
+ l_settings_set_double;
+ l_settings_get_float;
+ l_settings_set_float;
+ l_settings_remove_group;
+ l_settings_remove_key;
+ /* signal */
+ l_signal_create;
+ l_signal_remove;
+ /* timeout */
+ l_timeout_create;
+ l_timeout_create_ms;
+ l_timeout_modify;
+ l_timeout_modify_ms;
+ l_timeout_remove;
+ /* tls */
+ l_tls_handle_rx;
+ l_tls_prf_get_bytes;
+ l_tls_new;
+ l_tls_free;
+ l_tls_write;
+ l_tls_close;
+ l_tls_set_cacert;
+ l_tls_set_auth_data;
+ l_tls_alert_to_str;
+ /* uintset */
+ l_uintset_new_from_range;
+ l_uintset_new;
+ l_uintset_free;
+ l_uintset_take;
+ l_uintset_put;
+ l_uintset_contains;
+ l_uintset_get_min;
+ l_uintset_get_max;
+ l_uintset_find_unused_min;
+ l_uintset_find_max;
+ l_uintset_find_min;
+ /* uuid */
+ l_uuid_v3;
+ l_uuid_v5;
+ l_uuid_is_valid;
+ l_uuid_get_version;
+ l_uuid_to_string;
local:
*;
};
--
2.19.1
2 years, 2 months
[PATCH 1/2] log: Use __func__ for function name
by Mat Martineau
__FUNCTION__ and __PRETTY_FUNCTION__ are older gcc aliases for
__func__. Switch to use __func__ in L_DEBUG_SYMBOL(), like l_log()
already does. This resolves some compiler warnings in ELL headers when a
program is built with compiler flags that are more strict than the
maintainer-mode build.
---
ell/log.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/ell/log.h b/ell/log.h
index d21e2aa..a86705f 100644
--- a/ell/log.h
+++ b/ell/log.h
@@ -66,12 +66,12 @@ struct l_debug_desc {
#define L_DEBUG_SYMBOL(symbol, format, args...) do { \
static struct l_debug_desc symbol \
__attribute__((used, section("__ell_debug"), aligned(8))) = { \
- .file = __FILE__, .func = __FUNCTION__, \
+ .file = __FILE__, .func = __func__, \
.flags = L_DEBUG_FLAG_DEFAULT, \
}; \
if (symbol.flags & L_DEBUG_FLAG_PRINT) \
l_log(L_LOG_DEBUG, "%s:%s() " format, __FILE__, \
- __PRETTY_FUNCTION__ , ## args); \
+ __func__ , ## args); \
} while (0)
void l_debug_enable_full(const char *pattern,
--
2.19.1
2 years, 2 months
[PATCH] Update Linux kernel documentation URLs.
by Ossama Othman
---
HACKING | 3 ++-
doc/coding-style.txt | 3 ++-
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/HACKING b/HACKING
index 7db7d66..22dc9a2 100644
--- a/HACKING
+++ b/HACKING
@@ -6,7 +6,8 @@ welcome! In order to ease the inclusion of your patch, it's important to follow
some rules, otherwise it will likely be rejected by maintainers.
ell rules for submitting patches follow most of the rules used by Linux kernel
-(https://www.kernel.org/doc/Documentation/SubmittingPatches) with some remarks:
+(https://www.kernel.org/doc/html/latest/process/submitting-patches.html)
+with some remarks:
1) Do *not* add "Signed-off-by" lines in your commit messages. ell does not
use them, so including them is actually an error.
diff --git a/doc/coding-style.txt b/doc/coding-style.txt
index 6b1c44a..3699052 100644
--- a/doc/coding-style.txt
+++ b/doc/coding-style.txt
@@ -9,7 +9,8 @@ to help your code survive under maintainer's fastidious eyes so that you
can get a passport for your patch ASAP.
First of all, the Embedded Linux Library coding style must follow every rule
-for the Linux kernel (http://www.kernel.org/doc/Documentation/CodingStyle).
+for the Linux kernel
+(https://www.kernel.org/doc/html/latest/process/coding-style.html).
There also exists a tool named checkpatch.pl to help you check the compliance
with it. Just type "checkpatch.pl --no-tree --no-signoff patch_name" to check
your patch.
--
2.17.1
2 years, 3 months
[PATCH 0/2] Correct missing field initializer warning
by Ossama Othman
The L_PLUGIN_DEFINE() macro triggered missing field initializer
warnings when the corresponding warning flag was enabled for user
defined plugins. Prevent ELL from exposing such warnings to the user
by explicitly initializing all l_plugin_desc fields, as well
re-enabling that warning in maintainer mode builds.
Ossama Othman (2):
plugin: Explicitly initialize descriptor fields.
Re-enable -Wmissing-field-initializers warning.
acinclude.m4 | 1 -
ell/plugin.h | 3 ++-
2 files changed, 2 insertions(+), 2 deletions(-)
--
2.17.1
2 years, 3 months
[PATCH] ell/dir.c: include limits.h for NAME_MAX
by maxice8
From: William Maxwell <thinkabit.ukim(a)gmail.com>
fixes compilation on musl libc systems that are stricter
the error:
ell/dir.c: In function 'inotify_read_cb':
ell/dir.c:176:45: error: 'NAME_MAX' undeclared (first use in this function); did you mean 'SIZE_MAX'?
uint8_t buf[sizeof(struct inotify_event) + NAME_MAX + 1]
^~~~~~~~
SIZE_MAX
ell/dir.c:176:45: note: each undeclared identifier is reported only once for each function it appears in
Signed-off-by: William Maxwell <thinkabit.ukim(a)gmail.com>
---
ell/dir.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/ell/dir.c b/ell/dir.c
index d1870c8..7917664 100644
--- a/ell/dir.c
+++ b/ell/dir.c
@@ -27,6 +27,7 @@
#include <unistd.h>
#include <dirent.h>
#include <sys/inotify.h>
+#include <limits.h>
#include "private.h"
#include "queue.h"
--
2.19.1
2 years, 3 months
[PATCH] hashmap: Fix removing last entry in l_hashmap_foreach_remove
by Andrew Zaborowski
When the last entry in a bucket with 2 or more entries was removed
the loop would roll over and iterate over the remaining entries for a
second time (then stop), add missing check.
---
ell/hashmap.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/ell/hashmap.c b/ell/hashmap.c
index ee11d31..061080b 100644
--- a/ell/hashmap.c
+++ b/ell/hashmap.c
@@ -607,6 +607,8 @@ LIB_EXPORT unsigned int l_hashmap_foreach_remove(struct l_hashmap *hashmap,
free_key(hashmap, entry->key);
l_free(entry);
entry = prev->next;
+ if (entry == head)
+ break;
continue;
}
--
2.19.1
2 years, 3 months