Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
NetworkManager
NetworkManager
Commits
b4c36869
Commit
b4c36869
authored
May 20, 2014
by
Dan Williams
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
core: let NMDevice export itself
Saves some code and a memory allocation.
parent
c958540b
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
12 deletions
+9
-12
src/devices/nm-device.c
src/devices/nm-device.c
+7
-4
src/devices/nm-device.h
src/devices/nm-device.h
+1
-1
src/nm-manager.c
src/nm-manager.c
+1
-7
No files found.
src/devices/nm-device.c
View file @
b4c36869
...
...
@@ -453,16 +453,19 @@ device_has_capability (NMDevice *device, NMDeviceCapabilities caps)
/***********************************************************/
void
nm_device_
set_path
(
NMDevice
*
self
,
const
char
*
path
)
nm_device_
dbus_export
(
NMDevice
*
device
)
{
static
guint32
devcount
=
0
;
NMDevicePrivate
*
priv
;
g_return_if_fail
(
self
!=
NULL
);
g_return_if_fail
(
NM_IS_DEVICE
(
device
)
);
priv
=
NM_DEVICE_GET_PRIVATE
(
self
);
priv
=
NM_DEVICE_GET_PRIVATE
(
device
);
g_return_if_fail
(
priv
->
path
==
NULL
);
priv
->
path
=
g_strdup
(
path
);
priv
->
path
=
g_strdup_printf
(
"/org/freedesktop/NetworkManager/Devices/%d"
,
devcount
++
);
nm_log_info
(
LOGD_DEVICE
,
"(%s): exported as %s"
,
priv
->
iface
,
priv
->
path
);
nm_dbus_manager_register_object
(
nm_dbus_manager_get
(),
priv
->
path
,
device
);
}
const
char
*
...
...
src/devices/nm-device.h
View file @
b4c36869
...
...
@@ -218,7 +218,7 @@ typedef void (*NMDeviceAuthRequestFunc) (NMDevice *device,
GType
nm_device_get_type
(
void
);
const
char
*
nm_device_get_path
(
NMDevice
*
dev
);
void
nm_device_
set_path
(
NMDevice
*
dev
,
const
char
*
path
);
void
nm_device_
dbus_export
(
NMDevice
*
dev
ice
);
const
char
*
nm_device_get_udi
(
NMDevice
*
dev
);
const
char
*
nm_device_get_iface
(
NMDevice
*
dev
);
...
...
src/nm-manager.c
View file @
b4c36869
...
...
@@ -1682,8 +1682,6 @@ add_device (NMManager *self, NMDevice *device, gboolean generate_con)
{
NMManagerPrivate
*
priv
=
NM_MANAGER_GET_PRIVATE
(
self
);
const
char
*
iface
,
*
driver
,
*
type_desc
;
char
*
path
;
static
guint32
devcount
=
0
;
const
GSList
*
unmanaged_specs
;
gboolean
user_unmanaged
,
sleeping
;
NMConnection
*
connection
=
NULL
;
...
...
@@ -1760,11 +1758,7 @@ add_device (NMManager *self, NMDevice *device, gboolean generate_con)
sleeping
=
manager_sleeping
(
self
);
nm_device_set_initial_unmanaged_flag
(
device
,
NM_UNMANAGED_INTERNAL
,
sleeping
);
path
=
g_strdup_printf
(
"/org/freedesktop/NetworkManager/Devices/%d"
,
devcount
++
);
nm_device_set_path
(
device
,
path
);
nm_dbus_manager_register_object
(
priv
->
dbus_mgr
,
path
,
device
);
nm_log_info
(
LOGD_CORE
,
"(%s): exported as %s"
,
iface
,
path
);
g_free
(
path
);
nm_device_dbus_export
(
device
);
/* Don't generate a connection e.g. for devices NM just created, or
* for the loopback, or when we're sleeping. */
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment