mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-01-09 01:50:21 +01:00
platform: add nm-platform-utils.[ch] files
There is no general purpose file for platform utilities.
We only have nm-platform.h, which contains (mostly) functions
that operate on a NMPlatform instance (and that can be mocked
using NMFakePlatform).
Add a new file for independent utility functions. nm-platform-utils.c
should not call into functions having a NMPlatform instance, to
have them independent from platform caching and the platform
singleton.
(cherry picked from commit ce700d94f5)
This commit is contained in:
parent
4e0af0aa52
commit
cd2d241fb7
6 changed files with 107 additions and 4 deletions
|
|
@ -220,6 +220,8 @@ nm_sources = \
|
|||
platform/nm-linux-platform.h \
|
||||
platform/nm-platform.c \
|
||||
platform/nm-platform.h \
|
||||
platform/nm-platform-utils.c \
|
||||
platform/nm-platform-utils.h \
|
||||
platform/wifi/wifi-utils-nl80211.c \
|
||||
platform/wifi/wifi-utils-nl80211.h \
|
||||
platform/wifi/wifi-utils-private.h \
|
||||
|
|
@ -477,6 +479,8 @@ libnm_iface_helper_la_SOURCES = \
|
|||
platform/nm-linux-platform.h \
|
||||
platform/nm-platform.c \
|
||||
platform/nm-platform.h \
|
||||
platform/nm-platform-utils.c \
|
||||
platform/nm-platform-utils.h \
|
||||
platform/wifi/wifi-utils-nl80211.c \
|
||||
platform/wifi/wifi-utils-nl80211.h \
|
||||
platform/wifi/wifi-utils-private.h \
|
||||
|
|
|
|||
23
src/platform/nm-platform-utils.c
Normal file
23
src/platform/nm-platform-utils.c
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
|
||||
/* nm-platform.c - Handle runtime kernel networking configuration
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Copyright (C) 2015 Red Hat, Inc.
|
||||
*/
|
||||
|
||||
#include "nm-platform-utils.h"
|
||||
|
||||
|
||||
29
src/platform/nm-platform-utils.h
Normal file
29
src/platform/nm-platform-utils.h
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
|
||||
/* nm-platform.c - Handle runtime kernel networking configuration
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Copyright (C) 2015 Red Hat, Inc.
|
||||
*/
|
||||
|
||||
#ifndef __NM_PLATFORM_UTILS_H__
|
||||
#define __NM_PLATFORM_UTILS_H__
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "nm-platform.h"
|
||||
|
||||
|
||||
#endif /* __NM_PLATFORM_UTILS_H__ */
|
||||
9
src/platform/tests/.gitignore
vendored
9
src/platform/tests/.gitignore
vendored
|
|
@ -1,11 +1,12 @@
|
|||
/dump
|
||||
/monitor
|
||||
/platform
|
||||
/test-link-fake
|
||||
/test-link-linux
|
||||
/test-address-fake
|
||||
/test-address-linux
|
||||
/test-cleanup-fake
|
||||
/test-cleanup-linux
|
||||
/test-general
|
||||
/test-link-fake
|
||||
/test-link-linux
|
||||
/test-route-fake
|
||||
/test-route-linux
|
||||
/test-cleanup-fake
|
||||
/test-cleanup-linux
|
||||
|
|
@ -37,6 +37,7 @@ noinst_PROGRAMS = \
|
|||
test-link-linux \
|
||||
test-address-fake \
|
||||
test-address-linux \
|
||||
test-general \
|
||||
test-route-fake \
|
||||
test-route-linux \
|
||||
test-cleanup-fake \
|
||||
|
|
@ -109,12 +110,19 @@ test_cleanup_linux_CPPFLAGS = \
|
|||
-DKERNEL_HACKS=1
|
||||
test_cleanup_linux_LDADD = $(PLATFORM_LDADD)
|
||||
|
||||
test_general_SOURCES = \
|
||||
test-general.c
|
||||
test_general_LDADD = \
|
||||
$(top_builddir)/src/libNetworkManager.la
|
||||
|
||||
|
||||
@VALGRIND_RULES@
|
||||
TESTS = \
|
||||
test-address-fake \
|
||||
test-address-linux \
|
||||
test-cleanup-fake \
|
||||
test-cleanup-linux \
|
||||
test-general \
|
||||
test-link-fake \
|
||||
test-link-linux \
|
||||
test-route-fake \
|
||||
|
|
|
|||
38
src/platform/tests/test-general.c
Normal file
38
src/platform/tests/test-general.c
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
|
||||
/* nm-platform.c - Handle runtime kernel networking configuration
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Copyright (C) 2015 Red Hat, Inc.
|
||||
*/
|
||||
|
||||
#include "nm-platform-utils.h"
|
||||
|
||||
#include "nm-logging.h"
|
||||
|
||||
#include "nm-test-utils.h"
|
||||
|
||||
|
||||
/******************************************************************/
|
||||
|
||||
NMTST_DEFINE ();
|
||||
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
nmtst_init_assert_logging (&argc, &argv, "INFO", "DEFAULT");
|
||||
|
||||
return g_test_run ();
|
||||
}
|
||||
Loading…
Add table
Reference in a new issue