sd-device: move copy_all_tags() from udev

No functional change, preparation for the next commit.
This commit is contained in:
Yu Watanabe
2026-02-23 05:46:42 +09:00
parent b65467b647
commit 1c867dc71a
3 changed files with 19 additions and 18 deletions
+17
View File
@@ -693,6 +693,23 @@ int device_clone_with_db(sd_device *device, sd_device **ret) {
return 0;
}
int device_copy_all_tags(sd_device *dest, sd_device *src) {
int r;
assert(dest);
if (!src)
return 0;
FOREACH_DEVICE_TAG(src, tag) {
r = device_add_tag(dest, tag, /* both= */ false);
if (r < 0)
return r;
}
return 0;
}
void device_cleanup_tags(sd_device *device) {
assert(device);
@@ -45,6 +45,7 @@ int device_add_property(sd_device *device, const char *key, const char *value);
int device_add_propertyf(sd_device *device, const char *key, const char *format, ...) _printf_(3, 4);
int device_add_tag(sd_device *device, const char *tag, bool both);
void device_remove_tag(sd_device *device, const char *tag);
int device_copy_all_tags(sd_device *dest, sd_device *src);
void device_cleanup_tags(sd_device *device);
void device_cleanup_devlinks(sd_device *device);