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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Mon, 11 Sep 2006 22:07:23 +0200
From:	"Thomas Maier" <balagi@...tmail.de>
To:	"Greg KH" <greg@...ah.com>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: [PATCH] class.c: added class_create_attrs() function

Hello,

this is a patch based on linux 2.6.18-rc6.
It adds a class_create_attrs() function in
drivers/base/class.c .
This new function works similar to class_create(),
but also allows to create the class attribute files
(if any) during class creation.

-Thomas Maier


diff -urpN linux-2.6.18-rc6/drivers/base/class.c patch/drivers/base/class.c
--- linux-2.6.18-rc6/drivers/base/class.c	2006-09-11 21:45:12.000000000 +0200
+++ patch/drivers/base/class.c	2006-09-11 21:52:06.000000000 +0200
@@ -199,6 +199,18 @@ static int class_device_create_uevent(st
   */
  struct class *class_create(struct module *owner, char *name)
  {
+	return class_create_attrs(owner, name, NULL);
+}
+/**
+ * class_create_attrs - similar to class_create(), but can also
+ * create class attribute files on class creation.
+ * @owner: pointer to the module that is to "own" this struct class
+ * @name: pointer to a string for the name of this class.
+ * @cls_attrs: pointer to a class_attribute array.
+ */
+struct class *class_create_attrs(struct module *owner, char *name,
+				struct class_attribute *cls_attrs)
+{
  	struct class *cls;
  	int retval;

@@ -212,6 +224,7 @@ struct class *class_create(struct module
  	cls->owner = owner;
  	cls->class_release = class_create_release;
  	cls->release = class_device_create_release;
+	cls->class_attrs = cls_attrs;

  	retval = class_register(cls);
  	if (retval)
@@ -900,6 +913,7 @@ EXPORT_SYMBOL_GPL(class_remove_file);
  EXPORT_SYMBOL_GPL(class_register);
  EXPORT_SYMBOL_GPL(class_unregister);
  EXPORT_SYMBOL_GPL(class_create);
+EXPORT_SYMBOL_GPL(class_create_attrs);
  EXPORT_SYMBOL_GPL(class_destroy);

  EXPORT_SYMBOL_GPL(class_device_register);
diff -urpN linux-2.6.18-rc6/include/linux/device.h patch/include/linux/device.h
--- linux-2.6.18-rc6/include/linux/device.h	2006-09-11 21:53:10.000000000 +0200
+++ patch/include/linux/device.h	2006-09-11 21:54:21.000000000 +0200
@@ -272,6 +272,8 @@ extern int class_interface_register(stru
  extern void class_interface_unregister(struct class_interface *);

  extern struct class *class_create(struct module *owner, char *name);
+extern struct class *class_create_attrs(struct module *owner, char *name,
+					struct class_attribute *cls_attrs);
  extern void class_destroy(struct class *cls);
  extern struct class_device *class_device_create(struct class *cls,
  						struct class_device *parent,
-
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