diff options
author | kay.sievers@vrfy.org <kay.sievers@vrfy.org> | 2004-03-10 22:35:37 -0800 |
---|---|---|
committer | Greg KH <gregkh@suse.de> | 2005-04-26 21:35:09 -0700 |
commit | e41016d3547ef704c0785ba197d36ef69de51260 (patch) | |
tree | 59dddd10a8d9bc90a84873e94d64650be7cf6577 /namedev.h | |
parent | 3e16482d259c4a768b24a82bc0ed0e3a77954210 (diff) |
[PATCH] allow to specify node permissions in the rule
This allows to set the permissions along with the rule.
This is not a general replacement for the permissions config, but it
may be easier sometimes for the user to specify the permissions along
with the rule, cause the permissions config file wants the final node
name to match, which seems sometimes a bit difficult to guess, if
format % chars are used in the NAME field.
Any value not given in the rule is still be read from the permissions
file or set to the default. This one will also work:
BUS="usb", KERNEL="video*", NAME="my-%k", OWNER="$local"
A few words to man page are also added and add_perm_dev() is moved into
namedev_parse.c where it belongs to.
Diffstat (limited to 'namedev.h')
-rw-r--r-- | namedev.h | 15 |
1 files changed, 14 insertions, 1 deletions
@@ -44,6 +44,9 @@ struct sysfs_class_device; #define FIELD_KERNEL "KERNEL" #define FIELD_NAME "NAME" #define FIELD_SYMLINK "SYMLINK" +#define FIELD_OWNER "OWNER" +#define FIELD_GROUP "GROUP" +#define FIELD_MODE "MODE" #define ATTR_PARTITIONS "all_partitions" #define PARTITIONS_COUNT 15 @@ -54,6 +57,14 @@ struct sysfs_class_device; #define RULEFILE_EXT ".rules" #define PERMFILE_EXT ".permissions" +#define set_empty_perms(dev, m, o, g) \ + if (dev->mode == 0) \ + dev->mode = m; \ + if (dev->owner[0] == '\0') \ + strfieldcpy(dev->owner, o); \ + if (dev->group[0] == '\0') \ + strfieldcpy(dev->group, g); + struct sysfs_pair { char file[FILE_SIZE]; char value[VALUE_SIZE]; @@ -71,6 +82,9 @@ struct config_device { char name[NAME_SIZE]; char symlink[NAME_SIZE]; struct sysfs_pair sysfs_pair[MAX_SYSFS_PAIRS]; + char owner[OWNER_SIZE]; + char group[GROUP_SIZE]; + unsigned int mode; int partitions; char config_file[NAME_SIZE]; int config_line; @@ -93,7 +107,6 @@ extern int namedev_name_device(struct sysfs_class_device *class_dev, struct udev extern int namedev_init_permissions(void); extern int namedev_init_rules(void); -extern int add_perm_dev(struct perm_device *new_dev); extern void dump_config_dev(struct config_device *dev); extern void dump_config_dev_list(void); extern void dump_perm_dev(struct perm_device *dev); |