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: <30f1f2c867089bb78cdb9fe3c2032c091bed106a.1260364108.git.ext-jani.1.nikula@nokia.com>
Date:	Wed,  9 Dec 2009 15:49:02 +0200
From:	Jani Nikula <ext-jani.1.nikula@...ia.com>
To:	dbrownell@...rs.sourceforge.net, gregkh@...e.de
Cc:	linux-kernel@...r.kernel.org, dsilvers@...tec.co.uk,
	ben@...tec.co.uk, Artem.Bityutskiy@...ia.com,
	akpm@...ux-foundation.org, ext-jani.1.nikula@...ia.com
Subject: [PATCH 1/3] device class: add symlink creation helpers

From: Artem Bityutskiy <Artem.Bityutskiy@...ia.com>

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@...ia.com>
---
 drivers/base/class.c   |   21 +++++++++++++++++++++
 include/linux/device.h |    4 ++++
 2 files changed, 25 insertions(+), 0 deletions(-)

diff --git a/drivers/base/class.c b/drivers/base/class.c
index 161746d..818cbe2 100644
--- a/drivers/base/class.c
+++ b/drivers/base/class.c
@@ -92,6 +92,25 @@ void class_remove_file(struct class *cls, const struct class_attribute *attr)
 		sysfs_remove_file(&cls->p->class_subsys.kobj, &attr->attr);
 }
 
+int class_create_link(struct class *cls, struct kobject *target,
+		      const char *name)
+{
+	int error;
+
+	if (cls)
+		error = sysfs_create_link(&cls->p->class_subsys.kobj,
+					  target, name);
+	else
+		error = -EINVAL;
+	return error;
+}
+
+void class_remove_link(struct class *cls, const char *name)
+{
+	if (cls)
+		sysfs_remove_link(&cls->p->class_subsys.kobj, name);
+}
+
 static struct class *class_get(struct class *cls)
 {
 	if (cls)
@@ -585,6 +604,8 @@ int __init classes_init(void)
 
 EXPORT_SYMBOL_GPL(class_create_file);
 EXPORT_SYMBOL_GPL(class_remove_file);
+EXPORT_SYMBOL_GPL(class_create_link);
+EXPORT_SYMBOL_GPL(class_remove_link);
 EXPORT_SYMBOL_GPL(class_unregister);
 EXPORT_SYMBOL_GPL(class_destroy);
 
diff --git a/include/linux/device.h b/include/linux/device.h
index 2ea3e49..e877be6 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -262,6 +262,10 @@ extern int __must_check class_create_file(struct class *class,
 					  const struct class_attribute *attr);
 extern void class_remove_file(struct class *class,
 			      const struct class_attribute *attr);
+extern int __must_check class_create_link(struct class *class,
+					  struct kobject *target,
+					  const char *name);
+extern void class_remove_link(struct class *class, const char *name);
 
 struct class_interface {
 	struct list_head	node;
-- 
1.6.5.2

--
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