1 /* -*- mode: c; c-basic-offset: 8; -*- * vim: noexpandtab sw=8 ts=8 sts=0:
5 * OCFS2 cluster sysfs interface
7 * Copyright (C) 2005 Oracle. All rights reserved.
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public
11 * License as published by the Free Software Foundation,
12 * version 2 of the License.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * General Public License for more details.
19 * You should have received a copy of the GNU General Public
20 * License along with this program; if not, write to the
21 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
22 * Boston, MA 021110-1307, USA.
26 #include <linux/kernel.h>
27 #include <linux/module.h>
28 #include <linux/kobject.h>
29 #include <linux/sysfs.h>
32 #include "ocfs2_nodemanager.h"
33 #include "heartbeat.h"
38 static ssize_t version_show(struct kobject *kobj, struct kobj_attribute *attr,
41 return snprintf(buf, PAGE_SIZE, "%u\n", O2NM_API_VERSION);
43 static struct kobj_attribute attr_version =
44 __ATTR(interface_revision, S_IFREG | S_IRUGO, version_show, NULL);
46 static ssize_t heartbeat_mode_show(struct kobject *kobj,
47 struct kobj_attribute *attr, char *buf)
49 return snprintf(buf, PAGE_SIZE, "%s\n", o2hb_heartbeat_mode());
52 static ssize_t heartbeat_mode_store(struct kobject *kobj,
53 struct kobj_attribute *attr,
54 const char *buffer, size_t count)
56 return o2hb_set_heartbeat_mode(buffer, count);
59 static struct kobj_attribute attr_heartbeat_mode =
60 __ATTR(heartbeat_mode, S_IFREG | S_IRUGO | S_IWUSR,
61 heartbeat_mode_show, heartbeat_mode_store);
63 static struct attribute *o2cb_attrs[] = {
65 &attr_heartbeat_mode.attr,
69 static struct attribute_group o2cb_attr_group = {
73 static struct kset *o2cb_kset;
75 void o2cb_sys_shutdown(void)
78 kset_unregister(o2cb_kset);
81 int o2cb_sys_init(void)
85 o2cb_kset = kset_create_and_add("o2cb", NULL, NULL);
89 ret = sysfs_create_group(&o2cb_kset->kobj, &o2cb_attr_group);
93 ret = mlog_sys_init(o2cb_kset);
98 kset_unregister(o2cb_kset);