[Ocfs2-commits] jlbec commits r2065 - in trunk/fs: ocfs2/cluster usysfs

svn-commits at oss.oracle.com svn-commits at oss.oracle.com
Mon Mar 28 18:20:14 CST 2005


Author: jlbec
Signed-off-by: manish
Date: 2005-03-28 18:20:12 -0600 (Mon, 28 Mar 2005)
New Revision: 2065

Modified:
   trunk/fs/ocfs2/cluster/heartbeat.c
   trunk/fs/ocfs2/cluster/nodemanager.c
   trunk/fs/usysfs/bobtest.c
   trunk/fs/usysfs/dir.c
   trunk/fs/usysfs/file.c
   trunk/fs/usysfs/uobject.h
   trunk/fs/usysfs/usysfs.h
Log:

o Fold attribute operations into object_operations.

Signed-off-by: manish



Modified: trunk/fs/ocfs2/cluster/heartbeat.c
===================================================================
--- trunk/fs/ocfs2/cluster/heartbeat.c	2005-03-28 20:16:38 UTC (rev 2064)
+++ trunk/fs/ocfs2/cluster/heartbeat.c	2005-03-29 00:20:12 UTC (rev 2065)
@@ -694,18 +694,14 @@
 	return ret;
 }
 
-static struct usysfs_attribute_operations hb_region_attr_ops = {
-	.show	= &hb_region_show,
-	.store	= &hb_region_store,
-};
-
 static struct usysfs_object_operations hb_region_object_ops = {
-	.release	= hb_region_release,
+	.release		= hb_region_release,
+	.show_attribute		= hb_region_show,
+	.store_attribute	= hb_region_store,
 };
 
 static struct uobj_type hb_region_type = {
 	.object_ops	= &hb_region_object_ops,
-	.attr_ops	= &hb_region_attr_ops,
 	.attrs		= hb_region_attrs,
 	.owner	= THIS_MODULE,
 };
@@ -776,7 +772,6 @@
 
 struct uobj_type hb_heartbeat_set_type = {
 	.set_ops	= &hb_heartbeat_set_set_ops,
-	.attr_ops	= NULL, /* no attributes */
 	.owner		= THIS_MODULE,
 };
 

Modified: trunk/fs/ocfs2/cluster/nodemanager.c
===================================================================
--- trunk/fs/ocfs2/cluster/nodemanager.c	2005-03-28 20:16:38 UTC (rev 2064)
+++ trunk/fs/ocfs2/cluster/nodemanager.c	2005-03-29 00:20:12 UTC (rev 2065)
@@ -438,18 +438,14 @@
 	return ret;
 }
 
-static struct usysfs_attribute_operations nm_node_attr_ops = {
-	.show	= &nm_node_show,
-	.store	= &nm_node_store,
-};
-
 static struct usysfs_object_operations nm_node_object_ops = {
-	.release	= nm_node_release,
+	.release		= nm_node_release,
+	.show_attribute		= nm_node_show,
+	.store_attribute	= nm_node_store,
 };
 
 static struct uobj_type nm_node_type = {
 	.object_ops	= &nm_node_object_ops,
-	.attr_ops	= &nm_node_attr_ops,
 	.attrs		= nm_node_attrs,
 	.owner	= THIS_MODULE,
 };
@@ -561,7 +557,6 @@
 
 static struct uobj_type nm_node_set_type = {
 	.set_ops	= &nm_node_set_set_ops,
-	.attr_ops	= NULL, /* no attributes */
 	.owner		= THIS_MODULE,
 };
 
@@ -583,7 +578,6 @@
 
 static struct uobj_type nm_cluster_type = {
 	.object_ops	= &nm_cluster_object_ops,
-	.attr_ops	= NULL, /* no attributes */
 	.owner	= THIS_MODULE,
 };
 
