summaryrefslogtreecommitdiffstats
path: root/init/devices.h
diff options
context:
space:
mode:
authorDaniel Leung <daniel.leung@intel.com>2012-07-02 11:32:30 -0700
committerDaniel Leung <daniel.leung@intel.com>2014-06-20 09:28:37 -0700
commitc0c1ffea588c7d3c565b79d4f8bf3d4a8f75abc9 (patch)
tree55daed17cfc3c1c820d8db3abc8310b0e8cab25e /init/devices.h
parent4f5392cb6c09618b968a4c86bbde079bef57afd1 (diff)
downloadsystem_core-c0c1ffea588c7d3c565b79d4f8bf3d4a8f75abc9.zip
system_core-c0c1ffea588c7d3c565b79d4f8bf3d4a8f75abc9.tar.gz
system_core-c0c1ffea588c7d3c565b79d4f8bf3d4a8f75abc9.tar.bz2
init/ueventd: adds wildcard matching for ueventd rules
The sysfs nodes can change from devices to devices for a particular class of peripheral. Some of them even change after suspend/resume, e.g. rfkill for USB bluetooth adapters. This patch adds to the way how ueventd rules with wildcard are handled. In addition to matching the prefix with a trailing wildcard, now rules can have wildcard anywhere in the rule. The wildcard matching is implemented using fnmatch(), where its matching is simliar to shell pathname expansion. It suits this particular usage model well. To avoid abuse, the number of slashes has to match between path name and the rule. For example, instead of creating a rule to match: /sys/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.3/2-1.3:1.0/bluetooth/hci0/rfkill* , this would suffice: /sys/devices/pci0000:00/0000:00:1d.0/*/*/*/*/bluetooth/hci0/rfkill* The prefix matching behavior is retained, such that those rules do not have to pay for processing penalty with fnmatch(). Change-Id: I3ae6a39c838f6d12801cb71958e481b016f731f5 Signed-off-by: Daniel Leung <daniel.leung@intel.com>
Diffstat (limited to 'init/devices.h')
-rw-r--r--init/devices.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/init/devices.h b/init/devices.h
index a84fa58..5d0fe88 100644
--- a/init/devices.h
+++ b/init/devices.h
@@ -23,6 +23,7 @@ extern void handle_device_fd();
extern void device_init(void);
extern int add_dev_perms(const char *name, const char *attr,
mode_t perm, unsigned int uid,
- unsigned int gid, unsigned short prefix);
+ unsigned int gid, unsigned short prefix,
+ unsigned short wildcard);
int get_device_fd();
#endif /* _INIT_DEVICES_H */