Coverage Report

Created: 2022-04-19 08:24

/src/systemd/src/shared/bus-get-properties.h
Line
Count
Source (jump to first uncovered line)
1
/* SPDX-License-Identifier: LGPL-2.1-or-later */
2
#pragma once
3
4
#include "sd-bus.h"
5
6
#include "macro.h"
7
8
int bus_property_get_bool(sd_bus *bus, const char *path, const char *interface, const char *property, sd_bus_message *reply, void *userdata, sd_bus_error *error);
9
int bus_property_set_bool(sd_bus *bus, const char *path, const char *interface, const char *property, sd_bus_message *value, void *userdata, sd_bus_error *error);
10
int bus_property_get_id128(sd_bus *bus, const char *path, const char *interface, const char *property, sd_bus_message *reply, void *userdata, sd_bus_error *error);
11
12
#define bus_property_get_usec ((sd_bus_property_get_t) NULL)
13
#define bus_property_set_usec ((sd_bus_property_set_t) NULL)
14
15
assert_cc(sizeof(int) == sizeof(int32_t));
16
#define bus_property_get_int ((sd_bus_property_get_t) NULL)
17
18
assert_cc(sizeof(unsigned) == sizeof(uint32_t));
19
#define bus_property_get_unsigned ((sd_bus_property_get_t) NULL)
20
21
/* On 64bit machines we can use the default serializer for size_t and
22
 * friends, otherwise we need to cast this manually */
23
#if __SIZEOF_SIZE_T__ == 8
24
#define bus_property_get_size ((sd_bus_property_get_t) NULL)
25
#else
26
int bus_property_get_size(sd_bus *bus, const char *path, const char *interface, const char *property, sd_bus_message *reply, void *userdata, sd_bus_error *error);
27
#endif
28
29
#if __SIZEOF_LONG__ == 8
30
#define bus_property_get_long ((sd_bus_property_get_t) NULL)
31
#define bus_property_get_ulong ((sd_bus_property_get_t) NULL)
32
#else
33
int bus_property_get_long(sd_bus *bus, const char *path, const char *interface, const char *property, sd_bus_message *reply, void *userdata, sd_bus_error *error);
34
int bus_property_get_ulong(sd_bus *bus, const char *path, const char *interface, const char *property, sd_bus_message *reply, void *userdata, sd_bus_error *error);
35
#endif
36
37
/* uid_t and friends on Linux 32 bit. This means we can just use the
38
 * default serializer for 32bit unsigned, for serializing it, and map
39
 * it to NULL here */
40
assert_cc(sizeof(uid_t) == sizeof(uint32_t));
41
#define bus_property_get_uid ((sd_bus_property_get_t) NULL)
42
43
assert_cc(sizeof(gid_t) == sizeof(uint32_t));
44
#define bus_property_get_gid ((sd_bus_property_get_t) NULL)
45
46
assert_cc(sizeof(pid_t) == sizeof(uint32_t));
47
#define bus_property_get_pid ((sd_bus_property_get_t) NULL)
48
49
assert_cc(sizeof(mode_t) == sizeof(uint32_t));
50
#define bus_property_get_mode ((sd_bus_property_get_t) NULL)
51
52
int bus_property_get_rlimit(sd_bus *bus, const char *path, const char *interface, const char *property, sd_bus_message *reply, void *userdata, sd_bus_error *error);
53
54
#define BUS_DEFINE_PROPERTY_GET_GLOBAL(function, bus_type, val)         \
55
        int function(sd_bus *bus,                                       \
56
                     const char *path,                                  \
57
                     const char *interface,                             \
58
                     const char *property,                              \
59
                     sd_bus_message *reply,                             \
60
                     void *userdata,                                    \
61
0
                     sd_bus_error *error) {                             \
62
0
                                                                        \
63
0
                assert(bus);                                            \
64
0
                assert(reply);                                          \
65
0
                                                                        \
66
0
                return sd_bus_message_append(reply, bus_type, val);     \
67
0
        }