@@ -674,7 +668,6 @@
 
 static struct uobj_type nm_cluster_set_type = {
 	.set_ops	= &nm_cluster_set_set_ops,
-	.attr_ops	= NULL, /* no attributes */
 	.owner	= THIS_MODULE,
 };
 

Modified: trunk/fs/usysfs/bobtest.c
===================================================================
--- trunk/fs/usysfs/bobtest.c	2005-03-28 20:16:38 UTC (rev 2064)
+++ trunk/fs/usysfs/bobtest.c	2005-03-29 00:20:12 UTC (rev 2065)
@@ -84,10 +84,6 @@
 	return ret;
 }
 
-struct usysfs_attribute_operations robert_attr_ops = {
-	.show	= &robert_attr_show,
-};
-
 static void robert_release(struct uobject *uobj)
 {
 	printk("We shall welease, Wobewt!\n");
@@ -96,11 +92,11 @@
 
 static struct usysfs_object_operations robert_object_ops = {
 	.release	= robert_release,
+	.show_attribute	= robert_attr_show,
 };
 
 static struct uobj_type uktype_robert = {
 	.object_ops	= &robert_object_ops,
-	.attr_ops	= &robert_attr_ops,
 	.attrs		= robert_attrs,
 	.owner	= THIS_MODULE,
 };
@@ -209,11 +205,6 @@
 	return ret;
 }
 
-struct usysfs_attribute_operations bob_attr_ops = {
-	.show	= &bob_attr_show,
-	.store	= &bob_attr_store,
-};
-
 static void bob_release(struct uobject *uobj)
 {
 	printk("Yeah, uh, we'll talk to Bob\n");
@@ -221,12 +212,13 @@
 }
 
 static struct usysfs_object_operations bob_object_ops = {
-	.release	= bob_release,
+	.release		= bob_release,
+	.show_attribute		= bob_attr_show,
+	.store_attribute	= bob_attr_store,
 };
 
 static struct uobj_type uktype_bob = {
 	.object_ops	= &bob_object_ops,
-	.attr_ops	= &bob_attr_ops,
 	.attrs		= bob_attrs,
 	.owner	= THIS_MODULE,
 };
@@ -263,9 +255,6 @@
 	return ret;
 }
 
-static struct usysfs_attribute_operations bobset_attr_ops = {
-	.show	= &bobset_attr_show,
-};
 
 static ssize_t bobset_bobs_read(struct bobset *bobset, char *page)
 {
@@ -317,14 +306,18 @@
 	uobject_put(uobj);
 }
 
+static struct usysfs_object_operations bobset_object_ops = {
+	.show_attribute	= bobset_attr_show,
+};
+
 static struct usysfs_set_operations bobset_set_ops = {
 	.make_object	= make_bob,
 	.drop_object	= drop_bob,
 };
 
 static struct uobj_type uktype_bobset = {
+	.object_ops	= &bobset_object_ops,
 	.set_ops	= &bobset_set_ops,
-	.attr_ops	= &bobset_attr_ops,
 	.attrs		= bobset_attrs,
 };
 
@@ -439,11 +432,6 @@
 	return ret;
 }
 
-struct usysfs_attribute_operations jerry_attr_ops = {
-	.show	= &jerry_attr_show,
-	.store	= &jerry_attr_store,
-};
-
 static void jerry_release(struct uobject *uobj)
 {
 	printk("Show me the money!\n");
@@ -461,13 +449,14 @@
 }
 
 static struct usysfs_object_operations jerry_object_ops = {
-	.release	= jerry_release,
-	.allow_link	= jerry_allow_link,
+	.release		= jerry_release,
+	.show_attribute		= jerry_attr_show,
+	.store_attribute	= jerry_attr_store,
+	.allow_link		= jerry_allow_link,
 };
 
 static struct uobj_type uktype_jerry = {
 	.object_ops	= &jerry_object_ops,
-	.attr_ops	= &jerry_attr_ops,
 	.attrs		= jerry_attrs,
 	.owner	= THIS_MODULE,
 };
