Merge pull request #25137 from yuwata/sd-device-drop-device-copy-properties

sd-device: drop unused device_copy_properties()
This commit is contained in:
Zbigniew Jędrzejewski-Szmek
2022-10-27 07:28:22 +02:00
committed by GitHub
3 changed files with 1 additions and 39 deletions

View File

@@ -664,7 +664,7 @@ int device_rename(sd_device *device, const char *name) {
return device_add_property_internal(device, "INTERFACE", name);
}
int device_shallow_clone(sd_device *device, sd_device **ret) {
static int device_shallow_clone(sd_device *device, sd_device **ret) {
_cleanup_(sd_device_unrefp) sd_device *dest = NULL;
const char *val = NULL;
int r;
@@ -737,32 +737,6 @@ int device_clone_with_db(sd_device *device, sd_device **ret) {
return 0;
}
int device_copy_properties(sd_device *device_dst, sd_device *device_src) {
const char *property, *value;
int r;
assert(device_dst);
assert(device_src);
r = device_properties_prepare(device_src);
if (r < 0)
return r;
ORDERED_HASHMAP_FOREACH_KEY(value, property, device_src->properties_db) {
r = device_add_property_aux(device_dst, property, value, true);
if (r < 0)
return r;
}
ORDERED_HASHMAP_FOREACH_KEY(value, property, device_src->properties) {
r = device_add_property_aux(device_dst, property, value, false);
if (r < 0)
return r;
}
return 0;
}
void device_cleanup_tags(sd_device *device) {
assert(device);

View File

@@ -54,9 +54,7 @@ int device_get_properties_nulstr(sd_device *device, const char **ret_nulstr, siz
int device_get_properties_strv(sd_device *device, char ***ret);
int device_rename(sd_device *device, const char *name);
int device_shallow_clone(sd_device *device, sd_device **ret);
int device_clone_with_db(sd_device *device, sd_device **ret);
int device_copy_properties(sd_device *device_dst, sd_device *device_src);
int device_tag_index(sd_device *dev, sd_device *dev_old, bool add);
int device_update_db(sd_device *device);

View File

@@ -293,15 +293,6 @@ static void test_sd_device_monitor_filter_remove(sd_device *device) {
assert_se(sd_event_loop(sd_device_monitor_get_event(monitor_client)) == 100);
}
static void test_device_copy_properties(sd_device *device) {
_cleanup_(sd_device_unrefp) sd_device *copy = NULL;
assert_se(device_shallow_clone(device, &copy) >= 0);
assert_se(device_copy_properties(copy, device) >= 0);
test_send_receive_one(copy, false, false, false);
}
int main(int argc, char *argv[]) {
_cleanup_(sd_device_unrefp) sd_device *loopback = NULL, *sda = NULL;
int r;
@@ -333,7 +324,6 @@ int main(int argc, char *argv[]) {
test_tag_filter(loopback);
test_sysattr_filter(loopback, "ifindex");
test_sd_device_monitor_filter_remove(loopback);
test_device_copy_properties(loopback);
r = sd_device_new_from_subsystem_sysname(&sda, "block", "sda");
if (r < 0) {