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: <20151004192311.GE9649@kroah.com>
Date:	Sun, 4 Oct 2015 20:23:11 +0100
From:	Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To:	Pantelis Antoniou <pantelis.antoniou@...sulko.com>
Cc:	Rob Herring <robherring2@...il.com>,
	Frank Rowand <frowand.list@...il.com>,
	Matt Porter <mporter@...sulko.com>,
	Koen Kooi <koen@...inion.thruhere.net>,
	Guenter Roeck <linux@...ck-us.net>, devicetree@...r.kernel.org,
	linux-kernel@...r.kernel.org, linux-api@...r.kernel.org,
	Pantelis Antoniou <panto@...oniou-consulting.com>
Subject: Re: [PATCH v5 3/4] of: overlay: add per overlay sysfs attributes

On Wed, Sep 16, 2015 at 07:09:10PM +0300, Pantelis Antoniou wrote:
> The two default overlay attributes are:
> 
> * A targets sysfs attribute listing the targets of the installed
> overlay. The targets list the path on the kernel's device tree
> where each overlay fragment is applied to
> 
> * A per overlay can_remove sysfs attribute that reports whether
> the overlay can be removed or not due to another overlapping overlay.
> 
> Signed-off-by: Pantelis Antoniou <pantelis.antoniou@...sulko.com>
> ---
>  drivers/of/overlay.c | 53 ++++++++++++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 53 insertions(+)
> 
> diff --git a/drivers/of/overlay.c b/drivers/of/overlay.c
> index 62cfb99..cff3c05 100644
> --- a/drivers/of/overlay.c
> +++ b/drivers/of/overlay.c
> @@ -373,8 +373,61 @@ static const struct attribute *overlay_global_attrs[] = {
>  	NULL
>  };
>  
> +static ssize_t can_remove_show(struct kobject *kobj,
> +		struct kobj_attribute *attr, char *buf)
> +{
> +	struct of_overlay *ov = kobj_to_overlay(kobj);
> +
> +	return snprintf(buf, PAGE_SIZE, "%d\n", overlay_removal_is_ok(ov));
> +}
> +
> +static ssize_t targets_show(struct kobject *kobj,
> +		struct kobj_attribute *attr, char *buf)
> +{
> +	struct of_overlay *ov = kobj_to_overlay(kobj);
> +	struct of_overlay_info *ovinfo;
> +	char *s, *e;
> +	ssize_t ret;
> +	int i, len;
> +
> +	s = buf;
> +	e = buf + PAGE_SIZE;
> +
> +	mutex_lock(&of_mutex);
> +
> +	/* targets */
> +	for (i = 0; i < ov->count; i++) {
> +		ovinfo = &ov->ovinfo_tab[i];
> +
> +		len = snprintf(s, e - s, "%s\n",
> +				of_node_full_name(ovinfo->target));
> +		if (len == 0) {
> +			ret = -ENOSPC;
> +			goto err;
> +		}
> +		s += len;
> +	}

Multiple values per sysfs file?  Not ok, this is not going to work,
sorry, please fix.

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