diff options
author | kay.sievers@vrfy.org <kay.sievers@vrfy.org> | 2003-12-07 09:12:07 -0800 |
---|---|---|
committer | Greg KH <gregkh@suse.de> | 2005-04-26 21:13:06 -0700 |
commit | 3d150dfb28efbaf0b25f154fb8955c47d606c3d5 (patch) | |
tree | d94d704c7c0aa21ccfacf0f821a6e7071af22c46 /namedev.c | |
parent | eadb1bbc2eece84d9aff79bf17e252106c37f355 (diff) |
[PATCH] experimental (very simple) SYMLINK creation
> > here is a experimental symlink creation patch - for discussion,
> > in which direction we should go.
> > It is possible now to define SYMLINK= after the NAME= in udev.rules.
> > The link is relative to the node, but the path is not optimized now
> > if the node and the link are in the same nested directory.
> > Only one link is supported, cause i need to sleep now :)
> >
> > 06-simple-symlink-creation.diff
> > simple symlink creation
> > reorganized udev-remove to have access to the symlink field
> > subdir creation/removal are functions now
> > udev-test.pl tests for link creation/removal
Here is a new version with relative link target path optimization
an better tests in udev-test.pl:
LABEL, BUS="scsi", vendor="IBM-ESXS", NAME="1/2/a/b/node", SYMLINK="1/2/c/d/symlink"
Dec 7 06:48:34 pim udev[13789]: create_node: symlink 'udev-root/1/2/c/d/symlink' to node '1/2/a/b/node' requested
Dec 7 06:48:34 pim udev[13789]: create_path: created 'udev-root/1/2/c'
Dec 7 06:48:34 pim udev[13789]: create_path: created 'udev-root/1/2/c/d'
Dec 7 06:48:34 pim udev[13789]: create_node: symlink(../../a/b/node, udev-root/1/2/c/d/symlink)
Diffstat (limited to 'namedev.c')
-rw-r--r-- | namedev.c | 9 |
1 files changed, 8 insertions, 1 deletions
@@ -121,6 +121,7 @@ int add_config_dev(struct config_device *new_dev) copy_string(dev, new_dev, place); copy_string(dev, new_dev, kernel_name); copy_string(dev, new_dev, exec_program); + copy_string(dev, new_dev, symlink); return 0; } @@ -366,6 +367,7 @@ static int do_callout(struct sysfs_class_device *class_dev, struct udevice *udev if (strcmp_pattern(dev->id, udev->callout_value) != 0) continue; strfieldcpy(udev->name, dev->name); + strfieldcpy(udev->symlink, dev->symlink); dbg("callout returned matching value '%s', '%s' becomes '%s'", dev->id, class_dev->name, udev->name); return 0; @@ -416,6 +418,7 @@ label_found: continue; strfieldcpy(udev->name, dev->name); + strfieldcpy(udev->symlink, dev->symlink); dbg("found matching attribute '%s', '%s' becomes '%s' ", dev->sysfs_file, class_dev->name, udev->name); @@ -461,6 +464,7 @@ static int do_number(struct sysfs_class_device *class_dev, struct udevice *udev, if (!found) continue; strfieldcpy(udev->name, dev->name); + strfieldcpy(udev->symlink, dev->symlink); dbg("found matching id '%s', '%s' becomes '%s'", dev->id, class_dev->name, udev->name); return 0; @@ -506,6 +510,7 @@ static int do_topology(struct sysfs_class_device *class_dev, struct udevice *ude continue; strfieldcpy(udev->name, dev->name); + strfieldcpy(udev->symlink, dev->symlink); dbg("found matching place '%s', '%s' becomes '%s'", dev->place, class_dev->name, udev->name); return 0; @@ -528,6 +533,7 @@ static int do_replace(struct sysfs_class_device *class_dev, struct udevice *udev continue; strfieldcpy(udev->name, dev->name); + strfieldcpy(udev->symlink, dev->symlink); dbg("found name, '%s' becomes '%s'", dev->kernel_name, udev->name); return 0; @@ -618,8 +624,9 @@ int namedev_name_device(struct sysfs_class_device *class_dev, struct udevice *ud goto done; found: - /* substitute placeholder in NAME */ + /* substitute placeholder */ apply_format(udev, udev->name); + apply_format(udev, udev->symlink); done: perm = find_perm(udev->name); |