summaryrefslogtreecommitdiff
path: root/src/shared
diff options
context:
space:
mode:
Diffstat (limited to 'src/shared')
-rw-r--r--src/shared/bus-errors.c85
-rw-r--r--src/shared/bus-errors.h3
-rw-r--r--src/shared/macro.h8
3 files changed, 50 insertions, 46 deletions
diff --git a/src/shared/bus-errors.c b/src/shared/bus-errors.c
index b6f65d205b..c347545c71 100644
--- a/src/shared/bus-errors.c
+++ b/src/shared/bus-errors.c
@@ -22,52 +22,55 @@
#include <errno.h>
#include "sd-bus.h"
+#include "bus-error.h"
#include "bus-errors.h"
-SD_BUS_ERROR_MAPPING(systemd_shared) = {
- {BUS_ERROR_NO_SUCH_UNIT, ENOENT},
- {BUS_ERROR_NO_UNIT_FOR_PID, ESRCH},
- {BUS_ERROR_UNIT_EXISTS, EEXIST},
- {BUS_ERROR_LOAD_FAILED, EIO},
- {BUS_ERROR_JOB_FAILED, EREMOTEIO},
- {BUS_ERROR_NO_SUCH_JOB, ENOENT},
- {BUS_ERROR_NOT_SUBSCRIBED, EINVAL},
- {BUS_ERROR_ALREADY_SUBSCRIBED, EINVAL},
- {BUS_ERROR_ONLY_BY_DEPENDENCY, EINVAL},
- {BUS_ERROR_TRANSACTION_JOBS_CONFLICTING, EDEADLOCK},
- {BUS_ERROR_TRANSACTION_ORDER_IS_CYCLIC, EDEADLOCK},
- {BUS_ERROR_TRANSACTION_IS_DESTRUCTIVE, EDEADLOCK},
- {BUS_ERROR_UNIT_MASKED, ENOSYS},
- {BUS_ERROR_JOB_TYPE_NOT_APPLICABLE, EBADR},
- {BUS_ERROR_NO_ISOLATION, EPERM},
- {BUS_ERROR_SHUTTING_DOWN, ECANCELED},
- {BUS_ERROR_SCOPE_NOT_RUNNING, EHOSTDOWN},
+BUS_ERROR_MAP_ELF_REGISTER const sd_bus_error_map shared_errors[] = {
+ SD_BUS_ERROR_MAP(BUS_ERROR_NO_SUCH_UNIT, ENOENT),
+ SD_BUS_ERROR_MAP(BUS_ERROR_NO_UNIT_FOR_PID, ESRCH),
+ SD_BUS_ERROR_MAP(BUS_ERROR_UNIT_EXISTS, EEXIST),
+ SD_BUS_ERROR_MAP(BUS_ERROR_LOAD_FAILED, EIO),
+ SD_BUS_ERROR_MAP(BUS_ERROR_JOB_FAILED, EREMOTEIO),
+ SD_BUS_ERROR_MAP(BUS_ERROR_NO_SUCH_JOB, ENOENT),
+ SD_BUS_ERROR_MAP(BUS_ERROR_NOT_SUBSCRIBED, EINVAL),
+ SD_BUS_ERROR_MAP(BUS_ERROR_ALREADY_SUBSCRIBED, EINVAL),
+ SD_BUS_ERROR_MAP(BUS_ERROR_ONLY_BY_DEPENDENCY, EINVAL),
+ SD_BUS_ERROR_MAP(BUS_ERROR_TRANSACTION_JOBS_CONFLICTING, EDEADLOCK),
+ SD_BUS_ERROR_MAP(BUS_ERROR_TRANSACTION_ORDER_IS_CYCLIC, EDEADLOCK),
+ SD_BUS_ERROR_MAP(BUS_ERROR_TRANSACTION_IS_DESTRUCTIVE, EDEADLOCK),
+ SD_BUS_ERROR_MAP(BUS_ERROR_UNIT_MASKED, ENOSYS),
+ SD_BUS_ERROR_MAP(BUS_ERROR_JOB_TYPE_NOT_APPLICABLE, EBADR),
+ SD_BUS_ERROR_MAP(BUS_ERROR_NO_ISOLATION, EPERM),
+ SD_BUS_ERROR_MAP(BUS_ERROR_SHUTTING_DOWN, ECANCELED),
+ SD_BUS_ERROR_MAP(BUS_ERROR_SCOPE_NOT_RUNNING, EHOSTDOWN),
- {BUS_ERROR_NO_SUCH_MACHINE, ENXIO},
- {BUS_ERROR_NO_MACHINE_FOR_PID, ENXIO},
- {BUS_ERROR_MACHINE_EXISTS, EEXIST},
- {BUS_ERROR_NO_PRIVATE_NETWORKING, ENOSYS},
+ SD_BUS_ERROR_MAP(BUS_ERROR_NO_SUCH_MACHINE, ENXIO),
+ SD_BUS_ERROR_MAP(BUS_ERROR_NO_MACHINE_FOR_PID, ENXIO),
+ SD_BUS_ERROR_MAP(BUS_ERROR_MACHINE_EXISTS, EEXIST),
+ SD_BUS_ERROR_MAP(BUS_ERROR_NO_PRIVATE_NETWORKING, ENOSYS),
- {BUS_ERROR_NO_SUCH_SESSION, ENXIO},
- {BUS_ERROR_NO_SESSION_FOR_PID, ENXIO},
- {BUS_ERROR_NO_SUCH_USER, ENXIO},
- {BUS_ERROR_NO_USER_FOR_PID, ENXIO},
- {BUS_ERROR_NO_SUCH_SEAT, ENXIO},
- {BUS_ERROR_SESSION_NOT_ON_SEAT, EINVAL},
- {BUS_ERROR_NOT_IN_CONTROL, EINVAL},
- {BUS_ERROR_DEVICE_IS_TAKEN, EINVAL},
- {BUS_ERROR_DEVICE_NOT_TAKEN, EINVAL},
- {BUS_ERROR_OPERATION_IN_PROGRESS, EINPROGRESS},
- {BUS_ERROR_SLEEP_VERB_NOT_SUPPORTED, ENOSYS},
+ SD_BUS_ERROR_MAP(BUS_ERROR_NO_SUCH_SESSION, ENXIO),
+ SD_BUS_ERROR_MAP(BUS_ERROR_NO_SESSION_FOR_PID, ENXIO),
+ SD_BUS_ERROR_MAP(BUS_ERROR_NO_SUCH_USER, ENXIO),
+ SD_BUS_ERROR_MAP(BUS_ERROR_NO_USER_FOR_PID, ENXIO),
+ SD_BUS_ERROR_MAP(BUS_ERROR_NO_SUCH_SEAT, ENXIO),
+ SD_BUS_ERROR_MAP(BUS_ERROR_SESSION_NOT_ON_SEAT, EINVAL),
+ SD_BUS_ERROR_MAP(BUS_ERROR_NOT_IN_CONTROL, EINVAL),
+ SD_BUS_ERROR_MAP(BUS_ERROR_DEVICE_IS_TAKEN, EINVAL),
+ SD_BUS_ERROR_MAP(BUS_ERROR_DEVICE_NOT_TAKEN, EINVAL),
+ SD_BUS_ERROR_MAP(BUS_ERROR_OPERATION_IN_PROGRESS, EINPROGRESS),
+ SD_BUS_ERROR_MAP(BUS_ERROR_SLEEP_VERB_NOT_SUPPORTED, ENOSYS),
- {BUS_ERROR_AUTOMATIC_TIME_SYNC_ENABLED, EALREADY},
+ SD_BUS_ERROR_MAP(BUS_ERROR_AUTOMATIC_TIME_SYNC_ENABLED, EALREADY),
- {BUS_ERROR_NO_SUCH_PROCESS, ESRCH},
+ SD_BUS_ERROR_MAP(BUS_ERROR_NO_SUCH_PROCESS, ESRCH),
- {BUS_ERROR_NO_NAME_SERVERS, EIO},
- {BUS_ERROR_INVALID_REPLY, EINVAL},
- {BUS_ERROR_NO_SUCH_RR, ENOENT},
- {BUS_ERROR_NO_RESOURCES, ENOMEM},
- {BUS_ERROR_CNAME_LOOP, EDEADLOCK},
- {BUS_ERROR_ABORTED, ECANCELED},
+ SD_BUS_ERROR_MAP(BUS_ERROR_NO_NAME_SERVERS, EIO),
+ SD_BUS_ERROR_MAP(BUS_ERROR_INVALID_REPLY, EINVAL),
+ SD_BUS_ERROR_MAP(BUS_ERROR_NO_SUCH_RR, ENOENT),
+ SD_BUS_ERROR_MAP(BUS_ERROR_NO_RESOURCES, ENOMEM),
+ SD_BUS_ERROR_MAP(BUS_ERROR_CNAME_LOOP, EDEADLOCK),
+ SD_BUS_ERROR_MAP(BUS_ERROR_ABORTED, ECANCELED),
+
+ SD_BUS_ERROR_MAP_END
};
diff --git a/src/shared/bus-errors.h b/src/shared/bus-errors.h
index 1bf19c3f39..e842f850c1 100644
--- a/src/shared/bus-errors.h
+++ b/src/shared/bus-errors.h
@@ -22,6 +22,7 @@
***/
#include "sd-bus.h"
+#include "bus-error.h"
#define BUS_ERROR_NO_SUCH_UNIT "org.freedesktop.systemd1.NoSuchUnit"
#define BUS_ERROR_NO_UNIT_FOR_PID "org.freedesktop.systemd1.NoUnitForPID"
@@ -70,4 +71,4 @@
#define BUS_ERROR_ABORTED "org.freedesktop.resolve1.Aborted"
#define _BUS_ERROR_DNS "org.freedesktop.resolve1.DnsError."
-SD_BUS_ERROR_MAPPING_USE(systemd_shared);
+BUS_ERROR_MAP_ELF_USE(shared_errors);
diff --git a/src/shared/macro.h b/src/shared/macro.h
index 9f5e4552b4..548294e47b 100644
--- a/src/shared/macro.h
+++ b/src/shared/macro.h
@@ -95,15 +95,15 @@
#error "Wut? Pointers are neither 4 nor 8 bytes long?"
#endif
-#define ALIGN_PTR(p) ((void*) ALIGN((unsigned long) p))
-#define ALIGN4_PTR(p) ((void*) ALIGN4((unsigned long) p))
-#define ALIGN8_PTR(p) ((void*) ALIGN8((unsigned long) p))
+#define ALIGN_PTR(p) ((void*) ALIGN((unsigned long) (p)))
+#define ALIGN4_PTR(p) ((void*) ALIGN4((unsigned long) (p)))
+#define ALIGN8_PTR(p) ((void*) ALIGN8((unsigned long) (p)))
static inline size_t ALIGN_TO(size_t l, size_t ali) {
return ((l + ali - 1) & ~(ali - 1));
}
-#define ALIGN_TO_PTR(p, ali) ((void*) ALIGN_TO((unsigned long) p, ali))
+#define ALIGN_TO_PTR(p, ali) ((void*) ALIGN_TO((unsigned long) (p), (ali)))
/* align to next higher power-of-2 (except for: 0 => 0, overflow => 0) */
static inline unsigned long ALIGN_POWER2(unsigned long u) {