1
0
mirror of https://github.com/systemd/systemd.git synced 2024-12-23 21:35:11 +03:00

[PATCH] add a test and simplify debug statement

This commit is contained in:
kay.sievers@vrfy.org 2005-03-13 07:14:49 +01:00 committed by Greg KH
parent 28ce66de17
commit 38285d23d7
4 changed files with 26 additions and 29 deletions

View File

@ -9,12 +9,13 @@ THE PLACE= key is gone. It can be replaced by an ID= for a long time, cause
we walk up the chain of physical devices to find a match.
The KEY="<value>" format supports '=', '==', '!=,' , '+=' now. This makes it
easier to skip certain devices without composing rules with weird character
class negations like:
easy to skip certain attribute matches without composing rules with weird
character class negations like:
KERNEL="[!s][!c][!d]*"
this can be replaced by:
this can now be replaced with:
KERNEL!="scd*"
The simple '=' is still supported, but the rules should be converted if
possible, to be better human-readable.
The current simple '=' is still supported, and should work as it does today,
but existing rules should be converted if possible, to be better readable.

View File

@ -1159,6 +1159,16 @@ EOF
conf => <<EOF
KERNEL=="sda1", PROGRAM!="/bin/false", NAME="nonzero-program"
BUS=="scsi", KERNEL=="sda1", NAME="wrong"
EOF
},
{
desc => "test for whitespace between the operator",
subsys => "block",
devpath => "/block/sda/sda1",
exp_name => "true",
conf => <<EOF
KERNEL == "sda1" , NAME = "true"
BUS=="scsi", KERNEL=="sda1", NAME="wrong"
EOF
},
);

View File

@ -20,8 +20,8 @@
*
*/
#ifndef NAMEDEV_H
#define NAMEDEV_H
#ifndef UDEV_RULES_H
#define UDEV_RULES_H
#include "libsysfs/sysfs/libsysfs.h"
#include "udev.h"
@ -106,7 +106,4 @@ extern int udev_rules_init(void);
extern int udev_rules_get_name(struct udevice *udev, struct sysfs_class_device *class_dev);
extern void udev_rules_close(void);
extern void udev_rule_dump(struct udev_rule *rule);
extern void udev_rule_list_dump(void);
#endif

View File

@ -39,38 +39,27 @@
LIST_HEAD(udev_rule_list);
static int add_config_dev(struct udev_rule *new_rule)
static int add_config_dev(struct udev_rule *rule)
{
struct udev_rule *tmp_rule;
tmp_rule = malloc(sizeof(*tmp_rule));
if (tmp_rule == NULL)
return -ENOMEM;
memcpy(tmp_rule, new_rule, sizeof(*tmp_rule));
memcpy(tmp_rule, rule, sizeof(struct udev_rule));
list_add_tail(&tmp_rule->node, &udev_rule_list);
udev_rule_dump(tmp_rule);
return 0;
}
void udev_rule_dump(struct udev_rule *rule)
{
dbg("name='%s', symlink='%s', bus='%s', id='%s', "
"sysfs_file[0]='%s', sysfs_value[0]='%s', "
"kernel='%s', program='%s', result='%s'"
"owner='%s', group='%s', mode=%#o",
"kernel='%s', program='%s', result='%s', "
"owner='%s', group='%s', mode=%#o, "
"all_partions=%u, ignore_remove=%u, ignore_device=%u, last_rule=%u",
rule->name, rule->symlink, rule->bus, rule->id,
rule->sysfs_pair[0].file, rule->sysfs_pair[0].value,
rule->kernel, rule->program, rule->result,
rule->owner, rule->group, rule->mode);
}
rule->kernel, rule->program, rule->result, rule->owner, rule->group, rule->mode,
rule->partitions, rule->ignore_remove, rule->ignore_device, rule->last_rule);
void udev_rule_list_dump(void)
{
struct udev_rule *rule;
list_for_each_entry(rule, &udev_rule_list, node)
udev_rule_dump(rule);
return 0;
}
static int get_key(char **line, char **key, enum key_operation *operation, char **value)