Re: [PATCH 3/3] sysfs: add explicit sysfs_cache object

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Alan Jenkins wrote:
> diff --git a/udev/test-udev.c b/udev/test-udev.c
> index 07628f7..878c477 100644
> --- a/udev/test-udev.c
> +++ b/udev/test-udev.c
> @@ -62,7 +62,6 @@ static void asmlinkage sig_handler(int signum)
>  
>  int main(int argc, char *argv[])
>  {
> -	struct sysfs_device *dev;
>  	struct udevice *udev;
>  	const char *maj, *min;
>  	struct udev_rules rules;
> @@ -133,18 +132,23 @@ int main(int argc, char *argv[])
>  	sysfs_init();
>  	udev_rules_init(&rules, 0);
>  
> -	dev = sysfs_device_get(devpath);
> -	if (dev == NULL) {
> -		info("unable to open '%s'\n", devpath);
> -		goto fail;
> -	}
> -
>  	udev = udev_device_init();
>  	if (udev == NULL)
>  		goto fail;
>  
> +	/* valgrind can only verify sysfs_device_cleanup() calls if cache is disabled */
> +#if 0
> +	udev->cache = sysfs_cache_init();
> +	if (udev->cache == NULL)
> +		goto fail;
> +#endif
>   

Sorry, I didn't test these patches properly for performance.  It's right
to disable the cache in udev-test, but then I forgot to enable the cache
in udevd :-(.

Here's the missing code:

diff --git a/udev/udevd.c b/udev/udevd.c
index 68cf264..b5e5810 100644
--- a/udev/udevd.c
+++ b/udev/udevd.c
@@ -129,6 +129,11 @@ static int udev_event_process(struct udevd_uevent_msg *msg)
 	udev = udev_device_init();
 	if (udev == NULL)
 		return -1;
+
+	udev->cache = sysfs_cache_init();
+	if (udev->cache == NULL)
+		return -1;
+
 	strlcpy(udev->action, msg->action, sizeof(udev->action));
 	sysfs_device_set_values(udev->dev, msg->devpath, msg->subsystem, msg->driver);
 	udev->devpath_old = msg->devpath_old;


--
To unsubscribe from this list: send the line "unsubscribe linux-hotplug" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel]     [Linux DVB]     [Asterisk Internet PBX]     [DCCP]     [Netdev]     [X.org]     [Util Linux NG]     [Fedora Women]     [ALSA Devel]     [Linux USB]

  Powered by Linux