@@ -567,10 +556,6 @@
 	return ret;
 }
 
-struct usysfs_attribute_operations tom_attr_ops = {
-	.show	= &tom_attr_show,
-	.store	= &tom_attr_store,
-};
 
 static void tom_release(struct uobject *uobj)
 {
@@ -582,12 +567,13 @@
 }
 
 static struct usysfs_object_operations tom_object_ops = {
-	.release	= tom_release,
+	.release		= tom_release,
+	.show_attribute		= tom_attr_show,
+	.store_attribute	= tom_attr_store,
 };
 
 static struct uobj_type uktype_tom = {
 	.object_ops	= &tom_object_ops,
-	.attr_ops	= &tom_attr_ops,
 	.attrs		= tom_attrs,
 	.owner	= THIS_MODULE,
 };
@@ -624,9 +610,6 @@
 	return ret;
 }
 
-static struct usysfs_attribute_operations tomset_attr_ops = {
-	.show	= &tomset_attr_show,
-};
 
 static ssize_t tomset_toms_read(struct tomset *tomset, char *page)
 {
@@ -699,14 +682,18 @@
 	uobject_put(uobj);
 }
 
+static struct usysfs_object_operations tomset_object_ops = {
+	.show_attribute	= tomset_attr_show,
+};
+
 static struct usysfs_set_operations tomset_set_ops = {
 	.make_set	= make_tom,
 	.drop_object	= drop_tom,
 };
 
 static struct uobj_type uktype_tomset = {
+	.object_ops	= &tomset_object_ops,
 	.set_ops	= &tomset_set_ops,
-	.attr_ops	= &tomset_attr_ops,
 	.attrs		= tomset_attrs,
 };
 

Modified: trunk/fs/usysfs/dir.c
===================================================================
--- trunk/fs/usysfs/dir.c	2005-03-28 20:16:38 UTC (rev 2064)
+++ trunk/fs/usysfs/dir.c	2005-03-29 00:20:12 UTC (rev 2065)
@@ -939,7 +939,6 @@
 	if (err)
 		return err;
 
-	set->uobj.uset = set;
 	if (!set->uobj.k_name)
 		set->uobj.k_name = set->uobj.name;
 

Modified: trunk/fs/usysfs/file.c
===================================================================
--- trunk/fs/usysfs/file.c	2005-03-28 20:16:38 UTC (rev 2064)
+++ trunk/fs/usysfs/file.c	2005-03-29 00:20:12 UTC (rev 2065)
@@ -40,7 +40,7 @@
 	size_t			count;
 	loff_t			pos;
 	char			* page;
-	struct usysfs_attribute_operations	* ops;
+	struct usysfs_object_operations	* ops;
 	struct semaphore	sem;
 	int			needs_read_fill;
 };
