Greg KH wrote:
> We want to let people know when we create a duplicate sysfs file, as
> they need to fix up their code.
>
>
> Signed-off-by: Greg Kroah-Hartman <[email protected]>
>
> ---
> fs/sysfs/dir.c | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> --- a/fs/sysfs/dir.c
> +++ b/fs/sysfs/dir.c
> @@ -428,8 +428,12 @@ void sysfs_addrm_start(struct sysfs_addr
> */
> int sysfs_add_one(struct sysfs_addrm_cxt *acxt, struct sysfs_dirent *sd)
> {
> - if (sysfs_find_dirent(acxt->parent_sd, sd->s_name))
> + if (sysfs_find_dirent(acxt->parent_sd, sd->s_name)) {
> + printk(KERN_WARNING, "sysfs: duplicate filename '%s' "
> + "can not be created\n", sd->s_name);
> + WARN_ON(1);
> return -EEXIST;
> + }
>
> sd->s_parent = sysfs_get(acxt->parent_sd);
>
As a side story:
I've got code which has checks for device_create_file != 0 but keeps
quiet if it got -EEXIST. I rewrote it now so that it does not rely on
the driver core to skip over already existing files. Doing this
revealed a group of old refcounting bugs. :-) Thanks,
--
Stefan Richter
-=====-=-=== =--= -====
http://arcgraph.de/sr/
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[Index of Archives]
[Kernel Newbies]
[Netfilter]
[Bugtraq]
[Photo]
[Stuff]
[Gimp]
[Yosemite News]
[MIPS Linux]
[ARM Linux]
[Linux Security]
[Linux RAID]
[Video 4 Linux]
[Linux for the blind]
[Linux Resources]