[Ocfs2-commits] mfasheh commits r2180 - trunk/fs/ocfs2/cluster

svn-commits at oss.oracle.com svn-commits at oss.oracle.com
Tue Apr 26 17:32:47 CDT 2005


Author: mfasheh
Signed-off-by: manish
Date: 2005-04-26 17:32:45 -0500 (Tue, 26 Apr 2005)
New Revision: 2180

Modified:
   trunk/fs/ocfs2/cluster/nodemanager.c
Log:
* The last version export change was no good, move things to proc
  where they belong and where libo2cb won't get confused.

Signed-off-by: manish



Modified: trunk/fs/ocfs2/cluster/nodemanager.c
===================================================================
--- trunk/fs/ocfs2/cluster/nodemanager.c	2005-04-26 20:47:21 UTC (rev 2179)
+++ trunk/fs/ocfs2/cluster/nodemanager.c	2005-04-26 22:32:45 UTC (rev 2180)
@@ -733,31 +733,6 @@
 	config_item_put(item);
 }
 
-static struct configfs_attribute nm_cluster_group_version = {
-	.ca_owner = THIS_MODULE,
-	.ca_name  = "interface_revision",
-	.ca_mode  = S_IRUSR | S_IRGRP | S_IROTH,
-};
-
-static struct configfs_attribute *nm_cluster_group_attrs[] = {
-	&nm_cluster_group_version,
-	NULL,
-};
-
-static ssize_t nm_cluster_group_show_revision(struct config_item *item,
-					      struct configfs_attribute *attr,
-					      char *page)
-{
-	unsigned int ret;
-
-	ret = sprintf(page, "%u\n", NM_API_VERSION);
-	return ret;
-}
-
-static struct configfs_item_operations nm_cluster_group_item_ops = {
-	.show_attribute	= nm_cluster_group_show_revision,
-};
-
 static struct configfs_group_operations nm_cluster_group_group_ops = {
 	.make_group	= nm_cluster_group_make_group,
 	.drop_item	= nm_cluster_group_drop_item,
@@ -766,8 +741,6 @@
 static struct config_item_type nm_cluster_group_type = {
 	.ct_group_ops	= &nm_cluster_group_group_ops,
 	.ct_owner	= THIS_MODULE,
-	.ct_attrs	= nm_cluster_group_attrs,
-	.ct_item_ops	= &nm_cluster_group_item_ops,
 };
 
 static struct nm_cluster_group nm_cluster_group = {
@@ -784,6 +757,13 @@
 #define NM_PROC_PATH "fs/ocfs2_nodemanager"
 static struct proc_dir_entry *nm_proc;
 
+#define NM_VERSION_PROC_NAME "interface_revision"
+
+static void nm_remove_proc(struct proc_dir_entry *parent)
+{
+	remove_proc_entry(NM_VERSION_PROC_NAME, parent);
+}
+
 static void __exit exit_nm(void)
 {
 	if (ocfs2_table_header)
@@ -792,10 +772,50 @@
 	/* XXX sync with hb callbacks and shut down hb? */
 	net_unregister_hb_callbacks();
 	configfs_unregister_subsystem(&nm_cluster_group.cs_subsys);
+	nm_remove_proc(nm_proc);
 	mlog_remove_proc(nm_proc);
 	remove_proc_entry(NM_PROC_PATH, NULL);
 }
 
+static int nm_proc_version (char *page, char **start, off_t off,
+			    int count, int *eof, void *data)
+{
+	int len;
+
+	len = sprintf(page, "%u\n", NM_API_VERSION);
+	if (len < 0)
+		return len;
+
+	if (len <= off + count)
+		*eof = 1;
+
+	*start = page + off;
+
+	len -= off;
+
+	if (len > count)
+		len = count;
+
+	if (len < 0)
+		len = 0;
+
+	return len;
+}
+
+static int nm_init_proc(struct proc_dir_entry *parent)
+{
+	struct proc_dir_entry *p;
+
+	p = create_proc_read_entry(NM_VERSION_PROC_NAME,
+				   S_IFREG | S_IRUGO,
+				   parent,
+				   nm_proc_version,
+				   NULL);
+	if (!p)
+		return -ENOMEM;
+	return 0;
+}
+
 static int __init init_nm(void)
 {
 	int ret = -1;
@@ -830,6 +850,10 @@
 	}
 
 	ret = mlog_init_proc(nm_proc);
+	if (ret)
+		goto out_subsys;
+
+	ret = nm_init_proc(nm_proc);
 	if (ret == 0)
 		goto out;
 



More information about the Ocfs2-commits mailing list