Unexecuted instantiation: bus_property_get_log_target
Unexecuted instantiation: bus_property_get_syslog_identifier
Unexecuted instantiation: dbus-execute.c:property_get_empty_string
Unexecuted instantiation: dbus-manager.c:property_get_version
Unexecuted instantiation: dbus-manager.c:property_get_features
Unexecuted instantiation: dbus-manager.c:property_get_architecture
Unexecuted instantiation: dbus-manager.c:property_get_timer_slack_nsec
Unexecuted instantiation: dbus-unit.c:property_get_empty_strv
68
69
#define BUS_DEFINE_PROPERTY_GET2(function, bus_type, data_type, get1, get2) \
70
        int function(sd_bus *bus,                                       \
71
                     const char *path,                                  \
72
                     const char *interface,                             \
73
                     const char *property,                              \
74
                     sd_bus_message *reply,                             \
75
                     void *userdata,                                    \
76
0
                     sd_bus_error *error) {                             \
77
0
                                                                        \
78
0
                data_type *data = userdata;                             \
79
0
                                                                        \
80
0
                assert(bus);                                            \
81
0
                assert(reply);                                          \
82
0
                assert(data);                                           \
83
0
                                                                        \
84
0
                return sd_bus_message_append(reply, bus_type,           \
85
0
                                             get2(get1(data)));         \
86
0
        }
