lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <200805201209.05080.IvDoorn@gmail.com>
Date:	Tue, 20 May 2008 12:09:04 +0200
From:	Ivo van Doorn <ivdoorn@...il.com>
To:	Henrique de Moraes Holschuh <hmh@....eng.br>
Cc:	linux-kernel@...r.kernel.org, Thomas Renninger <trenn@...e.de>,
	Dmitry Torokhov <dtor@...l.ru>
Subject: Re: [PATCH 13/15] rfkill: add uevent notifications

On Sunday 18 May 2008, Henrique de Moraes Holschuh wrote:
> Use the notification chains to also send uevents, so that userspace can be
> notified of state changes of every rfkill switch.
> 
> Userspace should use these events for OSD/status report applications and
> rfkill GUI frontends.  HAL might want to broadcast them over DBUS, for
> example.  It might be also useful for userspace implementations of
> rfkill-input, or to use HAL as the platform driver which promotes rfkill
> switch change events into input events (to synchronize all other switches)
> when necessary for platforms that lack a convenient platform-specific
> kernel module to do it.
> 
> Signed-off-by: Henrique de Moraes Holschuh <hmh@....eng.br>

Acked-by: Ivo van Doorn <IvDoorn@...il.com>

> Cc: Ivo van Doorn <IvDoorn@...il.com>
> Cc: Dmitry Torokhov <dtor@...l.ru>
> ---
>  net/rfkill/rfkill.c |   42 ++++++++++++++++++++++++++++++++++++++++++
>  1 files changed, 42 insertions(+), 0 deletions(-)
> 
> diff --git a/net/rfkill/rfkill.c b/net/rfkill/rfkill.c
> index 4ed8d19..ba25bde 100644
> --- a/net/rfkill/rfkill.c
> +++ b/net/rfkill/rfkill.c
> @@ -382,12 +382,51 @@ static int rfkill_resume(struct device *dev)
>  #define rfkill_resume NULL
>  #endif
>  
> +static int rfkill_blocking_uevent_notifier(struct notifier_block *nb,
> +					unsigned long eventid,
> +					void *data)
> +{
> +	struct rfkill *rfkill = (struct rfkill *)data;
> +
> +	switch (eventid) {
> +	case RFKILL_STATE_CHANGED:
> +		kobject_uevent(&rfkill->dev.kobj, KOBJ_CHANGE);
> +		break;
> +	default:
> +		break;
> +	}
> +
> +	return NOTIFY_DONE;
> +}
> +
> +static struct notifier_block rfkill_blocking_uevent_nb = {
> +	.notifier_call	= rfkill_blocking_uevent_notifier,
> +	.priority	= 0,
> +};
> +
> +static int rfkill_dev_uevent(struct device *dev, struct kobj_uevent_env *env)
> +{
> +	struct rfkill *rfkill = to_rfkill(dev);
> +	int error;
> +
> +	error = add_uevent_var(env, "RFKILL_NAME=%s", rfkill->name);
> +	if (error)
> +		return error;
> +	error = add_uevent_var(env, "RFKILL_TYPE=%s",
> +				rfkill_get_type_str(rfkill->type));
> +	if (error)
> +		return error;
> +	error = add_uevent_var(env, "RFKILL_STATE=%u", rfkill->state);
> +	return error;
> +}
> +
>  static struct class rfkill_class = {
>  	.name		= "rfkill",
>  	.dev_release	= rfkill_release,
>  	.dev_attrs	= rfkill_dev_attrs,
>  	.suspend	= rfkill_suspend,
>  	.resume		= rfkill_resume,
> +	.dev_uevent	= rfkill_dev_uevent,
>  };
>  
>  static int rfkill_add_switch(struct rfkill *rfkill)
> @@ -562,11 +601,14 @@ static int __init rfkill_init(void)
>  		return error;
>  	}
>  
> +	register_rfkill_notifier(&rfkill_blocking_uevent_nb);
> +
>  	return 0;
>  }
>  
>  static void __exit rfkill_exit(void)
>  {
> +	unregister_rfkill_notifier(&rfkill_blocking_uevent_nb);
>  	class_unregister(&rfkill_class);
>  }
>  


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