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: <20080209064531.GA29926@kroah.com>
Date:	Fri, 8 Feb 2008 22:45:31 -0800
From:	Greg KH <greg@...ah.com>
To:	Rodolfo Giometti <giometti@...ux.it>
Cc:	linux-kernel@...r.kernel.org,
	Andrew Morton <akpm@...ux-foundation.org>,
	David Woodhouse <dwmw2@...radead.org>,
	Dave Jones <davej@...hat.com>
Subject: Re: [PATCH 1/8] LinuxPPS core support.

On Fri, Feb 08, 2008 at 07:00:37PM +0100, Rodolfo Giometti wrote:
> This patch adds the kernel side of the PPS support currently named
> "LinuxPPS".
> 
> PPS means "pulse per second" and a PPS source is just a device which
> provides a high precision signal each second so that an application
> can use it to adjust system clock time.
> 
> Common use is the combination of the NTPD as userland program with a
> GPS receiver as PPS source to obtain a wallclock-time with
> sub-millisecond synchronisation to UTC.
> 
> To obtain this goal the userland programs shoud use the PPS API
> specification (RFC 2783 - Pulse-Per-Second API for UNIX-like Operating
> Systems, Version 1.0) which in part is implemented by this patch. It
> provides a set of chars devices, one per PPS source, which can be used
> to get the time signal. The RFC's functions can be implemented by
> accessing to these char devices.
> 
> Signed-off-by: Rodolfo Giometti <giometti@...ux.it>
> ---
>  MAINTAINERS          |    7 +
>  drivers/Kconfig      |    2 +
>  drivers/Makefile     |    1 +
>  drivers/pps/Kconfig  |   32 +++++
>  drivers/pps/Makefile |   10 ++
>  drivers/pps/kapi.c   |  272 +++++++++++++++++++++++++++++++++++++++
>  drivers/pps/pps.c    |  342 ++++++++++++++++++++++++++++++++++++++++++++++++++
>  drivers/pps/sysfs.c  |  142 +++++++++++++++++++++

As you are adding sysfs files, please also describe them in
Documentation/ABI/ in this same series of patches.

> +void pps_sysfs_remove_source_entry(struct pps_device *pps)
> +{
> +	/* Delete info files */
> +	if (pps->info.mode & PPS_CAPTUREASSERT)
> +		device_remove_file(pps->dev, &dev_attr_assert);
> +
> +	if (pps->info.mode & PPS_CAPTURECLEAR)
> +		device_remove_file(pps->dev, &dev_attr_clear);
> +
> +	device_remove_file(pps->dev, &dev_attr_mode);
> +	device_remove_file(pps->dev, &dev_attr_echo);
> +	device_remove_file(pps->dev, &dev_attr_name);
> +	device_remove_file(pps->dev, &dev_attr_path);
> +}
> +
> +int pps_sysfs_create_source_entry(struct pps_device *pps)
> +{
> +	int ret;
> +
> +	/* Create file "assert" and "clear" according to source capability */
> +	if (pps->info.mode & PPS_CAPTUREASSERT) {
> +		ret = device_create_file(pps->dev, &dev_attr_assert);
> +		if (ret)
> +			dev_err(pps->dev, "unable to create \"assert\" "
> +					"sysfs entry");
> +	}
> +
> +	if (pps->info.mode & PPS_CAPTURECLEAR) {
> +		ret = device_create_file(pps->dev, &dev_attr_clear);
> +		if (ret)
> +			dev_err(pps->dev, "unable to create \"clear\" "
> +					"sysfs entry");
> +	}
> +
> +	ret = device_create_file(pps->dev, &dev_attr_mode);
> +	if (ret)
> +		dev_err(pps->dev, "unable to create \"mode\" sysfs entry");
> +	ret = device_create_file(pps->dev, &dev_attr_echo);
> +	if (ret)
> +		dev_err(pps->dev, "unable to create \"echo\" sysfs entry");
> +	ret = device_create_file(pps->dev, &dev_attr_name);
> +	if (ret)
> +		dev_err(pps->dev, "unable to create \"name\" sysfs entry");
> +	ret = device_create_file(pps->dev, &dev_attr_path);
> +	if (ret)
> +		dev_err(pps->dev, "unable to create \"path\" sysfs entry");

Why not use a default attribute group?

That way the files are created before the uevent is issued, and the
amount of code you have to write is much smaller.

thanks,

greg k-h
--
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