platform: expose nm_platform_link_get_udev_property() function

This commit is contained in:
Thomas Haller 2021-04-23 12:08:09 +02:00
parent 2c9924482a
commit 47fa919720
No known key found for this signature in database
GPG key ID: 29C2366E4DFC5728
2 changed files with 11 additions and 5 deletions

View file

@ -1441,8 +1441,11 @@ nm_platform_link_get_type_name(NMPlatform *self, int ifindex)
return obj->link.kind ?: "unknown";
}
static gboolean
link_get_udev_property(NMPlatform *self, int ifindex, const char *name, const char **out_value)
gboolean
nm_platform_link_get_udev_property(NMPlatform * self,
int ifindex,
const char * name,
const char **out_value)
{
struct udev_device *udevice = NULL;
const char * uproperty;
@ -1473,7 +1476,7 @@ nm_platform_link_get_unmanaged(NMPlatform *self, int ifindex, gboolean *unmanage
{
const char *value;
if (link_get_udev_property(self, ifindex, "NM_UNMANAGED", &value)) {
if (nm_platform_link_get_udev_property(self, ifindex, "NM_UNMANAGED", &value)) {
NM_SET_OUT(unmanaged, nm_udev_utils_property_as_boolean(value));
return TRUE;
}
@ -1633,8 +1636,7 @@ nm_platform_link_get_path(NMPlatform *self, int ifindex)
{
const char *value = NULL;
link_get_udev_property(self, ifindex, "ID_PATH", &value);
nm_platform_link_get_udev_property(self, ifindex, "ID_PATH", &value);
return value;
}

View file

@ -1840,6 +1840,10 @@ nm_platform_link_change_flags(NMPlatform *self, int ifindex, unsigned value, gbo
return nm_platform_link_change_flags_full(self, ifindex, value, set ? value : 0u);
}
gboolean nm_platform_link_get_udev_property(NMPlatform * self,
int ifindex,
const char * name,
const char **out_value);
const char *nm_platform_link_get_udi(NMPlatform *self, int ifindex);
const char *nm_platform_link_get_path(NMPlatform *self, int ifindex);