mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-03-31 07:40:39 +02:00
platform/trivial: move code in nm-platform.c
Signed-off-by: Thomas Haller <thaller@redhat.com>
This commit is contained in:
parent
3744544920
commit
fa18bd6e0a
1 changed files with 21 additions and 21 deletions
|
|
@ -1448,6 +1448,27 @@ nm_platform_mesh_set_ssid (int ifindex, const guint8 *ssid, gsize len)
|
|||
return klass->mesh_set_ssid (platform, ifindex, ssid, len);
|
||||
}
|
||||
|
||||
#define TO_STRING_DEV_BUF_SIZE (5+15+1)
|
||||
static void
|
||||
_to_string_dev (int ifindex, char *buf, size_t size)
|
||||
{
|
||||
g_assert (buf && size >= TO_STRING_DEV_BUF_SIZE);
|
||||
|
||||
if (ifindex) {
|
||||
const char *name = ifindex > 0 ? nm_platform_link_get_name (ifindex) : NULL;
|
||||
|
||||
strcpy (buf, " dev ");
|
||||
buf += 5;
|
||||
size -= 5;
|
||||
|
||||
if (name)
|
||||
g_strlcpy (buf, name, size);
|
||||
else
|
||||
g_snprintf (buf, size, "%d", ifindex);
|
||||
} else
|
||||
buf[0] = 0;
|
||||
}
|
||||
|
||||
/******************************************************************/
|
||||
|
||||
GArray *
|
||||
|
|
@ -2132,27 +2153,6 @@ source_to_string (NMPlatformSource source)
|
|||
return "unknown";
|
||||
}
|
||||
|
||||
#define TO_STRING_DEV_BUF_SIZE (5+15+1)
|
||||
static void
|
||||
_to_string_dev (int ifindex, char *buf, size_t size)
|
||||
{
|
||||
g_assert (buf && size >= TO_STRING_DEV_BUF_SIZE);
|
||||
|
||||
if (ifindex){
|
||||
const char *name = ifindex > 0 ? nm_platform_link_get_name (ifindex) : NULL;
|
||||
|
||||
strcpy (buf, " dev ");
|
||||
buf += 5;
|
||||
size -= 5;
|
||||
|
||||
if (name)
|
||||
g_strlcpy (buf, name, size);
|
||||
else
|
||||
g_snprintf (buf, size, "%d", ifindex);
|
||||
} else
|
||||
buf[0] = 0;
|
||||
}
|
||||
|
||||
static const char *
|
||||
_lifetime_to_string (guint32 timestamp, guint32 lifetime, gint32 now, char *buf, size_t buf_size)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue