chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
fd18e1f
)
udev: introduce SYSTEMD_EXPOSE as binary udev property for hiding/showing devices...
author
Lennart Poettering
<lennart@poettering.net>
Wed, 7 Apr 2010 22:53:21 +0000
(
00:53
+0200)
committer
Lennart Poettering
<lennart@poettering.net>
Wed, 7 Apr 2010 22:53:21 +0000
(
00:53
+0200)
device.c
patch
|
blob
|
history
diff --git
a/device.c
b/device.c
index 5739af9e1a5afe10af8c6965b6d5c782969fad71..25661e05f80840a579f54e1fa41f71a8050292b9 100644
(file)
--- a/
device.c
+++ b/
device.c
@@
-112,7
+112,7
@@
static int device_add_escaped_name(Unit *u, const char *dn, bool make_id) {
}
static int device_process_new_device(Manager *m, struct udev_device *dev, bool update_state) {
}
static int device_process_new_device(Manager *m, struct udev_device *dev, bool update_state) {
- const char *dn, *names, *wants, *sysfs;
+ const char *dn, *names, *wants, *sysfs
, *expose
;
Unit *u = NULL;
int r;
char *e, *w, *state;
Unit *u = NULL;
int r;
char *e, *w, *state;
@@
-122,20
+122,32
@@
static int device_process_new_device(Manager *m, struct udev_device *dev, bool u
assert(m);
assert(m);
+ if (!(sysfs = udev_device_get_syspath(dev)))
+ return -ENOMEM;
+
/* Check whether this entry is even relevant for us. */
dn = udev_device_get_devnode(dev);
/* Check whether this entry is even relevant for us. */
dn = udev_device_get_devnode(dev);
+ expose = udev_device_get_property_value(dev, "SYSTEMD_EXPOSE");
names = udev_device_get_property_value(dev, "SYSTEMD_NAMES");
wants = udev_device_get_property_value(dev, "SYSTEMD_WANTS");
names = udev_device_get_property_value(dev, "SYSTEMD_NAMES");
wants = udev_device_get_property_value(dev, "SYSTEMD_WANTS");
- if (!dn && !names && !wants)
- return 0;
+ if (expose) {
+ int b;
+
+ if ((b = parse_boolean(expose)) < 0) {
+ log_error("Failed to parse SYSTEMD_EXPOSE udev property for device %s: %s", sysfs, expose);
+ return 0;
+ }
+
+ if (!b)
+ return 0;
+ } else
+ if (!dn && !names && !wants)
+ return 0;
/* Ok, seems kinda interesting. Now, let's see if this one
* already exists. */
/* Ok, seems kinda interesting. Now, let's see if this one
* already exists. */
- if (!(sysfs = udev_device_get_syspath(dev)))
- return -ENOMEM;
-
assert(sysfs[0] == '/');
if (!(e = unit_name_escape_path(sysfs+1, ".device")))
return -ENOMEM;
assert(sysfs[0] == '/');
if (!(e = unit_name_escape_path(sysfs+1, ".device")))
return -ENOMEM;