From: Andrey Borzenkov Date: Sat, 28 Feb 2004 14:57:24 +0000 Subject: Re: [PATCH] symlink only rules support Message-Id: <200402281757.24249.arvidjaar@mail.ru> MIME-Version: 1 Content-Type: multipart/mixed; boundary="Boundary-00=_UxKQAtjab6+uC32" List-Id: References: <20040222095013.GD4873@localhost.localdomain> In-Reply-To: <20040222095013.GD4873@localhost.localdomain> To: linux-hotplug@vger.kernel.org --Boundary-00=_UxKQAtjab6+uC32 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline On Saturday 28 February 2004 04:04, Greg KH wrote: > On Sun, Feb 22, 2004 at 12:50:13PM +0300, Andrey Borzenkov wrote: > > On Tue, Feb 17, 2004 at 09:29:53AM -0800, Greg KH wrote: > > > > What about the second part (allow symlink-only rules)? > > > > > > Yes, I think that would be good to have too. Just split the patches up > > > into two pieces, only one patch per feature/fix. > > > > Slightly modified version. It is less aggressive in that it just adds > > symlink collection but otherwise behaves exactly like current code. > > > > the patch is relative to previous one (configuration directory support). > > Hm, as Kay modified that one, and things have changed enough, can you > resend this against the 019 release? > attached regdards -andrey --Boundary-00=_UxKQAtjab6+uC32 Content-Type: text/x-diff; charset="iso-8859-1"; name="udev019_symlink.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="udev019_symlink.patch" --- udev-019/namedev.c.symlink 2004-02-28 04:11:47.000000000 +0300 +++ udev-019/namedev.c 2004-02-28 17:49:42.621962496 +0300 @@ -816,17 +816,31 @@ int namedev_name_device(struct sysfs_cla list_for_each_entry(dev, &config_device_list, node) { dbg("process rule"); if (match_rule(dev, class_dev, udev, sysfs_device) == 0) { - if (dev->name[0] == '\0') { + if (dev->name[0] == '\0' && dev->symlink[0] == '\0') { info("configured rule in '%s' at line %i applied, '%s' is ignored", udev_rules_filename, dev->config_line, udev->kernel_name); return -1; } - info("configured rule in '%s' at line %i applied, '%s' becomes '%s'", - udev_rules_filename, dev->config_line, udev->kernel_name, dev->name); - strfieldcpy(udev->name, dev->name); - strfieldcpy(udev->symlink, dev->symlink); - goto found; + if (dev->symlink[0] != '\0') { + char temp[NAME_MAX]; + + info("configured rule in '%s' at line %i applied, added symlink '%s'", + udev_rules_filename, dev->config_line, dev->symlink); + /* do not clobber dev */ + strfieldcpy(temp, dev->symlink); + apply_format(udev, temp, sizeof(temp), + class_dev, sysfs_device); + strfieldcat(udev->symlink, temp); + strfieldcat(udev->symlink, " "); + } + + if (dev->name[0] != '\0') { + info("configured rule in '%s' at line %i applied, '%s' becomes '%s'", + udev_rules_filename, dev->config_line, udev->kernel_name, dev->name); + strfieldcpy(udev->name, dev->name); + goto found; + } } } @@ -838,8 +852,6 @@ found: /* substitute placeholder */ apply_format(udev, udev->name, sizeof(udev->name), class_dev, sysfs_device); - apply_format(udev, udev->symlink, sizeof(udev->symlink), - class_dev, sysfs_device); udev->partitions = dev->partitions; done: perm = find_perm(udev->name); --Boundary-00=_UxKQAtjab6+uC32-- ------------------------------------------------------- SF.Net is sponsored by: Speed Start Your Linux Apps Now. Build and deploy apps & Web services for Linux with a free DVD software kit from IBM. Click Now! http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click _______________________________________________ Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net Linux-hotplug-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel