summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2021-01-13 15:11:10 +0100
committerThomas Haller <thaller@redhat.com>2021-03-08 22:29:01 +0100
commit8dbfbce9f6cc71d70c77817c6856700d0e0e1d75 (patch)
tree785bd16560e5f941cb9107e59055f93ff39f95c4
parent597ad6aa8af62f9c3684f29d26a03423ee4d9204 (diff)
downloadNetworkManager-8dbfbce9f6cc71d70c77817c6856700d0e0e1d75.tar.gz
platform: add NM_LINUX_PLATFORM_FROM_PRIVATE() helper function
-rw-r--r--src/libnm-platform/nm-linux-platform.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/libnm-platform/nm-linux-platform.c b/src/libnm-platform/nm-linux-platform.c
index d689dfae63..10f4bf86a2 100644
--- a/src/libnm-platform/nm-linux-platform.c
+++ b/src/libnm-platform/nm-linux-platform.c
@@ -463,6 +463,18 @@ G_DEFINE_TYPE(NMLinuxPlatform, nm_linux_platform, NM_TYPE_PLATFORM)
#define NM_LINUX_PLATFORM_GET_PRIVATE(self) \
_NM_GET_PRIVATE(self, NMLinuxPlatform, NM_IS_LINUX_PLATFORM, NMPlatform)
+static NMPlatform *
+NM_LINUX_PLATFORM_FROM_PRIVATE(NMLinuxPlatformPrivate *priv)
+{
+ gpointer self;
+
+ nm_assert(priv);
+
+ self = (((char *) priv) - G_STRUCT_OFFSET(NMLinuxPlatform, _priv));
+ nm_assert(NM_IS_LINUX_PLATFORM(self));
+ return self;
+}
+
/*****************************************************************************/
#define _NMLOG_PREFIX_NAME "platform-linux"