chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
core, libsystemd, systemd, timedate, udev: spelling fixes
[elogind.git]
/
src
/
udev
/
udev-builtin-net_setup_link.c
diff --git
a/src/udev/udev-builtin-net_setup_link.c
b/src/udev/udev-builtin-net_setup_link.c
index 739221ba2b3f4f8f6f305842d587198aea4dca68..3cd384e94dc8ecf144dc039317175fc9bc7a959c 100644
(file)
--- a/
src/udev/udev-builtin-net_setup_link.c
+++ b/
src/udev/udev-builtin-net_setup_link.c
@@
-23,9
+23,11
@@
#include "udev.h"
#include "log.h"
#include "udev.h"
#include "log.h"
-
link_config_ctx *ctx
;
+
static link_config_ctx *ctx = NULL
;
static int builtin_net_setup_link(struct udev_device *dev, int argc, char **argv, bool test) {
static int builtin_net_setup_link(struct udev_device *dev, int argc, char **argv, bool test) {
+ _cleanup_free_ char *driver = NULL;
+ const char *name;
link_config *link;
int r;
link_config *link;
int r;
@@
-34,6
+36,10
@@
static int builtin_net_setup_link(struct udev_device *dev, int argc, char **argv
return EXIT_FAILURE;
}
return EXIT_FAILURE;
}
+ r = link_get_driver(ctx, dev, &driver);
+ if (r >= 0)
+ udev_builtin_add_property(dev, test, "ID_NET_DRIVER", driver);
+
r = link_config_get(ctx, dev, &link);
if (r < 0) {
if (r == -ENOENT) {
r = link_config_get(ctx, dev, &link);
if (r < 0) {
if (r == -ENOENT) {
@@
-45,12
+51,15
@@
static int builtin_net_setup_link(struct udev_device *dev, int argc, char **argv
}
}
}
}
- r = link_config_apply(ctx, link, dev);
+ r = link_config_apply(ctx, link, dev
, &name
);
if (r < 0) {
log_error("Could not apply link config to %s", udev_device_get_sysname(dev));
return EXIT_FAILURE;
}
if (r < 0) {
log_error("Could not apply link config to %s", udev_device_get_sysname(dev));
return EXIT_FAILURE;
}
+ if (name)
+ udev_builtin_add_property(dev, test, "ID_NET_NAME", name);
+
return EXIT_SUCCESS;
}
return EXIT_SUCCESS;
}
@@
-74,6
+83,7
@@
static int builtin_net_setup_link_init(struct udev *udev) {
static void builtin_net_setup_link_exit(struct udev *udev) {
link_config_ctx_free(ctx);
static void builtin_net_setup_link_exit(struct udev *udev) {
link_config_ctx_free(ctx);
+ ctx = NULL;
log_debug("Unloaded link configuration context");
}
log_debug("Unloaded link configuration context");
}