Skip to contentSkip to conversation

Move TEMP_FAILURE_RETRY outside dbus.h

PATCH Applied Andrew Zaborowski 2 participants 4 messages Jul 20, 2018 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 Move TEMP_FAILURE_RETRY outside dbus.h

Make this macro available for the rest of ell in private.h and on the other hand remove from public header as it doesn't start with "L_". Note that IWD does optionally use it in rfkill.c and storage.c.

---
 ell/dbus.h    | 10 ----------
 ell/private.h | 11 +++++++++++
 2 files changed, 11 insertions(+), 10 deletions(-)
ell/dbus.h +0 -10
index 3ff5e0f..a7c08d2 100644
@@ -28,16 +28,6 @@
 #include <stddef.h>
 #include <stdarg.h>
 
-/* taken from glibc unistd.h for musl support */
-#ifndef TEMP_FAILURE_RETRY
-#define TEMP_FAILURE_RETRY(expression)             \
-  (__extension__                                   \
-    ({ long int __result;                          \
-       do __result = (long int) (expression);      \
-       while (__result == -1L && errno == EINTR);  \
-       __result; }))
-#endif
-
 #ifdef __cplusplus
 extern "C" {
 #endif
ell/private.h +11 -0
index ed0297d..bf71f6d 100644
@@ -21,6 +21,7 @@
  */
 
 #include <stdint.h>
+#include <errno.h>
 
 #include <ell/util.h>
 
@@ -34,6 +35,16 @@
 
 #define LIB_EXPORT __attribute__ ((visibility("default")))
 
+/* taken from glibc unistd.h for musl support */
+#ifndef TEMP_FAILURE_RETRY
+#define TEMP_FAILURE_RETRY(expression)             \
+  (__extension__                                   \
+    ({ long int __result;                          \
+       do __result = (long int) (expression);      \
+       while (__result == -1L && errno == EINTR);  \
+       __result; }))
+#endif
+
 struct l_debug_desc;
 
 void debug_enable(struct l_debug_desc *start, struct l_debug_desc *stop);
Signature · 1 line
2.14.1
#1 lore raw

PATCH 2/3 fswatch: Add fswatch API

Add the header and the implementation for a filesystem watch API. It's a simple wrapper around the Linux inotify mechanism but not named inotify so as not to preclude using other mechanisms in the implementation.

---
 Makefile.am   |   6 +-
 ell/ell.h     |   1 +
 ell/fswatch.c | 261 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 ell/fswatch.h |  44 ++++++++++
 4 files changed, 310 insertions(+), 2 deletions(-)
 create mode 100644 ell/fswatch.c
 create mode 100644 ell/fswatch.h
Makefile.am +4 -2
index 100e24c..8203fd4 100644
@@ -45,7 +45,8 @@ pkginclude_HEADERS = ell/ell.h \
 			ell/pkcs5.h \
 			ell/file.h \
 			ell/net.h \
-			ell/dhcp.h
+			ell/dhcp.h \
+			ell/fswatch.h
 
 lib_LTLIBRARIES = ell/libell.la
 
@@ -104,7 +105,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/fswatch.c
 
 ell_libell_la_LDFLAGS = -no-undefined \
 			-version-info $(ELL_CURRENT):$(ELL_REVISION):$(ELL_AGE)
ell/ell.h +1 -0
index 03bb61d..c03faf2 100644
@@ -53,3 +53,4 @@
 #include <ell/dbus-service.h>
 #include <ell/dbus-client.h>
 #include <ell/dhcp.h>
+#include <ell/fswatch.h>
ell/fswatch.c new file +261 -0

261 lines not on this page · raw message

ell/fswatch.h new file +44 -0

44 lines not on this page · raw message

Signature · 1 line
2.14.1
#2 lore raw

PATCH 3/3 unit: Add an fswatch unit test

In reply to Andrew Zaborowski
---
 .gitignore          |   1 +
 Makefile.am         |   5 +-
 unit/test-fswatch.c | 293 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 298 insertions(+), 1 deletion(-)
 create mode 100644 unit/test-fswatch.c
.gitignore +1 -0
index 4dc3777..6c9ffb0 100644
@@ -55,6 +55,7 @@ unit/test-uuid
 unit/test-key
 unit/test-pbkdf2
 unit/test-dhcp
+unit/test-fswatch
 unit/cert-*.pem
 unit/cert-*.csr
 unit/cert-*.srl
Makefile.am +4 -1
index 8203fd4..9fe00fb 100644
@@ -147,7 +147,8 @@ unit_tests = unit/test-unit \
 			unit/test-base64 \
 			unit/test-uuid \
 			unit/test-pbkdf2 \
-			unit/test-dhcp
+			unit/test-dhcp \
+			unit/test-fswatch
 
 dbus_tests = unit/test-hwdb \
 			unit/test-dbus \
@@ -264,6 +265,8 @@ unit_test_uuid_LDADD = ell/libell-private.la
 
 unit_test_dhcp_LDADD = ell/libell-private.la
 
+unit_test_fswatch_LDADD = ell/libell-private.la
+
 if MAINTAINER_MODE
 noinst_LTLIBRARIES += unit/example-plugin.la
 endif
unit/test-fswatch.c new file +293 -0

293 lines not on this page · raw message

Signature · 1 line
2.14.1
#3 lore raw
In reply to Andrew Zaborowski

Hi Andrew,

Quoted 8 lines · Andrew Zaborowski

Make this macro available for the rest of ell in private.h and on the other hand remove from public header as it doesn't start with "L_". Note that IWD does optionally use it in rfkill.c and storage.c.

---
  ell/dbus.h    | 10 ----------
  ell/private.h | 11 +++++++++++
  2 files changed, 11 insertions(+), 10 deletions(-)

Applied, thanks.

Regards,
-Denis