@@ -60,7 +60,7 @@
 {
 	struct usysfs_attribute * attr = to_attr(dentry);
 	struct uobject * uobj = to_uobj(dentry->d_parent);
-	struct usysfs_attribute_operations * ops = buffer->ops;
+	struct usysfs_object_operations * ops = buffer->ops;
 	int ret = 0;
 	ssize_t count;
 
@@ -69,7 +69,7 @@
 	if (!buffer->page)
 		return -ENOMEM;
 
-	count = ops->show(uobj,attr,buffer->page);
+	count = ops->show_attribute(uobj,attr,buffer->page);
 	buffer->needs_read_fill = 0;
 	BUG_ON(count > (ssize_t)PAGE_SIZE);
 	if (count >= 0)
@@ -191,9 +191,9 @@
 {
 	struct usysfs_attribute * attr = to_attr(dentry);
 	struct uobject * uobj = to_uobj(dentry->d_parent);
-	struct usysfs_attribute_operations * ops = buffer->ops;
+	struct usysfs_object_operations * ops = buffer->ops;
 
-	return ops->store(uobj,attr,buffer->page,count);
+	return ops->store_attribute(uobj,attr,buffer->page,count);
 }
 
 
@@ -234,7 +234,7 @@
 	struct uobject *uobj = usysfs_get_uobject(file->f_dentry->d_parent);
 	struct usysfs_attribute * attr = to_attr(file->f_dentry);
 	struct usysfs_buffer * buffer;
-	struct usysfs_attribute_operations * ops = NULL;
+	struct usysfs_object_operations * ops = NULL;
 	int error = 0;
 
 	if (!uobj || !attr)
@@ -250,7 +250,7 @@
 	 * itself, and use ops for it.
 	 */
 	if (uobj->ktype)
-		ops = uobj->ktype->attr_ops;
+		ops = uobj->ktype->object_ops;
 	else
 		goto Eaccess;
 
@@ -260,7 +260,7 @@
 	 */
 	if (file->f_mode & FMODE_WRITE) {
 
-		if (!(inode->i_mode & S_IWUGO) || !ops->store)
+		if (!(inode->i_mode & S_IWUGO) || !ops->store_attribute)
 			goto Eaccess;
 
 	}
@@ -270,7 +270,7 @@
 	 * must be a show method for it.
 	 */
 	if (file->f_mode & FMODE_READ) {
-		if (!(inode->i_mode & S_IRUGO) || !ops->show)
+		if (!(inode->i_mode & S_IRUGO) || !ops->show_attribute)
 			goto Eaccess;
 	}
 

Modified: trunk/fs/usysfs/uobject.h
===================================================================
--- trunk/fs/usysfs/uobject.h	2005-03-28 20:16:38 UTC (rev 2064)
+++ trunk/fs/usysfs/uobject.h	2005-03-29 00:20:12 UTC (rev 2065)
@@ -43,7 +43,6 @@
 struct usysfs_object_operations;
 struct usysfs_set_operations;
 struct usysfs_attribute;
-struct usysfs_attribute_operations;
 struct usysfs_subsystem;
 
 struct uobject {
@@ -74,7 +73,6 @@
 	struct module *owner;
 	struct usysfs_object_operations		*object_ops;
 	struct usysfs_set_operations		*set_ops;
-	struct usysfs_attribute_operations	*attr_ops;
 	struct usysfs_attribute			**attrs;
 };
 

Modified: trunk/fs/usysfs/usysfs.h
===================================================================
--- trunk/fs/usysfs/usysfs.h	2005-03-28 20:16:38 UTC (rev 2064)
+++ trunk/fs/usysfs/usysfs.h	2005-03-29 00:20:12 UTC (rev 2065)
@@ -58,6 +58,8 @@
  */
 struct usysfs_object_operations {
 	void (*release)(struct uobject *);
+	ssize_t	(*show_attribute)(struct uobject *, struct usysfs_attribute *,char *);
+	ssize_t	(*store_attribute)(struct uobject *,struct usysfs_attribute *,const char *, size_t);
 	int (*allow_link)(struct uobject *src, struct uobject *target);
 	int (*drop_link)(struct uobject *src, struct uobject *target);
 };
@@ -91,18 +93,7 @@
 
 #define attr_name(_attr) (_attr).attr.name
 
-struct usysfs_bin_attribute {
-	struct usysfs_attribute	attr;
-	size_t			size;
-	ssize_t (*read)(struct uobject *, char *, loff_t, size_t);
-	ssize_t (*write)(struct uobject *, char *, loff_t, size_t);
-};
 
-struct usysfs_attribute_operations {
-	ssize_t	(*show)(struct uobject *, struct usysfs_attribute *,char *);
-	ssize_t	(*store)(struct uobject *,struct usysfs_attribute *,const char *, size_t);
-};
-
 struct usysfs_subsystem {
 	struct uset		su_set;
 	struct semaphore	su_sem;



More information about the Ocfs2-commits mailing list