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:	Thu, 17 Dec 2009 20:12:14 +0200
From:	Phil Carmody <ext-phil.2.carmody@...ia.com>
To:	gregkh@...e.de
Cc:	linux-kernel@...r.kernel.org
Subject: [RFC 4/6] Driver core: Easy macros to encourage const attributes

It's too easy to type DEVICE_ATTR and not think of adding
a 'const', make it just as easy to get const as part of the
macro.

Signed-off-by: Phil Carmody <ext-phil.2.carmody@...ia.com>
---
 include/linux/device.h |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/include/linux/device.h b/include/linux/device.h
index d07f90f..ea8ced6 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -165,6 +165,10 @@ struct driver_attribute {
 struct driver_attribute driver_attr_##_name =		\
 	__ATTR(_name, _mode, _show, _store)
 
+#define DRIVER_CATTR(_name, _mode, _show, _store)	\
+const struct driver_attribute driver_attr_##_name =	\
+	__ATTR(_name, _mode, _show, _store)
+
 extern int __must_check driver_create_file(struct device_driver *driver,
 					const struct driver_attribute *attr);
 extern void driver_remove_file(struct device_driver *driver,
@@ -318,6 +322,10 @@ struct device_attribute {
 #define DEVICE_ATTR(_name, _mode, _show, _store) \
 struct device_attribute dev_attr_##_name = __ATTR(_name, _mode, _show, _store)
 
+#define DEVICE_CATTR(_name, _mode, _show, _store) \
+const struct device_attribute dev_attr_##_name = \
+	__ATTR(_name, _mode, _show, _store)
+
 extern int __must_check device_create_file(struct device *device,
 					const struct device_attribute *entry);
 extern void device_remove_file(struct device *dev,
-- 
1.6.0.4

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