aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/ksysfs.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
commit1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch)
tree0bba044c4ce775e45a88a51686b5d9f90697ea9d /kernel/ksysfs.c
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history, even though we have it. We can create a separate "historical" git archive of that later if we want to, and in the meantime it's about 3.2GB when imported into git - space that would just make the early git days unnecessarily complicated, when we don't have a lot of good infrastructure for it. Let it rip!
Diffstat (limited to 'kernel/ksysfs.c')
-rw-r--r--kernel/ksysfs.c57
1 files changed, 57 insertions, 0 deletions
diff --git a/kernel/ksysfs.c b/kernel/ksysfs.c
new file mode 100644
index 000000000000..1f064a63f8cf
--- /dev/null
+++ b/kernel/ksysfs.c
@@ -0,0 +1,57 @@
1/*
2 * kernel/ksysfs.c - sysfs attributes in /sys/kernel, which
3 * are not related to any other subsystem
4 *
5 * Copyright (C) 2004 Kay Sievers <kay.sievers@vrfy.org>
6 *
7 * This file is release under the GPLv2
8 *
9 */
10
11#include <linux/config.h>
12#include <linux/kobject.h>
13#include <linux/string.h>
14#include <linux/sysfs.h>
15#include <linux/module.h>
16#include <linux/init.h>
17
18#define KERNEL_ATTR_RO(_name) \
19static struct subsys_attribute _name##_attr = __ATTR_RO(_name)
20
21#define KERNEL_ATTR_RW(_name) \
22static struct subsys_attribute _name##_attr = \
23 __ATTR(_name, 0644, _name##_show, _name##_store)
24
25#ifdef CONFIG_HOTPLUG
26static ssize_t hotplug_seqnum_show(struct subsystem *subsys, char *page)
27{
28 return sprintf(page, "%llu\n", (unsigned long long)hotplug_seqnum);
29}
30KERNEL_ATTR_RO(hotplug_seqnum);
31#endif
32
33decl_subsys(kernel, NULL, NULL);
34EXPORT_SYMBOL_GPL(kernel_subsys);
35
36static struct attribute * kernel_attrs[] = {
37#ifdef CONFIG_HOTPLUG
38 &hotplug_seqnum_attr.attr,
39#endif
40 NULL
41};
42
43static struct attribute_group kernel_attr_group = {
44 .attrs = kernel_attrs,
45};
46
47static int __init ksysfs_init(void)
48{
49 int error = subsystem_register(&kernel_subsys);
50 if (!error)
51 error = sysfs_create_group(&kernel_subsys.kset.kobj,
52 &kernel_attr_group);
53
54 return error;
55}
56
57core_initcall(ksysfs_init);