[make-initrd] [PATCH 3/3] ueventd: Drop obsolete declarations

Alexey Gladkov gladkov.alexey at gmail.com
Sat May 20 19:37:48 MSK 2023


After the logging functions were moved to the common library, they were
not removed from the header.

Also includes have been grouped at the top of the header to increase
readability.

Fixes: 78769ff4 ("Move logging functions to the separate library")
Signed-off-by: Alexey Gladkov <gladkov.alexey at gmail.com>
---
 datasrc/ueventd/path.c            |  1 +
 datasrc/ueventd/queue-processor.c |  1 +
 datasrc/ueventd/ueventd.c         |  1 +
 datasrc/ueventd/ueventd.h         | 32 +++----------------------------
 4 files changed, 6 insertions(+), 29 deletions(-)

diff --git a/datasrc/ueventd/path.c b/datasrc/ueventd/path.c
index 835f4fbb..330e8c82 100644
--- a/datasrc/ueventd/path.c
+++ b/datasrc/ueventd/path.c
@@ -5,6 +5,7 @@
 #include <fcntl.h>
 #include <errno.h>
 
+#include "rd/logging.h"
 #include "ueventd.h"
 
 int is_dot_dir(struct dirent *ent)
diff --git a/datasrc/ueventd/queue-processor.c b/datasrc/ueventd/queue-processor.c
index b8383f51..908492a7 100644
--- a/datasrc/ueventd/queue-processor.c
+++ b/datasrc/ueventd/queue-processor.c
@@ -13,6 +13,7 @@
 #include <errno.h>
 
 #include "rd/memory.h"
+#include "rd/logging.h"
 #include "ueventd.h"
 
 static void event_handler(struct watch *queue, char *path) __attribute__((nonnull(1, 2)));
diff --git a/datasrc/ueventd/ueventd.c b/datasrc/ueventd/ueventd.c
index 2d510d62..857d3b4f 100644
--- a/datasrc/ueventd/ueventd.c
+++ b/datasrc/ueventd/ueventd.c
@@ -20,6 +20,7 @@
 #include <errno.h>
 
 #include "rd/memory.h"
+#include "rd/logging.h"
 #include "ueventd.h"
 
 #define default_logfile "/var/log/ueventd.log"
diff --git a/datasrc/ueventd/ueventd.h b/datasrc/ueventd/ueventd.h
index 375fa40f..653549f7 100644
--- a/datasrc/ueventd/ueventd.h
+++ b/datasrc/ueventd/ueventd.h
@@ -5,6 +5,8 @@
 
 #include <sys/types.h>
 #include <stdint.h>
+#include <unistd.h>
+#include <dirent.h>
 
 #define F_ROOT_DIR  (1 << 0)
 #define F_QUEUE_DIR (1 << 1)
@@ -31,8 +33,7 @@ extern uint64_t session;
 extern void process_events(struct watch *queue) __attribute__((nonnull(1), noreturn));
 
 /* path.c */
-#include <dirent.h>
-
+extern int is_dot_dir(struct dirent *ent)                           __attribute__((nonnull(1)));
 extern DIR *xopendir(const char *path)                              __attribute__((nonnull(1)));
 extern struct dirent *xreaddir(DIR *d, const char *path)            __attribute__((nonnull(1, 2)));
 extern int empty_directory(const char *path)                        __attribute__((nonnull(1)));
@@ -43,31 +44,4 @@ extern ssize_t write_loop(int fd, const char *buffer, size_t count) __attribute_
 /* process.c */
 extern pid_t waitpid_retry(pid_t pid, int *wstatus, int options);
 
-#include <dirent.h>
-
-extern  int is_dot_dir(struct dirent *ent) __attribute__((nonnull(1)));
-
-/* logging.c */
-#include <unistd.h>
-#include <syslog.h>
-#include <stdlib.h>
-#include <stdarg.h>
-
-extern void rd_logging_init(int log_fd, int level, const char *progname);
-extern void rd_logging_close(void);
-extern int rd_logging_level(const char *lvl)                           __attribute__((nonnull(1)));
-extern void rd_vmessage(const char *fmt, va_list ap)                   __attribute__((format(printf, 1, 0)));
-extern void rd_log_vmessage(int priority, const char *fmt, va_list ap) __attribute__((format(printf, 2, 0)));
-extern void rd_log_message(int priority, const char *fmt, ...)         __attribute__((format(printf, 2, 3)));
-
-#define rd_fatal(format, arg...)                    \
-	do {                                        \
-		rd_log_message(LOG_CRIT, "%s:%d: " format, __FILE__, __LINE__, ##arg); \
-		_exit(EXIT_FAILURE);                \
-	} while (0)
-
-#define rd_err(format, arg...)  rd_log_message(LOG_ERR,   format, ##arg)
-#define rd_info(format, arg...) rd_log_message(LOG_INFO,  format, ##arg)
-#define rd_dbg(format, arg...)  rd_log_message(LOG_DEBUG, format, ##arg)
-
 #endif /* __UEVENTD_H__ */
-- 
2.33.8



More information about the Make-initrd mailing list