Unexecuted instantiation: property_get_operational_state
Unexecuted instantiation: property_get_carrier_state
Unexecuted instantiation: property_get_address_state
Unexecuted instantiation: property_get_online_state
Unexecuted instantiation: networkd-link-bus.c:property_get_administrative_state
Unexecuted instantiation: dbus-automount.c:property_get_result
Unexecuted instantiation: bus_property_get_tasks_max
Unexecuted instantiation: dbus-cgroup.c:property_get_cgroup_device_policy
Unexecuted instantiation: dbus-cgroup.c:property_get_managed_oom_mode
Unexecuted instantiation: dbus-cgroup.c:property_get_managed_oom_preference
Unexecuted instantiation: bus_property_get_exec_output
Unexecuted instantiation: dbus-execute.c:property_get_ioprio_class
Unexecuted instantiation: dbus-execute.c:property_get_ioprio_priority
Unexecuted instantiation: dbus-execute.c:property_get_cpu_affinity_from_numa
Unexecuted instantiation: dbus-execute.c:property_get_exec_input
Unexecuted instantiation: dbus-execute.c:property_get_syslog_level
Unexecuted instantiation: dbus-execute.c:property_get_syslog_facility
Unexecuted instantiation: dbus-execute.c:property_get_protect_home
Unexecuted instantiation: dbus-execute.c:property_get_protect_system
Unexecuted instantiation: dbus-execute.c:property_get_exec_utmp_mode
Unexecuted instantiation: dbus-execute.c:property_get_personality
Unexecuted instantiation: dbus-execute.c:property_get_exec_preserve_mode
Unexecuted instantiation: dbus-execute.c:property_get_mount_apivfs
Unexecuted instantiation: dbus-execute.c:property_get_exec_keyring_mode
Unexecuted instantiation: dbus-execute.c:property_get_protect_proc
Unexecuted instantiation: dbus-execute.c:property_get_proc_subset
Unexecuted instantiation: dbus-execute.c:property_get_ioprio
Unexecuted instantiation: dbus-job.c:property_get_type
Unexecuted instantiation: dbus-job.c:property_get_state
Unexecuted instantiation: dbus-kill.c:property_get_kill_mode
Unexecuted instantiation: bus_property_get_oom_policy
Unexecuted instantiation: bus_property_get_emergency_action
Unexecuted instantiation: dbus-manager.c:property_get_hashmap_size
Unexecuted instantiation: dbus-manager.c:property_get_set_size
Unexecuted instantiation: dbus-manager.c:property_get_system_state
Unexecuted instantiation: dbus-manager.c:property_get_default_timeout_abort_usec
Unexecuted instantiation: dbus-mount.c:property_get_what
Unexecuted instantiation: dbus-mount.c:property_get_options
Unexecuted instantiation: dbus-mount.c:property_get_type
Unexecuted instantiation: dbus-mount.c:property_get_result
Unexecuted instantiation: dbus-path.c:property_get_result
Unexecuted instantiation: dbus-scope.c:property_get_result
Unexecuted instantiation: dbus-service.c:property_get_type
Unexecuted instantiation: dbus-service.c:property_get_exit_type
Unexecuted instantiation: dbus-service.c:property_get_restart
Unexecuted instantiation: dbus-service.c:property_get_notify_access
Unexecuted instantiation: dbus-service.c:property_get_timeout_abort_usec
Unexecuted instantiation: dbus-service.c:property_get_timeout_failure_mode
Unexecuted instantiation: dbus-service.c:property_get_watchdog_usec
Unexecuted instantiation: dbus-service.c:property_get_result
Unexecuted instantiation: dbus-service.c:property_get_emergency_action
Unexecuted instantiation: dbus-socket.c:property_get_bind_ipv6_only
Unexecuted instantiation: dbus-socket.c:property_get_timestamping
Unexecuted instantiation: dbus-socket.c:property_get_result
Unexecuted instantiation: dbus-socket.c:property_get_fdname
Unexecuted instantiation: dbus-swap.c:property_get_priority
Unexecuted instantiation: dbus-swap.c:property_get_options
Unexecuted instantiation: dbus-swap.c:property_get_result
Unexecuted instantiation: dbus-timer.c:property_get_result
Unexecuted instantiation: dbus-unit.c:property_get_description
Unexecuted instantiation: dbus-unit.c:property_get_load_state
Unexecuted instantiation: dbus-unit.c:property_get_active_state
Unexecuted instantiation: dbus-unit.c:property_get_freezer_state
Unexecuted instantiation: dbus-unit.c:property_get_sub_state
Unexecuted instantiation: dbus-unit.c:property_get_unit_file_state
Unexecuted instantiation: dbus-unit.c:property_get_can_start
Unexecuted instantiation: dbus-unit.c:property_get_can_stop
Unexecuted instantiation: dbus-unit.c:property_get_can_reload
Unexecuted instantiation: dbus-unit.c:property_get_can_isolate
Unexecuted instantiation: dbus-unit.c:property_get_can_freeze
Unexecuted instantiation: dbus-unit.c:property_get_job_mode
Unexecuted instantiation: dbus-unit.c:property_get_need_daemon_reload
Unexecuted instantiation: dbus-unit.c:property_get_collect_mode
87
88
0
#define ident(x) (x)
89
#define BUS_DEFINE_PROPERTY_GET(function, bus_type, data_type, get1) \
90
0
        BUS_DEFINE_PROPERTY_GET2(function, bus_type, data_type, get1, ident)
91
92
0
#define ref(x) (*(x))
93
#define BUS_DEFINE_PROPERTY_GET_REF(function, bus_type, data_type, get) \
94
0
        BUS_DEFINE_PROPERTY_GET2(function, bus_type, data_type, ref, get)
95
96
#define BUS_DEFINE_PROPERTY_GET_ENUM(function, name, type)              \
97
        BUS_DEFINE_PROPERTY_GET_REF(function, "s", type, name##_to_string)
98
99
#define BUS_PROPERTY_DUAL_TIMESTAMP(name, offset, flags) \
100
        SD_BUS_PROPERTY(name, "t", bus_property_get_usec, (offset) + offsetof(struct dual_timestamp, realtime), (flags)), \
101
        SD_BUS_PROPERTY(name "Monotonic", "t", bus_property_get_usec, (offset) + offsetof(struct dual_timestamp, monotonic), (flags))