summaryrefslogtreecommitdiff
path: root/src/shared/udev-util.c
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2020-12-08 22:36:42 +0900
committerYu Watanabe <watanabe.yu+github@gmail.com>2020-12-10 12:26:19 +0900
commitb2d9e58f789fd691483e364d8a9fa5ee0c415c45 (patch)
tree4ebaca4ff1a866c1f1be7185a5da101a01e3b148 /src/shared/udev-util.c
parent481f24d1f6ffb2535bce6531c2c67b7fdffdff56 (diff)
downloadsystemd-b2d9e58f789fd691483e364d8a9fa5ee0c415c45.tar.gz
udev: introduce log_device_uevent() helper function
And this drops duplicated check for seqnum and device action.
Diffstat (limited to 'src/shared/udev-util.c')
-rw-r--r--src/shared/udev-util.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/shared/udev-util.c b/src/shared/udev-util.c
index 030922eca9..411b1f704b 100644
--- a/src/shared/udev-util.c
+++ b/src/shared/udev-util.c
@@ -324,6 +324,20 @@ bool device_for_action(sd_device *dev, DeviceAction action) {
return a == action;
}
+void log_device_uevent(sd_device *device, const char *str) {
+ DeviceAction action = _DEVICE_ACTION_INVALID;
+ uint64_t seqnum = 0;
+
+ if (!DEBUG_LOGGING)
+ return;
+
+ (void) device_get_seqnum(device, &seqnum);
+ (void) device_get_action(device, &action);
+ log_device_debug(device, "%s%s(SEQNUM=%"PRIu64", ACTION=%s)",
+ strempty(str), isempty(str) ? "" : " ",
+ seqnum, strna(device_action_to_string(action)));
+}
+
int udev_rule_parse_value(char *str, char **ret_value, char **ret_endpos) {
char *i, *j;
int r;