sysfs: spit a warning to users when they try to create a duplicate sysfs file
authorGreg Kroah-Hartman <gregkh@suse.de>
Thu, 13 Sep 2007 09:53:13 +0000 (02:53 -0700)
committerGreg Kroah-Hartman <gregkh@suse.de>
Fri, 12 Oct 2007 21:51:09 +0000 (14:51 -0700)
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 <gregkh@suse.de>
fs/sysfs/dir.c

index da4bb66..5d95aa8 100644 (file)
@@ -428,8 +428,12 @@ void sysfs_addrm_start(struct sysfs_addrm_cxt *acxt,
  */
 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);