[Ocfs2-commits] jlbec commits r2045 - in trunk/fs: ocfs2 ocfs2/cluster ocfs2/dlm usysfs usysfs/compatinclude/linux

svn-commits at oss.oracle.com svn-commits at oss.oracle.com
Thu Mar 24 14:11:12 CST 2005


Author: jlbec
Signed-off-by: zab
Date: 2005-03-24 14:11:10 -0600 (Thu, 24 Mar 2005)
New Revision: 2045

Added:
   trunk/fs/usysfs/uobject.c
   trunk/fs/usysfs/uobject.h
Removed:
   trunk/fs/usysfs/Kbuild
   trunk/fs/usysfs/compat_kobject.c
   trunk/fs/usysfs/compatinclude/linux/kobject.h
   trunk/fs/usysfs/compatinclude/linux/sysfs.h
Modified:
   trunk/fs/ocfs2/Makefile
   trunk/fs/ocfs2/cluster/heartbeat.c
   trunk/fs/ocfs2/cluster/heartbeat.h
   trunk/fs/ocfs2/cluster/nodemanager.c
   trunk/fs/ocfs2/cluster/nodemanager.h
   trunk/fs/ocfs2/dlm/Makefile
   trunk/fs/usysfs/Makefile
   trunk/fs/usysfs/bin.c
   trunk/fs/usysfs/bobtest.c
   trunk/fs/usysfs/dir.c
   trunk/fs/usysfs/file.c
   trunk/fs/usysfs/inode.c
   trunk/fs/usysfs/mount.c
   trunk/fs/usysfs/symlink.c
   trunk/fs/usysfs/usysfs.h
   trunk/fs/usysfs/usysfs_internal.h
Log:

o Change kobject to uobject, kset to uset, kobj_type to uobj_type.
o Trivial object lifetime fix.

Signed-off-by: zab



Modified: trunk/fs/ocfs2/Makefile
===================================================================
--- trunk/fs/ocfs2/Makefile	2005-03-24 04:17:32 UTC (rev 2044)
+++ trunk/fs/ocfs2/Makefile	2005-03-24 20:11:10 UTC (rev 2045)
@@ -11,7 +11,8 @@
 include $(OUR_TOPDIR)/Config.make
 
 CLUSTERINC := $(OUR_TOPDIR)/fs/ocfs2
-EXTRA_CFLAGS += -I$(CLUSTERINC)
+USYSFSINC := $(OUR_TOPDIR)/fs/usysfs
+EXTRA_CFLAGS += -I$(CLUSTERINC) -I$(USYSFSINC)
 
 endif
 

Modified: trunk/fs/ocfs2/cluster/heartbeat.c
===================================================================
--- trunk/fs/ocfs2/cluster/heartbeat.c	2005-03-24 04:17:32 UTC (rev 2044)
+++ trunk/fs/ocfs2/cluster/heartbeat.c	2005-03-24 20:11:10 UTC (rev 2045)
@@ -117,7 +117,7 @@
 /* each thread owns a region.. when we're asked to tear down the region
  * we ask the thread to stop, who cleans up the region */
 struct hb_region {
-	struct kobject		hr_kobj;
+	struct uobject		hr_uobj;
 	/* protected by the hr_callback_sem */
 	struct list_head	hr_active_item;
 	struct task_struct 	*hr_task;
@@ -443,17 +443,17 @@
  * the cluster set in nodemanager.c.
  */
 
-static struct hb_region *to_hb_region(struct kobject *kobj)
+static struct hb_region *to_hb_region(struct uobject *uobj)
 {
-	return kobj ? container_of(kobj, struct hb_region, hr_kobj) : NULL;
+	return uobj ? container_of(uobj, struct hb_region, hr_uobj) : NULL;
 }
 
 /* drop_object only drops its ref after killing the thread, nothing should
  * be using the region anymore.  this has to clean up any state that
  * attributes might have built up. */
-static void hb_region_release(struct kobject *kobj)
+static void hb_region_release(struct uobject *uobj)
 {
-	struct hb_region *reg = to_hb_region(kobj);
+	struct hb_region *reg = to_hb_region(uobj);
 	struct hb_disk_slot *slot;
 	int i;
 
@@ -603,7 +603,7 @@
 	atomic_set(&reg->hr_steady_iterations, 2);
 
 	reg->hr_task = kthread_run(hb_thread, reg, "hb-%s",
-				   reg->hr_kobj.k_name);
+				   reg->hr_uobj.k_name);
 	if (IS_ERR(reg->hr_task)) {
 		reg->hr_task = NULL;
 		goto out;
@@ -632,7 +632,7 @@
 	return ret;
 }
 struct hb_region_attribute {
-	struct attribute attr;
+	struct usysfs_attribute attr;
 	ssize_t (*show)(struct hb_region *, char *);
 	ssize_t (*store)(struct hb_region *, const char *, size_t);
 };
@@ -658,7 +658,7 @@
 	.store	= hb_region_dev_write,
 };
 
-static struct attribute *hb_region_default_attrs[] = {
+static struct usysfs_attribute *hb_region_default_attrs[] = {
 	&hb_region_attr_block_bytes.attr,
 	&hb_region_attr_start_block.attr,
 	&hb_region_attr_blocks.attr,
@@ -666,11 +666,11 @@
 	NULL,
 };
 
-static ssize_t hb_region_show(struct kobject *kobj,
-			      struct attribute *attr,
+static ssize_t hb_region_show(struct uobject *uobj,
+			      struct usysfs_attribute *attr,
 			      char *page)
 {
-	struct hb_region *reg = to_hb_region(kobj);
+	struct hb_region *reg = to_hb_region(uobj);
 	struct hb_region_attribute *hb_region_attr =
 		container_of(attr, struct hb_region_attribute, attr);
 	ssize_t ret = 0;
@@ -680,11 +680,11 @@
 	return ret;
 }
 
-static ssize_t hb_region_store(struct kobject *kobj,
-			       struct attribute *attr,
+static ssize_t hb_region_store(struct uobject *uobj,
+			       struct usysfs_attribute *attr,
 			       const char *page, size_t count)
 {
-	struct hb_region *reg = to_hb_region(kobj);
+	struct hb_region *reg = to_hb_region(uobj);
 	struct hb_region_attribute *hb_region_attr =
 		container_of(attr, struct hb_region_attribute, attr);
 	ssize_t ret = -EINVAL;
@@ -694,12 +694,12 @@
 	return ret;
 }
 
-struct sysfs_ops hb_region_sysfs_ops = {
+struct usysfs_attribute_operations hb_region_sysfs_ops = {
 	.show	= &hb_region_show,
 	.store	= &hb_region_store,
 };
 
-static struct ukobj_type hb_region_type = {
+static struct uuobj_type hb_region_type = {
 	.ktype	= {
 		.release	= hb_region_release,
 		.sysfs_ops	= &hb_region_sysfs_ops,
@@ -711,22 +711,22 @@
 /* heartbeat set */
 
 struct hb_heartbeat_set {
-	struct ukset hs_ukset;
+	struct uuset hs_uuset;
 	/* some stuff? */
 };
 
-static struct hb_heartbeat_set *to_hb_heartbeat_set(struct kset *kset)
+static struct hb_heartbeat_set *to_hb_heartbeat_set(struct uset *uset)
 {
-	return kset ?
-		container_of(to_ukset(kset), struct hb_heartbeat_set, hs_ukset)
+	return uset ?
+		container_of(to_uuset(uset), struct hb_heartbeat_set, hs_uuset)
 		: NULL;
 }
 
-static struct kobject *hb_heartbeat_set_make_object(struct kset *kset,
+static struct uobject *hb_heartbeat_set_make_object(struct uset *uset,
 						    const char *name)
 {
 	struct hb_region *reg = NULL;
-	struct kobject *ret = NULL;
+	struct uobject *ret = NULL;
 
 	reg = kcalloc(1, sizeof(struct hb_region), GFP_KERNEL);
 	if (reg == NULL)
@@ -736,11 +736,11 @@
 	rwlock_init(&reg->hr_slot_list_lock);
 	INIT_LIST_HEAD(&reg->hr_live_list);
 
-	kobject_set_name(&reg->hr_kobj, name);
-	reg->hr_kobj.ktype = &hb_region_type.ktype;
-	kobject_init(&reg->hr_kobj);
+	uobject_set_name(&reg->hr_uobj, name);
+	reg->hr_uobj.ktype = &hb_region_type.ktype;
+	uobject_init(&reg->hr_uobj);
 
-	ret = &reg->hr_kobj;
+	ret = &reg->hr_uobj;
 out:
 	if (ret == NULL)
 		kfree(reg);
@@ -748,10 +748,10 @@
 	return ret;
 }
 
-static void hb_heartbeat_set_drop_object(struct kset *kset,
-				         struct kobject *kobj)
+static void hb_heartbeat_set_drop_object(struct uset *uset,
+				         struct uobject *uobj)
 {
-	struct hb_region *reg = to_hb_region(kobj);
+	struct hb_region *reg = to_hb_region(uobj);
 
 	down_read(&hb_callback_sem);
 	if (!list_empty(&reg->hr_active_item))
@@ -764,10 +764,10 @@
 		reg->hr_task = NULL;
 	}
 
-	kobject_put(kobj);
+	uobject_put(uobj);
 }
 
-struct ukobj_type hb_heartbeat_set_type = {
+struct uuobj_type hb_heartbeat_set_type = {
 	.ktype = {
 		.sysfs_ops	= NULL, /* no attributes */
 	},
@@ -776,30 +776,30 @@
 	.owner		= THIS_MODULE,
 };
 
-/* this is just here to avoid touching ukset in heartbeat.h which the
+/* this is just here to avoid touching uuset in heartbeat.h which the
  * entire damn world #includes */
-struct kset *hb_alloc_hb_set(void)
+struct uset *hb_alloc_hb_set(void)
 {
 	struct hb_heartbeat_set *hs = NULL;
-	struct kset *ret = NULL;
+	struct uset *ret = NULL;
 
 	hs = kcalloc(1, sizeof(struct hb_heartbeat_set), GFP_KERNEL);
 	if (hs == NULL)
 		goto out;
 
-	ukset_init_type_name(&hs->hs_ukset, "heartbeat",
+	uuset_init_type_name(&hs->hs_uuset, "heartbeat",
 			     &hb_heartbeat_set_type.ktype);
 
-	ret = &hs->hs_ukset.kset;
+	ret = &hs->hs_uuset.uset;
 out:
 	if (ret == NULL)
 		kfree(hs);
 	return ret;
 }
 
-void hb_free_hb_set(struct kset *kset)
+void hb_free_hb_set(struct uset *uset)
 {
-	struct hb_heartbeat_set *hs = to_hb_heartbeat_set(kset);
+	struct hb_heartbeat_set *hs = to_hb_heartbeat_set(uset);
 	kfree(hs);
 }
 

Modified: trunk/fs/ocfs2/cluster/heartbeat.h
===================================================================
--- trunk/fs/ocfs2/cluster/heartbeat.h	2005-03-24 04:17:32 UTC (rev 2044)
+++ trunk/fs/ocfs2/cluster/heartbeat.h	2005-03-24 20:11:10 UTC (rev 2045)
@@ -52,8 +52,8 @@
 /* number of missed changes to be seen as dead */ 
 #define HB_DEAD_THRESHOLD	   30
 
-struct kset *hb_alloc_hb_set(void);
-void hb_free_hb_set(struct kset *kset);
+struct uset *hb_alloc_hb_set(void);
+void hb_free_hb_set(struct uset *uset);
 
 void hb_setup_callback(struct hb_callback_func *hc, int type, hb_cb_func *func,
 		      void *data, int priority);

Modified: trunk/fs/ocfs2/cluster/nodemanager.c
===================================================================
--- trunk/fs/ocfs2/cluster/nodemanager.c	2005-03-24 04:17:32 UTC (rev 2044)
+++ trunk/fs/ocfs2/cluster/nodemanager.c	2005-03-24 20:11:10 UTC (rev 2045)
@@ -55,10 +55,11 @@
 #include <linux/pagemap.h>
 #include <linux/hash.h>
 #include <linux/bitops.h>
-#include <linux/kobject.h>
 
 #include <asm/uaccess.h>
 
+#include "uobject.h"
+
 #include "tcp.h"
 #include "nodemanager.h"
 #include "heartbeat.h"
@@ -83,7 +84,7 @@
 #endif
 
 struct nm_cluster {
-	struct ukset	cl_ukset;
+	struct uuset	cl_uuset;
 	unsigned	cl_has_local:1;
 	u8		cl_local_node;
 	rwlock_t	cl_nodes_lock;
@@ -196,22 +197,22 @@
 
 /* node usysfs bits */
 
-static struct nm_cluster *to_nm_cluster(struct kobject *kobj)
+static struct nm_cluster *to_nm_cluster(struct uobject *uobj)
 {
-	return kobj ?
-		container_of(to_ukset(to_kset(kobj)), struct nm_cluster,
-			     cl_ukset)
+	return uobj ?
+		container_of(to_uuset(to_uset(uobj)), struct nm_cluster,
+			     cl_uuset)
 		: NULL;
 }
 
-static struct nm_node *to_nm_node(struct kobject *kobj)
+static struct nm_node *to_nm_node(struct uobject *uobj)
 {
-	return kobj ? container_of(kobj, struct nm_node, nd_kobj) : NULL;
+	return uobj ? container_of(uobj, struct nm_node, nd_uobj) : NULL;
 }
 
-static void nm_node_release(struct kobject *kobj)
+static void nm_node_release(struct uobject *uobj)
 {
-	struct nm_node *node = to_nm_node(kobj);
+	struct nm_node *node = to_nm_node(uobj);
 	printk("releasing node %p\n", node);
 }
 
@@ -224,7 +225,7 @@
 {
 	/* through the first node_set .parent
 	 * mycluster/nodes/mynode == nm_cluster->nm_node_set->nm_node */
-	return to_nm_cluster(node->nd_kobj.parent->parent);
+	return to_nm_cluster(node->nd_uobj.parent->parent);
 }
 
 static ssize_t nm_node_num_write(struct nm_node *node, const char *page,
@@ -374,7 +375,7 @@
 }
 
 struct nm_node_attribute {
-	struct attribute attr;
+	struct usysfs_attribute attr;
 	ssize_t (*show)(struct nm_node *, char *);
 	ssize_t (*store)(struct nm_node *, const char *, size_t);
 };
@@ -399,7 +400,7 @@
 	.show	= nm_node_local_read,
 	.store	= nm_node_local_write,
 };
-static struct attribute *nm_node_default_attrs[] = {
+static struct usysfs_attribute *nm_node_default_attrs[] = {
 	&nm_node_attr_num.attr,
 	&nm_node_attr_ipv4_port.attr,
 	&nm_node_attr_ipv4_address.attr,
@@ -407,11 +408,11 @@
 	NULL,
 };
 
-static ssize_t nm_node_show(struct kobject *kobj,
-			    struct attribute *attr,
+static ssize_t nm_node_show(struct uobject *uobj,
+			    struct usysfs_attribute *attr,
 			    char *page)
 {
-	struct nm_node *node = to_nm_node(kobj);
+	struct nm_node *node = to_nm_node(uobj);
 	struct nm_node_attribute *nm_node_attr =
 		container_of(attr, struct nm_node_attribute, attr);
 	ssize_t ret = 0;
@@ -421,11 +422,11 @@
 	return ret;
 }
 
-static ssize_t nm_node_store(struct kobject *kobj,
-			      struct attribute *attr,
+static ssize_t nm_node_store(struct uobject *uobj,
+			      struct usysfs_attribute *attr,
 			      const char *page, size_t count)
 {
-	struct nm_node *node = to_nm_node(kobj);
+	struct nm_node *node = to_nm_node(uobj);
 	struct nm_node_attribute *nm_node_attr =
 		container_of(attr, struct nm_node_attribute, attr);
 	ssize_t ret = -EINVAL;
@@ -435,12 +436,12 @@
 	return ret;
 }
 
-struct sysfs_ops nm_node_sysfs_ops = {
+struct usysfs_attribute_operations nm_node_sysfs_ops = {
 	.show	= &nm_node_show,
 	.store	= &nm_node_store,
 };
 
-static struct ukobj_type nm_node_type = {
+static struct uuobj_type nm_node_type = {
 	.ktype	= {
 		.release	= nm_node_release,
 		.sysfs_ops	= &nm_node_sysfs_ops,
@@ -453,25 +454,25 @@
 /* node set */
 
 struct nm_node_set {
-	struct ukset ns_ukset;
+	struct uuset ns_uuset;
 	/* some stuff? */
 };
 
 #if 0
-static struct nm_node_set *to_nm_node_set(struct kset *kset)
+static struct nm_node_set *to_nm_node_set(struct uset *uset)
 {
-	return kset ? 
-		container_of(to_ukset(kset), struct nm_node_set, ns_ukset) 
+	return uset ? 
+		container_of(to_uuset(uset), struct nm_node_set, ns_uuset) 
 		: NULL;
 }
 #endif
 
-static struct kobject *nm_node_set_make_object(struct kset *kset,
+static struct uobject *nm_node_set_make_object(struct uset *uset,
 					      const char *name)
 {
 	struct nm_node *node = NULL;
-	struct nm_cluster *cluster = to_nm_cluster(kset->kobj.parent);
-	struct kobject *ret = NULL;
+	struct nm_cluster *cluster = to_nm_cluster(uset->uobj.parent);
+	struct uobject *ret = NULL;
 	net_inode_private *nip;
 
 	printk("trying to make a node object under cluster %p\n", cluster);
@@ -483,7 +484,7 @@
 	if (node == NULL)
 		goto out; /* ENOMEM */
 
-	strcpy(node->nd_name, name); /* use kobj.name instead? */
+	strcpy(node->nd_name, name); /* use uobj.name instead? */
 	node->nd_num = NM_MAX_NODES;
 
 	/* this should be somewhere else */
@@ -499,11 +500,11 @@
 		goto out; /* ENOMEM */
 	}
 
-	kobject_set_name(&node->nd_kobj, name);
-	node->nd_kobj.ktype = &nm_node_type.ktype;
-	kobject_init(&node->nd_kobj);
+	uobject_set_name(&node->nd_uobj, name);
+	node->nd_uobj.ktype = &nm_node_type.ktype;
+	uobject_init(&node->nd_uobj);
 
-	ret = &node->nd_kobj;
+	ret = &node->nd_uobj;
 
 out:
 	if (ret == NULL)
@@ -512,10 +513,10 @@
 	return ret;
 }
 
-static void nm_node_set_drop_object(struct kset *kset, struct kobject *kobj)
+static void nm_node_set_drop_object(struct uset *uset, struct uobject *uobj)
 {
-	struct nm_node *node = to_nm_node(kobj);
-	struct nm_cluster *cluster = to_nm_cluster(node->nd_kobj.parent);
+	struct nm_node *node = to_nm_node(uobj);
+	struct nm_cluster *cluster = to_nm_cluster(node->nd_uobj.parent);
 	int node_not_in_nodes_array = 0;
 
 	/* please don't try this yet, needs proper refcounts of nodes too */
@@ -544,10 +545,10 @@
 
 	BUG_ON(node_not_in_nodes_array);
 
-	kobject_put(kobj);
+	uobject_put(uobj);
 }
 
-static struct ukobj_type nm_node_set_type = {
+static struct uuobj_type nm_node_set_type = {
 	.ktype = {
 		.sysfs_ops	= NULL, /* no attributes */
 	},
@@ -558,17 +559,17 @@
 
 /* cluster */
 
-static void nm_cluster_release(struct kobject *kobj)
+static void nm_cluster_release(struct uobject *uobj)
 {
-	struct nm_cluster *cluster = to_nm_cluster(kobj);
+	struct nm_cluster *cluster = to_nm_cluster(uobj);
 
 	printk("releasing cluster %p\n", cluster);
 
-	kfree(cluster->cl_ukset.default_sets);
+	kfree(cluster->cl_uuset.default_sets);
 	kfree(cluster);
 }
 
-static struct ukobj_type nm_cluster_type = {
+static struct uuobj_type nm_cluster_type = {
 	.ktype	= {
 		.release	= nm_cluster_release,
 		.sysfs_ops	= NULL, /* no attributes */
@@ -580,25 +581,25 @@
 /* cluster set */
 
 struct nm_cluster_set {
-	struct ukset cs_ukset;
+	struct uuset cs_uuset;
 	/* some stuff? */
 };
 
 #if 0
-static struct nm_cluster_set *to_nm_cluster_set(struct kset *kset)
+static struct nm_cluster_set *to_nm_cluster_set(struct uset *uset)
 {
-	return kset ?
-		container_of(to_ukset(kset), struct nm_cluster_set, cs_ukset)
+	return uset ?
+		container_of(to_uuset(uset), struct nm_cluster_set, cs_uuset)
 	       : NULL;
 }
 #endif
 
-static struct kset *nm_cluster_set_make_set(struct kset *kset,
+static struct uset *nm_cluster_set_make_set(struct uset *uset,
 					    const char *name)
 {
 	struct nm_cluster *cluster = NULL;
 	struct nm_node_set *ns = NULL;
-	struct kset *hb_kset = NULL, *ret = NULL;
+	struct uset *hb_uset = NULL, *ret = NULL;
 	void *defs = NULL;
 
 	printk("trying to make a cluster object\n");
@@ -610,46 +611,46 @@
 
 	cluster = kcalloc(1, sizeof(struct nm_cluster), GFP_KERNEL);
 	ns = kcalloc(1, sizeof(struct nm_node_set), GFP_KERNEL);
-	defs = kcalloc(3, sizeof(struct kset *), GFP_KERNEL);
-	hb_kset = hb_alloc_hb_set();
-	if (cluster == NULL || ns == NULL || hb_kset == NULL || defs == NULL)
+	defs = kcalloc(3, sizeof(struct uset *), GFP_KERNEL);
+	hb_uset = hb_alloc_hb_set();
+	if (cluster == NULL || ns == NULL || hb_uset == NULL || defs == NULL)
 		goto out;
 
-	ukset_init_type_name(&cluster->cl_ukset, name, &nm_cluster_type.ktype);
-	ukset_init_type_name(&ns->ns_ukset, "node", &nm_node_set_type.ktype);
+	uuset_init_type_name(&cluster->cl_uuset, name, &nm_cluster_type.ktype);
+	uuset_init_type_name(&ns->ns_uuset, "node", &nm_node_set_type.ktype);
 
-	cluster->cl_ukset.default_sets = defs;
-	cluster->cl_ukset.default_sets[0] = &ns->ns_ukset.kset;
-	cluster->cl_ukset.default_sets[1] = hb_kset;
-	cluster->cl_ukset.default_sets[2] = NULL;
+	cluster->cl_uuset.default_sets = defs;
+	cluster->cl_uuset.default_sets[0] = &ns->ns_uuset.uset;
+	cluster->cl_uuset.default_sets[1] = hb_uset;
+	cluster->cl_uuset.default_sets[2] = NULL;
 	rwlock_init(&cluster->cl_nodes_lock);
 	cluster->cl_node_ip_tree = RB_ROOT;
 
-	ret = &cluster->cl_ukset.kset;
+	ret = &cluster->cl_uuset.uset;
 	nm_single_cluster = cluster;
 
 out:
 	if (ret == NULL) {
 		kfree(cluster);
 		kfree(ns);
-		hb_free_hb_set(hb_kset);
+		hb_free_hb_set(hb_uset);
 		kfree(defs);
 	}
 
 	return ret;
 }
 
-static void nm_cluster_set_drop_object(struct kset *kset, struct kobject *kobj)
+static void nm_cluster_set_drop_object(struct uset *uset, struct uobject *uobj)
 {
-	struct nm_cluster *cluster = to_nm_cluster(kobj);
+	struct nm_cluster *cluster = to_nm_cluster(uobj);
 
 	BUG_ON(nm_single_cluster != cluster);
 	nm_single_cluster = NULL;
 
-	kobject_put(kobj);
+	uobject_put(uobj);
 }
 
-static struct ukobj_type nm_cluster_set_type = {
+static struct uuobj_type nm_cluster_set_type = {
 	.ktype = {
 		.sysfs_ops	= NULL, /* no attributes */
 	},
@@ -659,9 +660,9 @@
 };
 
 static struct nm_cluster_set nm_cluster_set = {
-	.cs_ukset = {
-		.kset = {
-			.kobj = {
+	.cs_uuset = {
+		.uset = {
+			.uobj = {
 				.name = "cluster",
 				.ktype = &nm_cluster_set_type.ktype,
 			},
@@ -674,7 +675,7 @@
 	nmprintk("unloading nm module\n");
 	/* XXX sync with hb callbacks and shut down hb? */
 	net_unregister_hb_callbacks();
-	usysfs_unregister_subsystem(&nm_cluster_set.cs_ukset.kset);
+	usysfs_unregister_subsystem(&nm_cluster_set.cs_uuset.uset);
 }
 
 static int __init init_nm(void)
@@ -686,8 +687,8 @@
 	if (ret)
 		goto out;
 
-	ukset_init(&nm_cluster_set.cs_ukset);
-	ret = usysfs_register_subsystem(&nm_cluster_set.cs_ukset.kset);
+	uuset_init(&nm_cluster_set.cs_uuset);
+	ret = usysfs_register_subsystem(&nm_cluster_set.cs_uuset.uset);
 	if (ret) {
 		printk(KERN_ERR "nodemanager: Registration returned %d\n", ret);
 		goto out;

Modified: trunk/fs/ocfs2/cluster/nodemanager.h
===================================================================
--- trunk/fs/ocfs2/cluster/nodemanager.h	2005-03-24 04:17:32 UTC (rev 2044)
+++ trunk/fs/ocfs2/cluster/nodemanager.h	2005-03-24 20:11:10 UTC (rev 2045)
@@ -31,7 +31,10 @@
 
 #include "ocfs2_nodemanager.h"
 
+/* This totally doesn't belong here. */
+#include "uobject.h"
 
+
 /* TODO: move this */
 /*
  * this stores the per-socket state for each socket that we associate
@@ -71,7 +74,7 @@
 } net_inode_private;
 
 struct nm_node {
-	struct kobject		nd_kobj; 
+	struct uobject		nd_uobj; 
 	char			nd_name[NM_MAX_NAME_LEN+1]; /* replace? */
 	__u8			nd_num;
 	/* only one address per node, as attributes, for now.  both

Modified: trunk/fs/ocfs2/dlm/Makefile
===================================================================
--- trunk/fs/ocfs2/dlm/Makefile	2005-03-24 04:17:32 UTC (rev 2044)
+++ trunk/fs/ocfs2/dlm/Makefile	2005-03-24 20:11:10 UTC (rev 2045)
@@ -12,10 +12,11 @@
 
 include $(OUR_TOPDIR)/Config.make
 CLUSTERINC = $(OUR_TOPDIR)/fs/ocfs2
+USYSFSINC = $(OUR_TOPDIR)/fs/usysfs
 
 endif
 
-EXTRA_CFLAGS += -I$(CLUSTERINC)
+EXTRA_CFLAGS += -I$(CLUSTERINC) -I$(USYSFSINC)
 
 ifneq ($(QUIET),1)
 EXTRA_CFLAGS += -DENABLE_DLMPRINTK

Deleted: trunk/fs/usysfs/Kbuild
===================================================================
--- trunk/fs/usysfs/Kbuild	2005-03-24 04:17:32 UTC (rev 2044)
+++ trunk/fs/usysfs/Kbuild	2005-03-24 20:11:10 UTC (rev 2045)
@@ -1,9 +0,0 @@
-#
-# Makefile for the usysfs virtual filesystem
-#
-
-INSTALL_MOD_DIR := fs/usysfs
-
-obj-m		:= usysfs.o bobtest.o
-usysfs-objs	:= inode.o file.o dir.o symlink.o mount.o bin.o
-		   

Modified: trunk/fs/usysfs/Makefile
===================================================================
--- trunk/fs/usysfs/Makefile	2005-03-24 04:17:32 UTC (rev 2044)
+++ trunk/fs/usysfs/Makefile	2005-03-24 20:11:10 UTC (rev 2045)
@@ -11,18 +11,22 @@
 include $(OUR_TOPDIR)/Config.make
 endif
 
+INSTALL_MOD_DIR := fs/usysfs
+
+obj-m		:= usysfs.o bobtest.o
+usysfs-objs	:= inode.o file.o dir.o symlink.o mount.o bin.o uobject.o
+		   
 ifeq ($(KERNELRELEASE),)
 #
 # Called from a regular "make".
 #
 
 HEADERS =					\
+	uobject.h				\
 	usysfs.h				\
 	usysfs_internal.h			\
 	compatinclude/linux/compat.h		\
 	compatinclude/linux/kref.h		\
-	compatinclude/linux/kobject.h		\
-	compatinclude/linux/sysfs.h		\
 	compatinclude/linux/compat_libfs.h
 
 # Get the kobject includes, as this is a 2.4 build
@@ -35,21 +39,16 @@
 	inode.c			\
 	mount.c			\
 	symlink.c		\
+	uobject.c		\
 	compat_kref.c		\
-	compat_kobject.c	\
 	compat_libfs.c
 USYSFS_OBJECTS = $(subst .c,.o,$(USYSFS_SOURCES))
 
 BOBTEST_SOURCES = bobtest.c
 BOBTEST_OBJECTS = $(subst .c,.o,$(BOBTEST_SOURCES))
 
-DIST_FILES = $(USYSFS_SOURCES) $(BOBTEST_SOURCES) $(HEADERS) Kbuild
+DIST_FILES = $(USYSFS_SOURCES) $(BOBTEST_SOURCES) $(HEADERS)
 
-INSTALL_MOD_DIR := fs/usysfs
-
-obj-m := usysfs.o bobtest.o
-usysfs-objs := $(USYSFS_OBJECTS)
-
 ALL_RULES = build-modules
 
 CLEAN_RULES = clean-modules
@@ -87,10 +86,4 @@
 
 include $(TOPDIR)/Postamble.make
 
-else
-#
-# Called from kbuild in a kernel that predates Kbuild files.
-#
-
-include $(OUR_TOPDIR)/fs/usysfs/Kbuild
 endif

Modified: trunk/fs/usysfs/bin.c
===================================================================
--- trunk/fs/usysfs/bin.c	2005-03-24 04:17:32 UTC (rev 2044)
+++ trunk/fs/usysfs/bin.c	2005-03-24 20:11:10 UTC (rev 2045)
@@ -26,22 +26,22 @@
 
 #include <linux/errno.h>
 #include <linux/fs.h>
-#include <linux/kobject.h>
 #include <linux/module.h>
 #include <linux/slab.h>
 
 #include <asm/uaccess.h>
 
+#include "uobject.h"
 #include "usysfs.h"
 #include "usysfs_internal.h"
 
 static int
 fill_read(struct dentry *dentry, char *buffer, loff_t off, size_t count)
 {
-	struct bin_attribute * attr = to_bin_attr(dentry);
-	struct kobject * kobj = to_kobj(dentry->d_parent);
+	struct usysfs_bin_attribute * attr = to_bin_attr(dentry);
+	struct uobject * uobj = to_uobj(dentry->d_parent);
 
-	return attr->read(kobj, buffer, off, count);
+	return attr->read(uobj, buffer, off, count);
 }
 
 static ssize_t
@@ -81,10 +81,10 @@
 static int
 flush_write(struct dentry *dentry, char *buffer, loff_t offset, size_t count)
 {
-	struct bin_attribute *attr = to_bin_attr(dentry);
-	struct kobject *kobj = to_kobj(dentry->d_parent);
+	struct usysfs_bin_attribute *attr = to_bin_attr(dentry);
+	struct uobject *uobj = to_uobj(dentry->d_parent);
 
-	return attr->write(kobj, buffer, offset, count);
+	return attr->write(uobj, buffer, offset, count);
 }
 
 static ssize_t write(struct file * file, const char __user * userbuf,
@@ -115,11 +115,11 @@
 
 static int open(struct inode * inode, struct file * file)
 {
-	struct kobject *kobj = usysfs_get_kobject(file->f_dentry->d_parent);
-	struct bin_attribute * attr = to_bin_attr(file->f_dentry);
+	struct uobject *uobj = usysfs_get_uobject(file->f_dentry->d_parent);
+	struct usysfs_bin_attribute * attr = to_bin_attr(file->f_dentry);
 	int error = -EINVAL;
 
-	if (!kobj || !attr)
+	if (!uobj || !attr)
 		goto Done;
 
 	/* Grab the module reference for this attribute if we have one */
@@ -144,19 +144,19 @@
  Error:
 	module_put(attr->attr.owner);
  Done:
-	if (error && kobj)
-		kobject_put(kobj);
+	if (error && uobj)
+		uobject_put(uobj);
 	return error;
 }
 
 static int release(struct inode * inode, struct file * file)
 {
-	struct kobject * kobj = to_kobj(file->f_dentry->d_parent);
-	struct bin_attribute * attr = to_bin_attr(file->f_dentry);
+	struct uobject * uobj = to_uobj(file->f_dentry->d_parent);
+	struct usysfs_bin_attribute * attr = to_bin_attr(file->f_dentry);
 	u8 * buffer = file->private_data;
 
-	if (kobj) 
-		kobject_put(kobj);
+	if (uobj) 
+		uobject_put(uobj);
 	module_put(attr->attr.owner);
 	kfree(buffer);
 	return 0;
@@ -172,31 +172,28 @@
 
 /**
  *	usysfs_create_bin_file - create binary file for object.
- *	@kobj:	object.
+ *	@uobj:	object.
  *	@attr:	attribute descriptor.
  *
  */
 
-int usysfs_create_bin_file(struct kobject * kobj, struct bin_attribute * attr)
+int usysfs_create_bin_file(struct uobject * uobj, struct usysfs_bin_attribute * attr)
 {
-	BUG_ON(!kobj || !kobj->dentry || !attr);
+	BUG_ON(!uobj || !uobj->dentry || !attr);
 
-	return usysfs_add_file(kobj->dentry, &attr->attr, USYSFS_KOBJ_BIN_ATTR);
+	return usysfs_add_file(uobj->dentry, &attr->attr, USYSFS_UOBJ_BIN_ATTR);
 }
 
 
 /**
  *	usysfs_remove_bin_file - remove binary file for object.
- *	@kobj:	object.
+ *	@uobj:	object.
  *	@attr:	attribute descriptor.
  *
  */
 
-int usysfs_remove_bin_file(struct kobject * kobj, struct bin_attribute * attr)
+int usysfs_remove_bin_file(struct uobject * uobj, struct usysfs_bin_attribute * attr)
 {
-	usysfs_hash_and_remove(kobj->dentry,attr->attr.name);
+	usysfs_hash_and_remove(uobj->dentry,attr->attr.name);
 	return 0;
 }
-
-EXPORT_SYMBOL_GPL(usysfs_create_bin_file);
-EXPORT_SYMBOL_GPL(usysfs_remove_bin_file);

Modified: trunk/fs/usysfs/bobtest.c
===================================================================
--- trunk/fs/usysfs/bobtest.c	2005-03-24 04:17:32 UTC (rev 2044)
+++ trunk/fs/usysfs/bobtest.c	2005-03-24 20:11:10 UTC (rev 2045)
@@ -25,8 +25,9 @@
 #include <linux/init.h>
 #include <linux/fs.h>
 #include <linux/module.h>
-#include <linux/kobject.h>
 #include <linux/slab.h>
+
+#include "uobject.h"
 #include "usysfs.h"
 
 
@@ -35,18 +36,18 @@
  * Bobs - default_set as part of subsystem.
  */
 struct robert {
-	struct ukset ukset;
+	struct uuset uuset;
 };
 
 struct robert_attribute {
-	struct attribute attr;
+	struct usysfs_attribute attr;
 	ssize_t (*show)(struct robert *, char *);
 };
 
-static inline struct robert *to_robert(struct kobject *kobj)
+static inline struct robert *to_robert(struct uobject *uobj)
 {
-	return kobj ?
-		container_of(to_ukset(to_kset(kobj)), struct robert, ukset) :
+	return uobj ?
+		container_of(to_uuset(to_uset(uobj)), struct robert, uuset) :
 		NULL;
 }
 
@@ -64,16 +65,16 @@
 	.show	= robert_print_read,
 };
 
-static struct attribute *robert_attrs[] = {
+static struct usysfs_attribute *robert_attrs[] = {
 	&robert_attr_print.attr,
 	NULL,
 };
 
-static ssize_t robert_attr_show(struct kobject *kobj,
-		   		struct attribute *attr,
+static ssize_t robert_attr_show(struct uobject *uobj,
+		   		struct usysfs_attribute *attr,
 		   		char *page)
 {
-	struct robert *robert = to_robert(kobj);
+	struct robert *robert = to_robert(uobj);
 	struct robert_attribute *robert_attr =
 		container_of(attr, struct robert_attribute, attr);
 	ssize_t ret = 0;
@@ -83,16 +84,17 @@
 	return ret;
 }
 
-struct sysfs_ops robert_sysfs_ops = {
+struct usysfs_attribute_operations robert_sysfs_ops = {
 	.show	= &robert_attr_show,
 };
 
-static void robert_release(struct kobject *kobj)
+static void robert_release(struct uobject *uobj)
 {
-	kfree(to_robert(kobj));
+	printk("We shall welease, Wobewt!\n");
+	kfree(to_robert(uobj));
 }
 
-static struct ukobj_type uktype_robert = {
+static struct uuobj_type uktype_robert = {
 	.ktype	= {
 		.release	= robert_release,
 		.sysfs_ops	= &robert_sysfs_ops,
@@ -102,9 +104,9 @@
 };
 
 static struct robert robert = {
-	.ukset = {
-		.kset = {
-			.kobj = {
+	.uuset = {
+		.uset = {
+			.uobj = {
 				.name = "robert",
 				.ktype = &uktype_robert.ktype,
 			},
@@ -115,20 +117,20 @@
 
 
 struct bob {
-	struct kobject kobj;
+	struct uobject uobj;
 	int showme;
 	int storeme;
 };
 
 struct bob_attribute {
-	struct attribute attr;
+	struct usysfs_attribute attr;
 	ssize_t (*show)(struct bob *, char *);
 	ssize_t (*store)(struct bob *, const char *, size_t);
 };
 
-static inline struct bob *to_bob(struct kobject *kobj)
+static inline struct bob *to_bob(struct uobject *uobj)
 {
-	return kobj ? container_of(kobj, struct bob, kobj) : NULL;
+	return uobj ? container_of(uobj, struct bob, uobj) : NULL;
 }
 
 static ssize_t bob_showme_read(struct bob *bob, char *page)
@@ -173,17 +175,17 @@
 	.show	= bob_storeme_read,
 	.store	= bob_storeme_write,
 };
-static struct attribute *bob_attrs[] = {
+static struct usysfs_attribute *bob_attrs[] = {
 	&bob_attr_showme.attr,
 	&bob_attr_storeme.attr,
 	NULL,
 };
 
-static ssize_t bob_attr_show(struct kobject *kobj,
-			     struct attribute *attr,
+static ssize_t bob_attr_show(struct uobject *uobj,
+			     struct usysfs_attribute *attr,
 			     char *page)
 {
-	struct bob *bob = to_bob(kobj);
+	struct bob *bob = to_bob(uobj);
 	struct bob_attribute *bob_attr =
 		container_of(attr, struct bob_attribute, attr);
 	ssize_t ret = 0;
@@ -193,11 +195,11 @@
 	return ret;
 }
 
-static ssize_t bob_attr_store(struct kobject *kobj,
-			      struct attribute *attr,
+static ssize_t bob_attr_store(struct uobject *uobj,
+			      struct usysfs_attribute *attr,
 			      const char *page, size_t count)
 {
-	struct bob *bob = to_bob(kobj);
+	struct bob *bob = to_bob(uobj);
 	struct bob_attribute *bob_attr =
 		container_of(attr, struct bob_attribute, attr);
 	ssize_t ret = -EINVAL;
@@ -207,17 +209,18 @@
 	return ret;
 }
 
-struct sysfs_ops bob_sysfs_ops = {
+struct usysfs_attribute_operations bob_sysfs_ops = {
 	.show	= &bob_attr_show,
 	.store	= &bob_attr_store,
 };
 
-static void bob_release(struct kobject *kobj)
+static void bob_release(struct uobject *uobj)
 {
-	kfree(to_bob(kobj));
+	printk("Yeah, uh, we'll talk to Bob\n");
+	kfree(to_bob(uobj));
 }
 
-static struct ukobj_type uktype_bob = {
+static struct uuobj_type uktype_bob = {
 	.ktype	= {
 		.release	= bob_release,
 		.sysfs_ops	= &bob_sysfs_ops,
@@ -228,27 +231,27 @@
 
 
 struct bobset {
-	struct ukset ukset;
+	struct uuset uuset;
 	int n_bobs;
 };
 
 struct bobset_attribute {
-	struct attribute attr;
+	struct usysfs_attribute attr;
 	ssize_t (*show)(struct bobset *, char *);
 };
 
-static inline struct bobset *to_bobset(struct kset *kset)
+static inline struct bobset *to_bobset(struct uset *uset)
 {
-	return kset ?
-		container_of(to_ukset(kset), struct bobset, ukset) :
+	return uset ?
+		container_of(to_uuset(uset), struct bobset, uuset) :
 		NULL;
 }
 
-static ssize_t bobset_attr_show(struct kobject *kobj,
-			       struct attribute *attr,
+static ssize_t bobset_attr_show(struct uobject *uobj,
+			       struct usysfs_attribute *attr,
 			       char *page)
 {
-	struct bobset *bobset = to_bobset(to_kset(kobj));
+	struct bobset *bobset = to_bobset(to_uset(uobj));
 	struct bobset_attribute *bobset_attr =
 		container_of(attr, struct bobset_attribute, attr);
 	ssize_t ret = 0;
@@ -258,7 +261,7 @@
 	return ret;
 }
 
-static struct sysfs_ops bobset_sysfs_ops = {
+static struct usysfs_attribute_operations bobset_sysfs_ops = {
 	.show	= &bobset_attr_show,
 };
 
@@ -272,19 +275,19 @@
 	.show	= bobset_bobs_read
 };
 
-static struct attribute *bobset_attrs[] = {
+static struct usysfs_attribute *bobset_attrs[] = {
 	&bobset_attr_bobs.attr,
 	NULL,
 };
 
-static struct kset *bobset_sets[] = {
-	&robert.ukset.kset,
+static struct uset *bobset_sets[] = {
+	&robert.uuset.uset,
 	NULL,
 };
 
-static struct kobject *make_bob(struct kset *kset, const char *name)
+static struct uobject *make_bob(struct uset *uset, const char *name)
 {
-	struct bobset *bobset = to_bobset(kset);
+	struct bobset *bobset = to_bobset(uset);
 	struct bob *bob;
 
 	bob = kmalloc(sizeof(struct bob), GFP_KERNEL);
@@ -293,26 +296,26 @@
 
 	memset(bob, 0, sizeof(struct bob));
 
-	kobject_set_name(&bob->kobj, name);
-	bob->kobj.ktype = &uktype_bob.ktype;
-	kobject_init(&bob->kobj);
+	uobject_set_name(&bob->uobj, name);
+	bob->uobj.ktype = &uktype_bob.ktype;
+	uobject_init(&bob->uobj);
 
 	bob->showme = 0;
 	bob->storeme = 0;
 	bobset->n_bobs++;
 
-	return &bob->kobj;
+	return &bob->uobj;
 }
 
-static void drop_bob(struct kset *kset, struct kobject *kobj)
+static void drop_bob(struct uset *uset, struct uobject *uobj)
 {
-	struct bobset *bobset = to_bobset(kset);
+	struct bobset *bobset = to_bobset(uset);
 
 	bobset->n_bobs--;
-	kobject_put(kobj);
+	uobject_put(uobj);
 }
 
-static struct ukobj_type uktype_bobset = {
+static struct uuobj_type uktype_bobset = {
 	.ktype = {
 		.sysfs_ops	= &bobset_sysfs_ops,
 		.default_attrs	= bobset_attrs,
@@ -322,9 +325,9 @@
 };
 
 static struct bobset bobset = {
-	.ukset = {
-		.kset = {
-			.kobj = {
+	.uuset = {
+		.uset = {
+			.uobj = {
 				.name = "bobset",
 				.ktype = &uktype_bobset.ktype,
 			},
@@ -338,21 +341,21 @@
  * Toms - default_set as part of a created set.
  */
 struct jerry {
-	struct ukset ukset;
+	struct uuset uuset;
 	int showme;
 	int storeme;
 };
 
 struct jerry_attribute {
-	struct attribute attr;
+	struct usysfs_attribute attr;
 	ssize_t (*show)(struct jerry *, char *);
 	ssize_t (*store)(struct jerry *, const char *, size_t);
 };
 
-static inline struct jerry *to_jerry(struct kobject *kobj)
+static inline struct jerry *to_jerry(struct uobject *uobj)
 {
-	return kobj ?
-		container_of(to_ukset(to_kset(kobj)), struct jerry, ukset) :
+	return uobj ?
+		container_of(to_uuset(to_uset(uobj)), struct jerry, uuset) :
 		NULL;
 }
 
@@ -398,17 +401,17 @@
 	.show	= jerry_storeme_read,
 	.store	= jerry_storeme_write,
 };
-static struct attribute *jerry_attrs[] = {
+static struct usysfs_attribute *jerry_attrs[] = {
 	&jerry_attr_showme.attr,
 	&jerry_attr_storeme.attr,
 	NULL,
 };
 
-static ssize_t jerry_attr_show(struct kobject *kobj,
-			     struct attribute *attr,
+static ssize_t jerry_attr_show(struct uobject *uobj,
+			     struct usysfs_attribute *attr,
 			     char *page)
 {
-	struct jerry *jerry = to_jerry(kobj);
+	struct jerry *jerry = to_jerry(uobj);
 	struct jerry_attribute *jerry_attr =
 		container_of(attr, struct jerry_attribute, attr);
 	ssize_t ret = 0;
@@ -418,11 +421,11 @@
 	return ret;
 }
 
-static ssize_t jerry_attr_store(struct kobject *kobj,
-			      struct attribute *attr,
+static ssize_t jerry_attr_store(struct uobject *uobj,
+			      struct usysfs_attribute *attr,
 			      const char *page, size_t count)
 {
-	struct jerry *jerry = to_jerry(kobj);
+	struct jerry *jerry = to_jerry(uobj);
 	struct jerry_attribute *jerry_attr =
 		container_of(attr, struct jerry_attribute, attr);
 	ssize_t ret = -EINVAL;
@@ -432,17 +435,18 @@
 	return ret;
 }
 
-struct sysfs_ops jerry_sysfs_ops = {
+struct usysfs_attribute_operations jerry_sysfs_ops = {
 	.show	= &jerry_attr_show,
 	.store	= &jerry_attr_store,
 };
 
-static void jerry_release(struct kobject *kobj)
+static void jerry_release(struct uobject *uobj)
 {
-	kfree(to_jerry(kobj));
+	printk("Show me the money!\n");
+	kfree(to_jerry(uobj));
 }
 
-static int jerry_allow_link(struct kobject *src, struct kobject *target)
+static int jerry_allow_link(struct uobject *src, struct uobject *target)
 {
 	int ret = 0;
 
@@ -452,7 +456,7 @@
 	return ret;
 }
 
-static struct ukobj_type uktype_jerry = {
+static struct uuobj_type uktype_jerry = {
 	.ktype	= {
 		.release	= jerry_release,
 		.sysfs_ops	= &jerry_sysfs_ops,
@@ -464,21 +468,21 @@
 
 
 struct tom {
-	struct ukset ukset;
+	struct uuset uuset;
 	int showme;
 	int storeme;
 };
 
 struct tom_attribute {
-	struct attribute attr;
+	struct usysfs_attribute attr;
 	ssize_t (*show)(struct tom *, char *);
 	ssize_t (*store)(struct tom *, const char *, size_t);
 };
 
-static inline struct tom *to_tom(struct kobject *kobj)
+static inline struct tom *to_tom(struct uobject *uobj)
 {
-	return kobj ?
-		container_of(to_ukset(to_kset(kobj)), struct tom, ukset) :
+	return uobj ?
+		container_of(to_uuset(to_uset(uobj)), struct tom, uuset) :
 			NULL;
 }
 
@@ -524,17 +528,17 @@
 	.show	= tom_storeme_read,
 	.store	= tom_storeme_write,
 };
-static struct attribute *tom_attrs[] = {
+static struct usysfs_attribute *tom_attrs[] = {
 	&tom_attr_showme.attr,
 	&tom_attr_storeme.attr,
 	NULL,
 };
 
-static ssize_t tom_attr_show(struct kobject *kobj,
-			     struct attribute *attr,
+static ssize_t tom_attr_show(struct uobject *uobj,
+			     struct usysfs_attribute *attr,
 			     char *page)
 {
-	struct tom *tom = to_tom(kobj);
+	struct tom *tom = to_tom(uobj);
 	struct tom_attribute *tom_attr =
 		container_of(attr, struct tom_attribute, attr);
 	ssize_t ret = 0;
@@ -544,11 +548,11 @@
 	return ret;
 }
 
-static ssize_t tom_attr_store(struct kobject *kobj,
-			      struct attribute *attr,
+static ssize_t tom_attr_store(struct uobject *uobj,
+			      struct usysfs_attribute *attr,
 			      const char *page, size_t count)
 {
-	struct tom *tom = to_tom(kobj);
+	struct tom *tom = to_tom(uobj);
 	struct tom_attribute *tom_attr =
 		container_of(attr, struct tom_attribute, attr);
 	ssize_t ret = -EINVAL;
@@ -558,19 +562,21 @@
 	return ret;
 }
 
-struct sysfs_ops tom_sysfs_ops = {
+struct usysfs_attribute_operations tom_sysfs_ops = {
 	.show	= &tom_attr_show,
 	.store	= &tom_attr_store,
 };
 
-static void tom_release(struct kobject *kobj)
+static void tom_release(struct uobject *uobj)
 {
-	struct tom *tom = to_tom(kobj);
-	kfree(to_jerry(&tom->ukset.default_sets[0]->kobj));
+	struct tom *tom = to_tom(uobj);
+
+	printk("Oooh, that's gonna leave a mark!\n");
+	kfree(to_jerry(&tom->uuset.default_sets[0]->uobj));
 	kfree(tom);
 }
 
-static struct ukobj_type uktype_tom = {
+static struct uuobj_type uktype_tom = {
 	.ktype	= {
 		.release	= tom_release,
 		.sysfs_ops	= &tom_sysfs_ops,
@@ -582,27 +588,27 @@
 
 
 struct tomset {
-	struct ukset ukset;
+	struct uuset uuset;
 	int n_toms;
 };
 
 struct tomset_attribute {
-	struct attribute attr;
+	struct usysfs_attribute attr;
 	ssize_t (*show)(struct tomset *, char *);
 };
 
-static inline struct tomset *to_tomset(struct kset *kset)
+static inline struct tomset *to_tomset(struct uset *uset)
 {
-	return kset ?
-		container_of(to_ukset(kset), struct tomset, ukset) :
+	return uset ?
+		container_of(to_uuset(uset), struct tomset, uuset) :
 		NULL;
 }
 
-static ssize_t tomset_attr_show(struct kobject *kobj,
-			       struct attribute *attr,
+static ssize_t tomset_attr_show(struct uobject *uobj,
+			       struct usysfs_attribute *attr,
 			       char *page)
 {
-	struct tomset *tomset = to_tomset(to_kset(kobj));
+	struct tomset *tomset = to_tomset(to_uset(uobj));
 	struct tomset_attribute *tomset_attr =
 		container_of(attr, struct tomset_attribute, attr);
 	ssize_t ret = 0;
@@ -612,7 +618,7 @@
 	return ret;
 }
 
-static struct sysfs_ops tomset_sysfs_ops = {
+static struct usysfs_attribute_operations tomset_sysfs_ops = {
 	.show	= &tomset_attr_show,
 };
 
@@ -626,14 +632,14 @@
 	.show	= tomset_toms_read
 };
 
-static struct attribute *tomset_attrs[] = {
+static struct usysfs_attribute *tomset_attrs[] = {
 	&tomset_attr_toms.attr,
 	NULL,
 };
 
-static struct kset *make_tom(struct kset *kset, const char *name)
+static struct uset *make_tom(struct uset *uset, const char *name)
 {
-	struct tomset *tomset = to_tomset(kset);
+	struct tomset *tomset = to_tomset(uset);
 	struct tom *tom;
 	struct jerry *jerry;
 
@@ -642,49 +648,49 @@
 		return NULL;
 
 	memset(tom, 0, sizeof(struct tom));
-	tom->ukset.default_sets = kmalloc(sizeof(struct kset *) * 2,
+	tom->uuset.default_sets = kmalloc(sizeof(struct uset *) * 2,
 		       			  GFP_KERNEL);
-	if (!tom->ukset.default_sets) {
+	if (!tom->uuset.default_sets) {
 		kfree(tom);
 		return NULL;
 	}
 
 	jerry = kmalloc(sizeof(struct jerry), GFP_KERNEL);
 	if (!jerry) {
-		kfree(tom->ukset.default_sets);
+		kfree(tom->uuset.default_sets);
 		kfree(tom);
 		return NULL;
 	}
 
 	memset(jerry, 0, sizeof(struct jerry));
 
-	kobject_set_name(&tom->ukset.kset.kobj, name);
-	tom->ukset.kset.kobj.ktype = &uktype_tom.ktype;
-	ukset_init(&tom->ukset);
+	uobject_set_name(&tom->uuset.uset.uobj, name);
+	tom->uuset.uset.uobj.ktype = &uktype_tom.ktype;
+	uuset_init(&tom->uuset);
 
 	tom->showme = 0;
 	tom->storeme = 0;
 	tomset->n_toms++;
 
-	kobject_set_name(&jerry->ukset.kset.kobj, "jer");
-	jerry->ukset.kset.kobj.ktype = &uktype_jerry.ktype;
-	ukset_init(&jerry->ukset);
+	uobject_set_name(&jerry->uuset.uset.uobj, "jer");
+	jerry->uuset.uset.uobj.ktype = &uktype_jerry.ktype;
+	uuset_init(&jerry->uuset);
 
-	tom->ukset.default_sets[0] = &jerry->ukset.kset;
-	tom->ukset.default_sets[1] = NULL;
+	tom->uuset.default_sets[0] = &jerry->uuset.uset;
+	tom->uuset.default_sets[1] = NULL;
 
-	return &tom->ukset.kset;
+	return &tom->uuset.uset;
 }
 
-static void drop_tom(struct kset *kset, struct kobject *kobj)
+static void drop_tom(struct uset *uset, struct uobject *uobj)
 {
-	struct tomset *tomset = to_tomset(kset);
+	struct tomset *tomset = to_tomset(uset);
 
 	tomset->n_toms--;
-	kobject_put(kobj);
+	uobject_put(uobj);
 }
 
-static struct ukobj_type uktype_tomset = {
+static struct uuobj_type uktype_tomset = {
 	.ktype = {
 		.sysfs_ops	= &tomset_sysfs_ops,
 		.default_attrs	= tomset_attrs,
@@ -694,9 +700,9 @@
 };
 
 static struct tomset tomset = {
-	.ukset = {
-		.kset = {
-			.kobj = {
+	.uuset = {
+		.uset = {
+			.uobj = {
 				.name = "tomset",
 				.ktype = &uktype_tomset.ktype,
 			},
@@ -709,12 +715,12 @@
 {
 	int ret;
 
-	ukset_init(&bobset.ukset);
-	ukset_init(&robert.ukset);
-	ukset_init(&tomset.ukset);
-	ret = usysfs_register_subsystem(&bobset.ukset.kset);
+	uuset_init(&bobset.uuset);
+	uuset_init(&robert.uuset);
+	uuset_init(&tomset.uuset);
+	ret = usysfs_register_subsystem(&bobset.uuset.uset);
 	if (!ret)
-		ret = usysfs_register_subsystem(&tomset.ukset.kset);
+		ret = usysfs_register_subsystem(&tomset.uuset.uset);
 	if (ret)
 		printk(KERN_ERR "bobtest: Registration returned %d\n", ret);
 
@@ -723,8 +729,8 @@
 
 static void __exit bobtest_exit(void)
 {
-	usysfs_unregister_subsystem(&tomset.ukset.kset);
-	usysfs_unregister_subsystem(&bobset.ukset.kset);
+	usysfs_unregister_subsystem(&tomset.uuset.uset);
+	usysfs_unregister_subsystem(&bobset.uuset.uset);
 }
 
 module_init(bobtest_init);

Deleted: trunk/fs/usysfs/compat_kobject.c
===================================================================
--- trunk/fs/usysfs/compat_kobject.c	2005-03-24 04:17:32 UTC (rev 2044)
+++ trunk/fs/usysfs/compat_kobject.c	2005-03-24 20:11:10 UTC (rev 2045)
@@ -1,200 +0,0 @@
-/*
- * kobject.c - library routines for handling generic kernel objects
- *
- * Copyright (c) 2002-2003 Patrick Mochel <mochel at osdl.org>
- *
- * This file is released under the GPLv2.
- *
- *
- * Please see the file Documentation/kobject.txt for critical information
- * about using the kobject interface.
- *
- * 2005.01.24
- *      Stripped down for 2.4 compat in usysfs.
- *      Joel Becker <joel.becker at oracle.com>
- */
-
-#include <linux/kobject.h>
-#include <linux/string.h>
-#include <linux/module.h>
-#include <linux/stat.h>
-#include <linux/slab.h>
-
-
-static inline struct kobject * to_kobj(struct list_head * entry)
-{
-	return container_of(entry,struct kobject,entry);
-}
-
-
-/**
- *	kobject_init - initialize object.
- *	@kobj:	object in question.
- */
-void kobject_init(struct kobject * kobj)
-{
-	kref_init(&kobj->kref);
-	INIT_LIST_HEAD(&kobj->entry);
-	kobj->kset = kset_get(kobj->kset);
-}
-
-/**
- *	kobject_set_name - Set the name of an object
- *	@kobj:	object.
- *	@name:	name. 
- *
- *	If strlen(name) >= KOBJ_NAME_LEN, then use a dynamically allocated
- *	string that @kobj->k_name points to. Otherwise, use the static 
- *	@kobj->name array.
- */
-
-int kobject_set_name(struct kobject * kobj, const char * fmt, ...)
-{
-	int error = 0;
-	int limit = KOBJ_NAME_LEN;
-	int need;
-	va_list args;
-	char * name;
-
-	/* 
-	 * First, try the static array 
-	 */
-	va_start(args,fmt);
-	need = vsnprintf(kobj->name,limit,fmt,args);
-	va_end(args);
-	if (need < limit) 
-		name = kobj->name;
-	else {
-		/* 
-		 * Need more space? Allocate it and try again 
-		 */
-		limit = need + 1;
-		name = kmalloc(limit,GFP_KERNEL);
-		if (!name) {
-			error = -ENOMEM;
-			goto Done;
-		}
-		va_start(args,fmt);
-		need = vsnprintf(name,limit,fmt,args);
-		va_end(args);
-
-		/* Still? Give up. */
-		if (need >= limit) {
-			kfree(name);
-			error = -EFAULT;
-			goto Done;
-		}
-	}
-
-	/* Free the old name, if necessary. */
-	if (kobj->k_name && kobj->k_name != kobj->name)
-		kfree(kobj->k_name);
-
-	/* Now, set the new name */
-	kobj->k_name = name;
- Done:
-	return error;
-}
-
-EXPORT_SYMBOL(kobject_set_name);
-
-struct kobject * kobject_get(struct kobject * kobj)
-{
-	if (kobj)
-		kref_get(&kobj->kref);
-	return kobj;
-}
-
-/**
- *	kobject_cleanup - free kobject resources. 
- *	@kobj:	object.
- */
-
-void kobject_cleanup(struct kobject * kobj)
-{
-	struct kobj_type * t = get_ktype(kobj);
-	struct kset * s = kobj->kset;
-	struct kobject * parent = kobj->parent;
-
-	pr_debug("kobject %s: cleaning up\n",kobject_name(kobj));
-	if (kobj->k_name != kobj->name)
-		kfree(kobj->k_name);
-	kobj->k_name = NULL;
-	if (t && t->release)
-		t->release(kobj);
-	if (s)
-		kset_put(s);
-	if (parent) 
-		kobject_put(parent);
-}
-
-static void kobject_release(struct kref *kref)
-{
-	kobject_cleanup(container_of(kref, struct kobject, kref));
-}
-
-/**
- *	kobject_put - decrement refcount for object.
- *	@kobj:	object.
- *
- *	Decrement the refcount, and if 0, call kobject_cleanup().
- */
-void kobject_put(struct kobject * kobj)
-{
-	if (kobj)
-		kref_put(&kobj->kref, kobject_release);
-}
-
-
-/**
- *	kset_init - initialize a kset for use
- *	@k:	kset 
- */
-
-void kset_init(struct kset * k)
-{
-	kobject_init(&k->kobj);
-	INIT_LIST_HEAD(&k->list);
-}
-
-
-/**
- *	kset_find_obj - search for object in kset.
- *	@kset:	kset we're looking in.
- *	@name:	object's name.
- *
- *	Lock kset via @kset->subsys, and iterate over @kset->list,
- *	looking for a matching kobject. If matching object is found
- *	take a reference and return the object.
- */
-
-struct kobject * kset_find_obj(struct kset * kset, const char * name)
-{
-	struct list_head * entry;
-	struct kobject * ret = NULL;
-
-	down_read(&kset->subsys->rwsem);
-	list_for_each(entry,&kset->list) {
-		struct kobject * k = to_kobj(entry);
-		if (kobject_name(k) && !strcmp(kobject_name(k),name)) {
-			ret = kobject_get(k);
-			break;
-		}
-	}
-	up_read(&kset->subsys->rwsem);
-	return ret;
-}
-
-
-void subsystem_init(struct subsystem * s)
-{
-	init_rwsem(&s->rwsem);
-	kset_init(&s->kset);
-}
-
-
-EXPORT_SYMBOL(kobject_init);
-EXPORT_SYMBOL(kobject_get);
-EXPORT_SYMBOL(kobject_put);
-
-EXPORT_SYMBOL(subsystem_init);

Deleted: trunk/fs/usysfs/compatinclude/linux/kobject.h
===================================================================
--- trunk/fs/usysfs/compatinclude/linux/kobject.h	2005-03-24 04:17:32 UTC (rev 2044)
+++ trunk/fs/usysfs/compatinclude/linux/kobject.h	2005-03-24 20:11:10 UTC (rev 2045)
@@ -1,223 +0,0 @@
-/*
- * kobject.h - generic kernel object infrastructure.
- *
- * Copyright (c) 2002-2003	Patrick Mochel
- * Copyright (c) 2002-2003	Open Source Development Labs
- *
- * This file is released under the GPLv2.
- *
- * 
- * Please read Documentation/kobject.txt before using the kobject
- * interface, ESPECIALLY the parts about reference counts and object
- * destructors. 
- *
- * 2005.01.24
- * 	Stripped down for compatibilty with 2.4 usysfs.
- * 	Joel Becker <joel.becker at oracle.com>
- */
-
-#ifndef _KOBJECT_H_
-#define _KOBJECT_H_
-
-#ifdef __KERNEL__
-
-#include "compat.h"
-
-#include <linux/types.h>
-#include <linux/list.h>
-#include <linux/sysfs.h>
-#include <linux/rwsem.h>
-#include <linux/kref.h>
-#include <asm/atomic.h>
-
-#define KOBJ_NAME_LEN	20
-
-struct kobject {
-	char			* k_name;
-	char			name[KOBJ_NAME_LEN];
-	struct kref		kref;
-	struct list_head	entry;
-	struct kobject		* parent;
-	struct kset		* kset;
-	struct kobj_type	* ktype;
-	struct dentry		* dentry;
-};
-
-extern int kobject_set_name(struct kobject *, const char *, ...);
-
-static inline char * kobject_name(struct kobject * kobj)
-{
-	return kobj->k_name;
-}
-
-extern void kobject_init(struct kobject *);
-extern void kobject_cleanup(struct kobject *);
-
-extern struct kobject * kobject_get(struct kobject *);
-extern void kobject_put(struct kobject *);
-
-struct kobj_type {
-	void (*release)(struct kobject *);
-	struct sysfs_ops	* sysfs_ops;
-	struct attribute	** default_attrs;
-};
-
-
-/**
- *	kset - a set of kobjects of a specific type, belonging
- *	to a specific subsystem.
- *
- *	All kobjects of a kset should be embedded in an identical 
- *	type. This type may have a descriptor, which the kset points
- *	to. This allows there to exist sets of objects of the same
- *	type in different subsystems.
- *
- *	A subsystem does not have to be a list of only one type 
- *	of object; multiple ksets can belong to one subsystem. All 
- *	ksets of a subsystem share the subsystem's lock.
- *
- *      Each kset can support hotplugging; if it does, it will be given
- *      the opportunity to filter out specific kobjects from being
- *      reported, as well as to add its own "data" elements to the
- *      environment being passed to the hotplug helper.
- */
-struct kset_hotplug_ops {
-	int (*filter)(struct kset *kset, struct kobject *kobj);
-	char *(*name)(struct kset *kset, struct kobject *kobj);
-	int (*hotplug)(struct kset *kset, struct kobject *kobj, char **envp,
-			int num_envp, char *buffer, int buffer_size);
-};
-
-struct kset {
-	struct subsystem	* subsys;
-	struct kobj_type	* ktype;
-	struct list_head	list;
-	struct kobject		kobj;
-	struct kset_hotplug_ops	* hotplug_ops;
-};
-
-
-extern void kset_init(struct kset * k);
-
-static inline struct kset * to_kset(struct kobject * kobj)
-{
-	return kobj ? container_of(kobj,struct kset,kobj) : NULL;
-}
-
-static inline struct kset * kset_get(struct kset * k)
-{
-	return k ? to_kset(kobject_get(&k->kobj)) : NULL;
-}
-
-static inline void kset_put(struct kset * k)
-{
-	kobject_put(&k->kobj);
-}
-
-static inline struct kobj_type * get_ktype(struct kobject * k)
-{
-	if (k->kset && k->kset->ktype)
-		return k->kset->ktype;
-	else 
-		return k->ktype;
-}
-
-extern struct kobject * kset_find_obj(struct kset *, const char *);
-
-
-/**
- * Use this when initializing an embedded kset with no other 
- * fields to initialize.
- */
-#define set_kset_name(str)	.kset = { .kobj = { .name = str } }
-
-
-
-struct subsystem {
-	struct kset		kset;
-	struct rw_semaphore	rwsem;
-};
-
-#define decl_subsys(_name,_type,_hotplug_ops) \
-struct subsystem _name##_subsys = { \
-	.kset = { \
-		.kobj = { .name = __stringify(_name) }, \
-		.ktype = _type, \
-		.hotplug_ops =_hotplug_ops, \
-	} \
-}
-#define decl_subsys_name(_varname,_name,_type,_hotplug_ops) \
-struct subsystem _varname##_subsys = { \
-	.kset = { \
-		.kobj = { .name = __stringify(_name) }, \
-		.ktype = _type, \
-		.hotplug_ops =_hotplug_ops, \
-	} \
-}
-
-
-/**
- * Helpers for setting the kset of registered objects.
- * Often, a registered object belongs to a kset embedded in a 
- * subsystem. These do no magic, just make the resulting code
- * easier to follow. 
- */
-
-/**
- *	kobj_set_kset_s(obj,subsys) - set kset for embedded kobject.
- *	@obj:		ptr to some object type.
- *	@subsys:	a subsystem object (not a ptr).
- *
- *	Can be used for any object type with an embedded ->kobj.
- */
-
-#define kobj_set_kset_s(obj,subsys) \
-	(obj)->kobj.kset = &(subsys).kset
-
-/**
- *	kset_set_kset_s(obj,subsys) - set kset for embedded kset.
- *	@obj:		ptr to some object type.
- *	@subsys:	a subsystem object (not a ptr).
- *
- *	Can be used for any object type with an embedded ->kset.
- *	Sets the kset of @obj's  embedded kobject (via its embedded
- *	kset) to @subsys.kset. This makes @obj a member of that 
- *	kset.
- */
-
-#define kset_set_kset_s(obj,subsys) \
-	(obj)->kset.kobj.kset = &(subsys).kset
-
-/**
- *	subsys_set_kset(obj,subsys) - set kset for subsystem
- *	@obj:		ptr to some object type.
- *	@subsys:	a subsystem object (not a ptr).
- *
- *	Can be used for any object type with an embedded ->subsys.
- *	Sets the kset of @obj's kobject to @subsys.kset. This makes
- *	the object a member of that kset.
- */
-
-#define subsys_set_kset(obj,_subsys) \
-	(obj)->subsys.kset.kobj.kset = &(_subsys).kset
-
-extern void subsystem_init(struct subsystem *);
-
-static inline struct subsystem * subsys_get(struct subsystem * s)
-{
-	return s ? container_of(kset_get(&s->kset),struct subsystem,kset) : NULL;
-}
-
-static inline void subsys_put(struct subsystem * s)
-{
-	kset_put(&s->kset);
-}
-
-struct subsys_attribute {
-	struct attribute attr;
-	ssize_t (*show)(struct subsystem *, char *);
-	ssize_t (*store)(struct subsystem *, const char *, size_t); 
-};
-
-#endif /* __KERNEL__ */
-#endif /* _KOBJECT_H_ */

Deleted: trunk/fs/usysfs/compatinclude/linux/sysfs.h
===================================================================
--- trunk/fs/usysfs/compatinclude/linux/sysfs.h	2005-03-24 04:17:32 UTC (rev 2044)
+++ trunk/fs/usysfs/compatinclude/linux/sysfs.h	2005-03-24 20:11:10 UTC (rev 2045)
@@ -1,66 +0,0 @@
-/*
- * sysfs.h - definitions for the device driver filesystem
- *
- * Copyright (c) 2001,2002 Patrick Mochel
- *
- * Please see Documentation/filesystems/sysfs.txt for more information.
- *
- * 2005.01.24
- * 	Stripped down for 2.4 usysfs compatibility.
- * 	Joel Becker <joel.becker at oracle.com>
- */
-
-#ifndef _SYSFS_H_
-#define _SYSFS_H_
-
-#include <asm/atomic.h>
-
-struct kobject;
-struct module;
-
-struct attribute {
-	char			* name;
-	struct module 		* owner;
-	mode_t			mode;
-};
-
-struct attribute_group {
-	char			* name;
-	struct attribute	** attrs;
-};
-
-
-
-/**
- * Use these macros to make defining attributes easier. See include/linux/device.h
- * for examples..
- */
-
-#define __ATTR(_name,_mode,_show,_store) { \
-	.attr = {.name = __stringify(_name), .mode = _mode, .owner = THIS_MODULE },	\
-	.show	= _show,					\
-	.store	= _store,					\
-}
-
-#define __ATTR_RO(_name) { \
-	.attr	= { .name = __stringify(_name), .mode = 0444, .owner = THIS_MODULE },	\
-	.show	= _name##_show,	\
-}
-
-#define __ATTR_NULL { .attr = { .name = NULL } }
-
-#define attr_name(_attr) (_attr).attr.name
-
-struct bin_attribute {
-	struct attribute	attr;
-	size_t			size;
-	ssize_t (*read)(struct kobject *, char *, loff_t, size_t);
-	ssize_t (*write)(struct kobject *, char *, loff_t, size_t);
-};
-
-struct sysfs_ops {
-	ssize_t	(*show)(struct kobject *, struct attribute *,char *);
-	ssize_t	(*store)(struct kobject *,struct attribute *,const char *, size_t);
-};
-
-#endif /* _SYSFS_H_ */

Modified: trunk/fs/usysfs/dir.c
===================================================================
--- trunk/fs/usysfs/dir.c	2005-03-24 04:17:32 UTC (rev 2044)
+++ trunk/fs/usysfs/dir.c	2005-03-24 20:11:10 UTC (rev 2045)
@@ -31,8 +31,9 @@
 #include <linux/fs.h>
 #include <linux/mount.h>
 #include <linux/module.h>
-#include <linux/kobject.h>
 #include <linux/slab.h>
+
+#include "uobject.h"
 #include "usysfs.h"
 #include "usysfs_internal.h"
 
@@ -131,7 +132,7 @@
 	return 0;
 }
 
-static int create_dir(struct kobject * k, struct dentry * p,
+static int create_dir(struct uobject * k, struct dentry * p,
 		      struct dentry * d)
 {
 	int error;
@@ -153,26 +154,26 @@
 /**
  *	usysfs_create_dir - create a directory for an object.
  *	@parent:	parent parent object.
- *	@kobj:		object we're creating directory for. 
+ *	@uobj:		object we're creating directory for. 
  */
 
-static int usysfs_create_dir(struct kobject * kobj, struct dentry *dentry)
+static int usysfs_create_dir(struct uobject * uobj, struct dentry *dentry)
 {
 	struct dentry * parent;
 	int error = 0;
 
-	BUG_ON(!kobj);
+	BUG_ON(!uobj);
 
-	if (kobj->parent)
-		parent = kobj->parent->dentry;
+	if (uobj->parent)
+		parent = uobj->parent->dentry;
 	else if (usysfs_mount && usysfs_mount->mnt_sb)
 		parent = usysfs_mount->mnt_sb->s_root;
 	else
 		return -EFAULT;
 
-	error = create_dir(kobj,parent,dentry);
+	error = create_dir(uobj,parent,dentry);
 	if (!error)
-		kobj->dentry = dentry;
+		uobj->dentry = dentry;
 	return error;
 }
 
@@ -185,7 +186,7 @@
 	err = usysfs_create(dentry, mode, init_symlink);
 	if (!err) {
 		err = usysfs_make_dirent(parent->d_fsdata, dentry, sl,
-					 mode, USYSFS_KOBJ_LINK);
+					 mode, USYSFS_UOBJ_LINK);
 		if (!err)
 			dentry->d_op = &usysfs_dentry_ops;
 	}
@@ -211,16 +212,16 @@
 
 /**
  *	usysfs_remove_dir - remove an object's directory.
- *	@kobj:	object. 
+ *	@uobj:	object. 
  *
  *	The only thing special about this is that we remove any files in 
  *	the directory before we remove the directory, and we've inlined
  *	what used to be usysfs_rmdir() below, instead of calling separately.
  */
 
-static void usysfs_remove_dir(struct kobject * kobj)
+static void usysfs_remove_dir(struct uobject * uobj)
 {
-	struct dentry * dentry = dget(kobj->dentry);
+	struct dentry * dentry = dget(uobj->dentry);
 
 	if (!dentry)
 		return;
@@ -238,12 +239,12 @@
  */
 static int usysfs_attach_attr(struct usysfs_dirent * sd, struct dentry * dentry)
 {
-	struct attribute * attr = NULL;
-	struct bin_attribute * bin_attr = NULL;
+	struct usysfs_attribute * attr = NULL;
+	struct usysfs_bin_attribute * bin_attr = NULL;
 	int (* init) (struct inode *) = NULL;
 	int error = 0;
 
-	if (sd->s_type & USYSFS_KOBJ_BIN_ATTR) {
+	if (sd->s_type & USYSFS_UOBJ_BIN_ATTR) {
 		bin_attr = sd->s_element;
 		attr = &bin_attr->attr;
 	} else {
@@ -332,9 +333,9 @@
 	return ret;
 }
 
-static void drop_attrs(struct kobject * kobj)
+static void drop_attrs(struct uobject * uobj)
 {
-	struct dentry * dentry = dget(kobj->dentry);
+	struct dentry * dentry = dget(uobj->dentry);
 	struct usysfs_dirent * parent_sd;
 	struct usysfs_dirent * sd, * tmp;
 
@@ -359,10 +360,10 @@
 	dput(dentry);
 }
 
-static int populate_attrs(struct kobject *kobj)
+static int populate_attrs(struct uobject *uobj)
 {
-	struct kobj_type *t = get_ktype(kobj);
-	struct attribute *attr;
+	struct uobj_type *t = uobj->ktype;
+	struct usysfs_attribute *attr;
 	int error = 0;
 	int i;
 
@@ -370,25 +371,25 @@
 		return -EINVAL;
 	if (t->default_attrs) {
 		for (i = 0; (attr = t->default_attrs[i]) != NULL; i++) {
-			if ((error = usysfs_create_file(kobj, attr)))
+			if ((error = usysfs_create_file(uobj, attr)))
 				break;
 		}
 	}
 
 	if (error)
-		drop_attrs(kobj);
+		drop_attrs(uobj);
 
 	return error;
 }
 
-static int usysfs_instantiate_set(struct kobject *parent_kobj,
-				  struct kobject *kobj,
+static int usysfs_instantiate_set(struct uobject *parent_uobj,
+				  struct uobject *uobj,
 				  struct dentry *dentry);
-static void usysfs_drop_set(struct kobject *kobj);
+static void usysfs_drop_set(struct uobject *uobj);
 
-static void drop_sets(struct kset *kset)
+static void drop_sets(struct uset *uset)
 {
-	struct dentry * dentry = dget(kset->kobj.dentry);
+	struct dentry * dentry = dget(uset->uobj.dentry);
 	struct dentry *child;
 	struct usysfs_dirent *parent_sd;
 	struct usysfs_dirent *sd, *tmp;
@@ -428,18 +429,18 @@
  * We could, perhaps, tweak our parent's ->mkdir for a minute and
  * try using vfs_mkdir.  Just a thought.
  */
-static int create_default_set(struct kset *parent_kset,
-			      struct kset *kset)
+static int create_default_set(struct uset *parent_uset,
+			      struct uset *uset)
 {
 	int ret;
 	struct qstr name;
 	struct usysfs_dirent *sd;
 	/* We trust the caller holds a reference to parent */
-	struct dentry *child, *parent = parent_kset->kobj.dentry;
+	struct dentry *child, *parent = parent_uset->uobj.dentry;
 
-	if (!kset->kobj.k_name)
-		kset->kobj.k_name = kset->kobj.name;
-	name.name = kset->kobj.k_name;
+	if (!uset->uobj.k_name)
+		uset->uobj.k_name = uset->uobj.name;
+	name.name = uset->uobj.k_name;
 	name.len = strlen(name.name);
 	name.hash = full_name_hash(name.name, name.len);
 
@@ -448,8 +449,8 @@
 	if (child) {
 		d_add(child, NULL);
 
-		ret = usysfs_instantiate_set(&parent_kset->kobj,
-					     &kset->kobj, child);
+		ret = usysfs_instantiate_set(&parent_uset->uobj,
+					     &uset->uobj, child);
 		if (!ret) {
 			sd = child->d_fsdata;
 			sd->s_type = USYSFS_DEFAULT_DIR;
@@ -462,15 +463,15 @@
 	return ret;
 }
 
-static int populate_sets(struct kset *kset)
+static int populate_sets(struct uset *uset)
 {
-	struct ukset *ukset = to_ukset(kset);
-	struct kset *new_set;
-	struct dentry *dentry = kset->kobj.dentry;
+	struct uuset *uuset = to_uuset(uset);
+	struct uset *new_set;
+	struct dentry *dentry = uset->uobj.dentry;
 	int ret = 0;
 	int i;
 
-	if (ukset && ukset->default_sets) {
+	if (uuset && uuset->default_sets) {
 		/* FYI, we're faking mkdir here
 		 * I'm not sure we need this semaphore, as we're called
 		 * from our parent's mkdir.  That holds our parent's
@@ -480,10 +481,10 @@
 		 * emulation, and shouldn't hurt. */
 		down(&dentry->d_inode->i_sem);
 
-		for (i = 0; ukset->default_sets[i]; i++) {
-			new_set = ukset->default_sets[i];
+		for (i = 0; uuset->default_sets[i]; i++) {
+			new_set = uuset->default_sets[i];
 
-			ret = create_default_set(kset, new_set);
+			ret = create_default_set(uset, new_set);
 			if (ret)
 				break;
 		}
@@ -492,39 +493,45 @@
 	}
 
 	if (ret)
-		drop_sets(kset);
+		drop_sets(uset);
 
 	return ret;
 }
 
 /*
- * Remove an object from its kset and decrement the refcount.
+ * Remove an object from its uset and decrement the refcount.
  * This is used by both rmdir() and by mkdir() on error.
+ * It expects a valid reference to be held on uobj in addition to
+ * the reference from link_obj().
  */
-static void unlink_obj(struct kobject *kobj)
+static void unlink_obj(struct uobject *uobj)
 {
-	if (kobj->kset) {
+	struct uset *set;
+
+	set = uobj->uset;
+	if (set) {
 		spin_lock(&usysfs_linkage_lock);
-		list_del_init(&kobj->entry);
+		list_del_init(&uobj->entry);
 		spin_unlock(&usysfs_linkage_lock);
-		kobj->kset = NULL;
-		kobj->parent = NULL;
 
-		/* kobject_cleanup() drops parent ref from link_obj() */
-		kobject_put(kobj);
+		uobj->uset = NULL;
+		uobj->parent = NULL;
+		uobject_put(uobj);
+
+		uset_put(set);
 	}
 }
 
-static void link_obj(struct kobject *parent_kobj, struct kobject *kobj)
+static void link_obj(struct uobject *parent_uobj, struct uobject *uobj)
 {
-	kobj->kset = kset_get(to_kset(parent_kobj));
+	uobj->uset = uset_get(to_uset(parent_uobj));
 
 	spin_lock(&usysfs_linkage_lock);
-	list_add_tail(&kobj->entry, &kobj->kset->list);
+	list_add_tail(&uobj->entry, &uobj->uset->list);
 	spin_unlock(&usysfs_linkage_lock);
 
-	kobj->parent = parent_kobj;
-	kobject_get(kobj);
+	uobj->parent = parent_uobj;
+	uobject_get(uobj);
 }
 
 /*
@@ -542,19 +549,19 @@
  * clean up the usysfs objects, and they expect their callers will
  * handle the dcache bits.
  */
-static int usysfs_instantiate_object(struct kobject *parent_kobj,
-				     struct kobject *kobj,
+static int usysfs_instantiate_object(struct uobject *parent_uobj,
+				     struct uobject *uobj,
 				     struct dentry *dentry)
 {
 	int ret;
 
-	link_obj(parent_kobj, kobj);
-	ret = usysfs_create_dir(kobj, dentry);
+	link_obj(parent_uobj, uobj);
+	ret = usysfs_create_dir(uobj, dentry);
 	if (!ret) {
-		ret = populate_attrs(kobj);
+		ret = populate_attrs(uobj);
 		if (ret) {
-			usysfs_remove_dir(kobj);
-			unlink_obj(kobj);
+			usysfs_remove_dir(uobj);
+			unlink_obj(uobj);
 			d_delete(dentry);
 		}
 	}
@@ -562,24 +569,24 @@
 	return ret;
 }
 
-static void usysfs_drop_object(struct kobject *kobj)
+static void usysfs_drop_object(struct uobject *uobj)
 {
-	drop_attrs(kobj);
-	usysfs_remove_dir(kobj);
-	unlink_obj(kobj);
+	drop_attrs(uobj);
+	usysfs_remove_dir(uobj);
+	unlink_obj(uobj);
 }
 
-static int usysfs_instantiate_set(struct kobject *parent_kobj,
-				  struct kobject *kobj,
+static int usysfs_instantiate_set(struct uobject *parent_uobj,
+				  struct uobject *uobj,
 				  struct dentry *dentry)
 {
 	int ret;
 
-	ret = usysfs_instantiate_object(parent_kobj, kobj, dentry);
+	ret = usysfs_instantiate_object(parent_uobj, uobj, dentry);
 	if (!ret) {
-		ret = populate_sets(to_kset(kobj));
+		ret = populate_sets(to_uset(uobj));
 		if (ret) {
-			usysfs_drop_object(kobj);
+			usysfs_drop_object(uobj);
 			d_delete(dentry);
 		}
 	}
@@ -587,68 +594,88 @@
 	return ret;
 }
 
-static void usysfs_drop_set(struct kobject *kobj)
+static void usysfs_drop_set(struct uobject *uobj)
 {
-	drop_sets(to_kset(kobj));
-	usysfs_drop_object(kobj);
+	drop_sets(to_uset(uobj));
+	usysfs_drop_object(uobj);
 }
 
+/*
+ * Drop the initial reference from make_object()/make_set()
+ * This function assumes that reference is held on uobj
+ * and that uobj holds a valid reference to the parent.  Also, it
+ * assumes the caller has validated uktype.
+ */
+static void client_drop_object(struct uobject *parent_uobj,
+			       struct uobject *uobj)
+{
+	struct uuobj_type *uktype;
 
+	uktype = to_uutype(parent_uobj->ktype);
+	BUG_ON(!uktype);
+
+	if (uktype->drop_object)
+		uktype->drop_object(to_uset(parent_uobj), uobj);
+	else 
+		uobject_put(uobj);
+}
+
+
 static int usysfs_mkdir(struct inode *dir, struct dentry *dentry, int mode)
 {
 	int ret;
-	struct kset *kset;
-	struct kobject *kobj;
-	struct kobject *parent_kobj;
-	struct ukobj_type *uktype;
+	struct uset *uset;
+	struct uobject *uobj;
+	struct uobject *parent_uobj;
+	struct uuobj_type *uktype;
 	struct module *owner;
 	char *name;
 
 	if (dentry->d_parent == usysfs_sb->s_root)
 		return -EPERM;
 
-	parent_kobj = usysfs_get_kobject(dentry->d_parent);
-	uktype = to_uktype(parent_kobj->ktype);
+	parent_uobj = usysfs_get_uobject(dentry->d_parent);
+	uktype = to_uutype(parent_uobj->ktype);
 
 	if (!uktype || (!uktype->make_set && !uktype->make_object)) {
-		kobject_put(parent_kobj);
+		uobject_put(parent_uobj);
 		return -EPERM;  /* What lack-of-mkdir returns */
 	}
 
 	name = kmalloc(dentry->d_name.len + 1, GFP_KERNEL);
 	if (!name) {
-		kobject_put(parent_kobj);
+		uobject_put(parent_uobj);
 		return -ENOMEM;
 	}
 	snprintf(name, dentry->d_name.len + 1, "%s", dentry->d_name.name);
 	if (uktype->make_set) {
-		kset = uktype->make_set(to_kset(parent_kobj), name);
-		kobj = kset ? &kset->kobj : NULL;
+		uset = uktype->make_set(to_uset(parent_uobj), name);
+		uobj = uset ? &uset->uobj : NULL;
 	} else {
-		kset = NULL;
-		kobj = uktype->make_object(to_kset(parent_kobj), name);
+		uset = NULL;
+		uobj = uktype->make_object(to_uset(parent_uobj), name);
 	}
 	kfree(name);
-	if (!kobj) {
-		kobject_put(parent_kobj);
+	if (!uobj) {
+		uobject_put(parent_uobj);
 		return -ENOMEM;
 	}
 
 	ret = -EINVAL;
-	uktype = to_uktype(kobj->ktype);
+	uktype = to_uutype(uobj->ktype);
 	if (uktype) {
 		owner = uktype->owner;
 		if (try_module_get(owner)) {
-			if (kset)
-				ret = usysfs_instantiate_set(parent_kobj,
-							     kobj,
+			if (uset)
+				ret = usysfs_instantiate_set(parent_uobj,
+							     uobj,
 							     dentry);
 			else
-				ret = usysfs_instantiate_object(parent_kobj,
-								kobj, dentry);
+				ret = usysfs_instantiate_object(parent_uobj,
+								uobj, dentry);
 			if (ret) {
-				/* XXX: Should be ->drop_object() */
-				kobject_put(parent_kobj);
+				client_drop_object(parent_uobj, uobj);
+				uobject_put(parent_uobj);
 				module_put(owner);
 			}
 		}
@@ -658,12 +685,12 @@
 }
 
 /* Sets must have make_set() or make_object() */
-static int is_set(struct kobject *kobj)
+static int is_set(struct uobject *uobj)
 {
 	int ret = 0;
-	struct ukobj_type *uktype;
+	struct uuobj_type *uktype;
 
-	uktype = to_uktype(kobj->ktype);
+	uktype = to_uutype(uobj->ktype);
 	if (uktype) {
 		if (uktype->make_set)
 			ret = 1;
@@ -676,9 +703,9 @@
 
 static int usysfs_rmdir(struct inode *dir, struct dentry *dentry)
 {
-	struct kobject *parent_kobj;
-	struct kobject *kobj;
-	struct ukobj_type *uktype, *child_uktype;
+	struct uobject *parent_uobj;
+	struct uobject *uobj;
+	struct uuobj_type *uktype, *child_uktype;
 	struct usysfs_dirent *sd;
 	struct module *owner = NULL;
 	int ret;
@@ -690,39 +717,39 @@
 	if (sd->s_type & USYSFS_DEFAULT_DIR)
 		return -EPERM;
 
-	parent_kobj = usysfs_get_kobject(dentry->d_parent);
+	parent_uobj = usysfs_get_uobject(dentry->d_parent);
 
-	uktype = to_uktype(parent_kobj->ktype);
+	uktype = to_uutype(parent_uobj->ktype);
 	if (!uktype) {
-		kobject_put(parent_kobj);
+		uobject_put(parent_uobj);
 		return -EINVAL;
 	}
 
 	ret = usysfs_empty_dir(dentry);
 	if (ret) {
-		kobject_put(parent_kobj);
+		uobject_put(parent_uobj);
 		return ret;
 	}
 
-	kobj = usysfs_get_kobject(dentry);
+	uobj = usysfs_get_uobject(dentry);
 
-	/* Drop reference from above, kobj already holds one. */
-	kobject_put(parent_kobj); 
+	/* Drop reference from above, uobj already holds one. */
+	uobject_put(parent_uobj); 
 
-	child_uktype = to_uktype(kobj->ktype);
+	child_uktype = to_uutype(uobj->ktype);
 	if (child_uktype)
 		owner = child_uktype->owner;
 
-	if (is_set(kobj))
-		usysfs_drop_set(kobj);
+	if (is_set(uobj))
+		usysfs_drop_set(uobj);
 	else
-		usysfs_drop_object(kobj);
+		usysfs_drop_object(uobj);
 
-	if (uktype->drop_object)
-		uktype->drop_object(to_kset(parent_kobj), kobj);
-	else 
-		kobject_put(kobj);
+	client_drop_object(parent_uobj, uobj);
 
+	/* Drop our reference from above */
+	uobject_put(uobj);
+
 	module_put(owner);
 
 	return 0;
@@ -747,29 +774,29 @@
 #endif
 };
 
-int usysfs_rename_dir(struct kobject * kobj, const char *new_name)
+int usysfs_rename_dir(struct uobject * uobj, const char *new_name)
 {
 	int error = 0;
 	struct dentry * new_dentry, * parent;
 
-	if (!strcmp(kobject_name(kobj), new_name))
+	if (!strcmp(uobject_name(uobj), new_name))
 		return -EINVAL;
 
-	if (!kobj->parent)
+	if (!uobj->parent)
 		return -EINVAL;
 
 	down_write(&usysfs_rename_sem);
-	parent = kobj->parent->dentry;
+	parent = uobj->parent->dentry;
 
 	down(&parent->d_inode->i_sem);
 
 	new_dentry = usysfs_get_dentry(parent, new_name);
 	if (!IS_ERR(new_dentry)) {
   		if (!new_dentry->d_inode) {
-			error = kobject_set_name(kobj, "%s", new_name);
+			error = uobject_set_name(uobj, "%s", new_name);
 			if (!error) {
 				d_add(new_dentry, NULL);
-				d_move(kobj->dentry, new_dentry);
+				d_move(uobj->dentry, new_dentry);
 			}
 			else
 				d_delete(new_dentry);
@@ -923,7 +950,7 @@
 	.readdir	= usysfs_readdir,
 };
 
-int usysfs_register_subsystem(struct kset *k)
+int usysfs_register_subsystem(struct uset *k)
 {
 	int err;
 	struct qstr name;
@@ -934,13 +961,13 @@
 	if (err)
 		return err;
 
-	k->kobj.kset = k;
-	if (!k->kobj.k_name)
-		k->kobj.k_name = k->kobj.name;
+	k->uobj.uset = k;
+	if (!k->uobj.k_name)
+		k->uobj.k_name = k->uobj.name;
 
 	down(&usysfs_sb->s_root->d_inode->i_sem);
 
-	name.name = k->kobj.k_name;
+	name.name = k->uobj.k_name;
 	name.len = strlen(name.name);
 	name.hash = full_name_hash(name.name, name.len);
 
@@ -952,7 +979,7 @@
 	d_add(dentry, NULL);
 
 	sd = usysfs_sb->s_root->d_fsdata;
-	err = usysfs_instantiate_set(sd->s_element, &k->kobj, dentry);
+	err = usysfs_instantiate_set(sd->s_element, &k->uobj, dentry);
 	if (!err)
 		dentry = NULL;
 	else
@@ -969,9 +996,9 @@
 	return err;
 }
 
-void usysfs_unregister_subsystem(struct kset *k)
+void usysfs_unregister_subsystem(struct uset *k)
 {
-	struct dentry *dentry = k->kobj.dentry;
+	struct dentry *dentry = k->uobj.dentry;
 
 	if (dentry->d_parent != usysfs_sb->s_root) {
 		printk(KERN_ERR "usysfs: Tried to unregister non-subsystem!\n");
@@ -983,7 +1010,7 @@
 	if (usysfs_empty_dir(dentry)) {
 		printk(KERN_ERR "usysfs: Tried to unregister non-empty subsystem!\n");
 	}
-	usysfs_drop_set(&k->kobj);
+	usysfs_drop_set(&k->uobj);
 	dentry->d_inode->i_flags |= S_DEAD;
 	up(&dentry->d_inode->i_sem);
 
@@ -995,5 +1022,5 @@
 	usysfs_release_fs();
 }
 
-EXPORT_SYMBOL_GPL(usysfs_register_subsystem);
-EXPORT_SYMBOL_GPL(usysfs_unregister_subsystem);
+EXPORT_SYMBOL(usysfs_register_subsystem);
+EXPORT_SYMBOL(usysfs_unregister_subsystem);

Modified: trunk/fs/usysfs/file.c
===================================================================
--- trunk/fs/usysfs/file.c	2005-03-24 04:17:32 UTC (rev 2044)
+++ trunk/fs/usysfs/file.c	2005-03-24 20:11:10 UTC (rev 2045)
@@ -27,58 +27,20 @@
 #include <linux/fs.h>
 #include <linux/module.h>
 #include <linux/dnotify.h>
-#include <linux/kobject.h>
 #include <linux/slab.h>
 #include <asm/uaccess.h>
 #include <asm/semaphore.h>
 
+#include "uobject.h"
 #include "usysfs.h"
 #include "usysfs_internal.h"
 
-#define to_subsys(k) container_of(k,struct subsystem,kset.kobj)
-#define to_sattr(a) container_of(a,struct subsys_attribute,attr)
 
-/**
- * Subsystem file operations.
- * These operations allow subsystems to have files that can be 
- * read/written. 
- */
-static ssize_t 
-subsys_attr_show(struct kobject * kobj, struct attribute * attr, char * page)
-{
-	struct subsystem * s = to_subsys(kobj);
-	struct subsys_attribute * sattr = to_sattr(attr);
-	ssize_t ret = 0;
-
-	if (sattr->show)
-		ret = sattr->show(s,page);
-	return ret;
-}
-
-static ssize_t 
-subsys_attr_store(struct kobject * kobj, struct attribute * attr, 
-		  const char * page, size_t count)
-{
-	struct subsystem * s = to_subsys(kobj);
-	struct subsys_attribute * sattr = to_sattr(attr);
-	ssize_t ret = 0;
-
-	if (sattr->store)
-		ret = sattr->store(s,page,count);
-	return ret;
-}
-
-static struct sysfs_ops subsys_sysfs_ops = {
-	.show	= subsys_attr_show,
-	.store	= subsys_attr_store,
-};
-
-
 struct usysfs_buffer {
 	size_t			count;
 	loff_t			pos;
 	char			* page;
-	struct sysfs_ops	* ops;
+	struct usysfs_attribute_operations	* ops;
 	struct semaphore	sem;
 	int			needs_read_fill;
 };
@@ -90,15 +52,15 @@
  *	@buffer:	data buffer for file.
  *
  *	Allocate @buffer->page, if it hasn't been already, then call the
- *	kobject's show() method to fill the buffer with this attribute's 
+ *	uobject's show() method to fill the buffer with this attribute's 
  *	data. 
  *	This is called only once, on the file's first read. 
  */
 static int fill_read_buffer(struct dentry * dentry, struct usysfs_buffer * buffer)
 {
-	struct attribute * attr = to_attr(dentry);
-	struct kobject * kobj = to_kobj(dentry->d_parent);
-	struct sysfs_ops * ops = buffer->ops;
+	struct usysfs_attribute * attr = to_attr(dentry);
+	struct uobject * uobj = to_uobj(dentry->d_parent);
+	struct usysfs_attribute_operations * ops = buffer->ops;
 	int ret = 0;
 	ssize_t count;
 
@@ -107,7 +69,7 @@
 	if (!buffer->page)
 		return -ENOMEM;
 
-	count = ops->show(kobj,attr,buffer->page);
+	count = ops->show(uobj,attr,buffer->page);
 	buffer->needs_read_fill = 0;
 	BUG_ON(count > (ssize_t)PAGE_SIZE);
 	if (count >= 0)
@@ -215,11 +177,11 @@
 
 
 /**
- *	flush_write_buffer - push buffer to kobject.
+ *	flush_write_buffer - push buffer to uobject.
  *	@file:		file pointer.
  *	@buffer:	data buffer for file.
  *
- *	Get the correct pointers for the kobject and the attribute we're
+ *	Get the correct pointers for the uobject and the attribute we're
  *	dealing with, then call the store() method for the attribute, 
  *	passing the buffer that we acquired in fill_write_buffer().
  */
@@ -227,11 +189,11 @@
 static int 
 flush_write_buffer(struct dentry * dentry, struct usysfs_buffer * buffer, size_t count)
 {
-	struct attribute * attr = to_attr(dentry);
-	struct kobject * kobj = to_kobj(dentry->d_parent);
-	struct sysfs_ops * ops = buffer->ops;
+	struct usysfs_attribute * attr = to_attr(dentry);
+	struct uobject * uobj = to_uobj(dentry->d_parent);
+	struct usysfs_attribute_operations * ops = buffer->ops;
 
-	return ops->store(kobj,attr,buffer->page,count);
+	return ops->store(uobj,attr,buffer->page,count);
 }
 
 
@@ -244,7 +206,7 @@
  *
  *	Similar to usysfs_read_file(), though working in the opposite direction.
  *	We allocate and fill the data from the user in fill_write_buffer(),
- *	then push it to the kobject in flush_write_buffer().
+ *	then push it to the uobject in flush_write_buffer().
  *	There is no easy way for us to know if userspace is only doing a partial
  *	write, so we don't support them. We expect the entire buffer to come
  *	on the first write. 
@@ -269,13 +231,13 @@
 
 static int check_perm(struct inode * inode, struct file * file)
 {
-	struct kobject *kobj = usysfs_get_kobject(file->f_dentry->d_parent);
-	struct attribute * attr = to_attr(file->f_dentry);
+	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 sysfs_ops * ops = NULL;
+	struct usysfs_attribute_operations * ops = NULL;
 	int error = 0;
 
-	if (!kobj || !attr)
+	if (!uobj || !attr)
 		goto Einval;
 
 	/* Grab the module reference for this attribute if we have one */
@@ -284,20 +246,12 @@
 		goto Done;
 	}
 
-	/* if the kobject has no ktype, then we assume that it is a subsystem
+	/* if the uobject has no ktype, then we assume that it is a subsystem
 	 * itself, and use ops for it.
 	 */
-	if (kobj->kset && kobj->kset->ktype)
-		ops = kobj->kset->ktype->sysfs_ops;
-	else if (kobj->ktype)
-		ops = kobj->ktype->sysfs_ops;
+	if (uobj->ktype)
+		ops = uobj->ktype->sysfs_ops;
 	else
-		ops = &subsys_sysfs_ops;
-
-	/* No usysfs operations, either from having no subsystem,
-	 * or the subsystem have no operations.
-	 */
-	if (!ops)
 		goto Eaccess;
 
 	/* File needs write support.
@@ -341,8 +295,8 @@
 	error = -EACCES;
 	module_put(attr->owner);
  Done:
-	if (error && kobj)
-		kobject_put(kobj);
+	if (error && uobj)
+		uobject_put(uobj);
 	return error;
 }
 
@@ -353,13 +307,13 @@
 
 static int usysfs_release(struct inode * inode, struct file * filp)
 {
-	struct kobject * kobj = to_kobj(filp->f_dentry->d_parent);
-	struct attribute * attr = to_attr(filp->f_dentry);
+	struct uobject * uobj = to_uobj(filp->f_dentry->d_parent);
+	struct usysfs_attribute * attr = to_attr(filp->f_dentry);
 	struct module * owner = attr->owner;
 	struct usysfs_buffer * buffer = filp->private_data;
 
-	if (kobj) 
-		kobject_put(kobj);
+	if (uobj) 
+		uobject_put(uobj);
 	/* After this point, attr should not be accessed. */
 	module_put(owner);
 
@@ -380,7 +334,7 @@
 };
 
 
-int usysfs_add_file(struct dentry * dir, const struct attribute * attr, int type)
+int usysfs_add_file(struct dentry * dir, const struct usysfs_attribute * attr, int type)
 {
 	struct usysfs_dirent * parent_sd = dir->d_fsdata;
 	umode_t mode = (attr->mode & S_IALLUGO) | S_IFREG;
@@ -396,15 +350,15 @@
 
 /**
  *	usysfs_create_file - create an attribute file for an object.
- *	@kobj:	object we're creating for. 
+ *	@uobj:	object we're creating for. 
  *	@attr:	atrribute descriptor.
  */
 
-int usysfs_create_file(struct kobject * kobj, const struct attribute * attr)
+int usysfs_create_file(struct uobject * uobj, const struct usysfs_attribute * attr)
 {
-	BUG_ON(!kobj || !kobj->dentry || !attr);
+	BUG_ON(!uobj || !uobj->dentry || !attr);
 
-	return usysfs_add_file(kobj->dentry, attr, USYSFS_KOBJ_ATTR);
+	return usysfs_add_file(uobj->dentry, attr, USYSFS_UOBJ_ATTR);
 
 }
 

Modified: trunk/fs/usysfs/inode.c
===================================================================
--- trunk/fs/usysfs/inode.c	2005-03-24 04:17:32 UTC (rev 2044)
+++ trunk/fs/usysfs/inode.c	2005-03-24 20:11:10 UTC (rev 2045)
@@ -30,8 +30,9 @@
 
 #include <linux/pagemap.h>
 #include <linux/namei.h>
-#include <linux/kobject.h>
 #include <linux/backing-dev.h>
+
+#include "uobject.h"
 #include "usysfs.h"
 #include "usysfs_internal.h"
 
@@ -124,15 +125,15 @@
 	switch (sd->s_type) {
 		case USYSFS_DIR:
 		case USYSFS_DEFAULT_DIR:
-		case USYSFS_KOBJ_LINK:
+		case USYSFS_UOBJ_LINK:
 			/* Always have a dentry so use that */
 			return sd->s_dentry->d_name.name;
 
-		case USYSFS_KOBJ_ATTR:
+		case USYSFS_UOBJ_ATTR:
 			attr = sd->s_element;
 			return attr->name;
 
-		case USYSFS_KOBJ_BIN_ATTR:
+		case USYSFS_UOBJ_BIN_ATTR:
 			bin_attr = sd->s_element;
 			return bin_attr->attr.name;
 	}

Modified: trunk/fs/usysfs/mount.c
===================================================================
--- trunk/fs/usysfs/mount.c	2005-03-24 04:17:32 UTC (rev 2044)
+++ trunk/fs/usysfs/mount.c	2005-03-24 20:11:10 UTC (rev 2045)
@@ -31,8 +31,8 @@
 #include <linux/mount.h>
 #include <linux/pagemap.h>
 #include <linux/init.h>
-#include <linux/kobject.h>
 
+#include "uobject.h"
 #include "usysfs.h"
 #include "usysfs_internal.h"
 
@@ -52,49 +52,42 @@
 #endif
 };
 
-static struct ukset usysfs_root_set = {
-	.kset = {
-		.kobj = {
+static struct uuset usysfs_root_set = {
+	.uset = {
+		.uobj = {
 			.name	= "root",
-			.k_name	= usysfs_root_set.kset.kobj.name,
+			.k_name	= usysfs_root_set.uset.uobj.name,
 		},
 	},
 };
 
-int usysfs_is_root(struct kobject *kobj)
+int usysfs_is_root(struct uobject *uobj)
 {
-	return kobj == &usysfs_root_set.kset.kobj;
+	return uobj == &usysfs_root_set.uset.uobj;
 }
 
 static struct usysfs_dirent usysfs_root = {
 	.s_sibling	= LIST_HEAD_INIT(usysfs_root.s_sibling),
 	.s_children	= LIST_HEAD_INIT(usysfs_root.s_children),
-	.s_element	= &usysfs_root_set.kset.kobj,
+	.s_element	= &usysfs_root_set.uset.uobj,
 	.s_type		= USYSFS_ROOT,
 };
 
-/* Kernel idiots 1, universe 0 */
-static void kset_init_copy(struct kset *k)
+void uuset_init(struct uuset *uuset)
 {
-	kobject_init(&k->kobj);
-	INIT_LIST_HEAD(&k->list);
+	uset_init(&uuset->uset);
 }
+EXPORT_SYMBOL_GPL(uuset_init);
 
-void ukset_init(struct ukset *ukset)
+void uuset_init_type_name(struct uuset *uuset, const char *name,
+			  struct uobj_type *ktype)
 {
-	kset_init_copy(&ukset->kset);
+	uobject_set_name(&uuset->uset.uobj, name);
+	uuset->uset.uobj.ktype = ktype;
+	uuset_init(uuset);
 }
-EXPORT_SYMBOL_GPL(ukset_init);
+EXPORT_SYMBOL(uuset_init_type_name);
 
-void ukset_init_type_name(struct ukset *ukset, const char *name,
-			  struct kobj_type *ktype)
-{
-	kobject_set_name(&ukset->kset.kobj, name);
-	ukset->kset.kobj.ktype = ktype;
-	ukset_init(ukset);
-}
-EXPORT_SYMBOL(ukset_init_type_name);
-
 static int usysfs_fill_super(struct super_block *sb, void *data, int silent)
 {
 	struct inode *inode;
@@ -123,8 +116,8 @@
 		iput(inode);
 		return -ENOMEM;
 	}
-	ukset_init(&usysfs_root_set);
-	usysfs_root_set.kset.kobj.dentry = root;
+	uuset_init(&usysfs_root_set);
+	usysfs_root_set.uset.uobj.dentry = root;
 	root->d_fsdata = &usysfs_root;
 	sb->s_root = root;
 	return 0;
@@ -185,4 +178,4 @@
 MODULE_LICENSE("GPL");
 MODULE_AUTHOR("Oracle");
 MODULE_VERSION("0.0.1");
-MODULE_DESCRIPTION("Simple RAM filesystem for user created kobjects.");
+MODULE_DESCRIPTION("Simple RAM filesystem for user created uobjects.");

Modified: trunk/fs/usysfs/symlink.c
===================================================================
--- trunk/fs/usysfs/symlink.c	2005-03-24 04:17:32 UTC (rev 2044)
+++ trunk/fs/usysfs/symlink.c	2005-03-24 20:11:10 UTC (rev 2045)
@@ -27,65 +27,65 @@
 #include <linux/version.h>
 #include <linux/fs.h>
 #include <linux/module.h>
-#include <linux/kobject.h>
 #include <linux/namei.h>
 
+#include "uobject.h"
 #include "usysfs.h"
 #include "usysfs_internal.h"
 
-static int object_depth(struct kobject * kobj)
+static int object_depth(struct uobject * uobj)
 {
-	struct kobject * p = kobj;
+	struct uobject * p = uobj;
 	int depth = 0;
 	do { depth++; } while ((p = p->parent) && !usysfs_is_root(p));
 	return depth;
 }
 
-static int object_path_length(struct kobject * kobj)
+static int object_path_length(struct uobject * uobj)
 {
-	struct kobject * p = kobj;
+	struct uobject * p = uobj;
 	int length = 1;
 	do {
-		length += strlen(kobject_name(p)) + 1;
+		length += strlen(uobject_name(p)) + 1;
 		p = p->parent;
 	} while (p && !usysfs_is_root(p));
 	return length;
 }
 
-static void fill_object_path(struct kobject * kobj, char * buffer, int length)
+static void fill_object_path(struct uobject * uobj, char * buffer, int length)
 {
-	struct kobject * p;
+	struct uobject * p;
 
 	--length;
-	for (p = kobj; p && !usysfs_is_root(p); p = p->parent) {
-		int cur = strlen(kobject_name(p));
+	for (p = uobj; p && !usysfs_is_root(p); p = p->parent) {
+		int cur = strlen(uobject_name(p));
 
 		/* back up enough to print this bus id with '/' */
 		length -= cur;
-		strncpy(buffer + length,kobject_name(p),cur);
+		strncpy(buffer + length,uobject_name(p),cur);
 		*(buffer + --length) = '/';
 	}
 }
 
-static int create_link(struct kobject *parent_kobj,
- 		       struct kobject *kobj,
+static int create_link(struct uobject *parent_uobj,
+ 		       struct uobject *uobj,
 		       struct dentry *dentry)
 {
-	struct usysfs_dirent *target_sd = kobj->dentry->d_fsdata;
+	struct usysfs_dirent *target_sd = uobj->dentry->d_fsdata;
 	struct usysfs_symlink *sl;
 	int ret;
 
 	ret = -ENOMEM;
 	sl = kmalloc(sizeof(struct usysfs_symlink), GFP_KERNEL);
 	if (sl) {
-		sl->sl_target = kobject_get(kobj);
+		sl->sl_target = uobject_get(uobj);
 		/* FIXME: needs a lock, I'd bet */
 		list_add(&sl->sl_list, &target_sd->s_links);
-		ret = usysfs_create_link(sl, parent_kobj->dentry,
+		ret = usysfs_create_link(sl, parent_uobj->dentry,
 					 dentry);
 		if (ret) {
 			list_del_init(&sl->sl_list);
-			kobject_put(kobj);
+			uobject_put(uobj);
 			kfree(sl);
 		}
 	}
@@ -95,13 +95,13 @@
 
 
 static int get_target(const char *symname, struct nameidata *nd,
-		      struct kobject **target)
+		      struct uobject **target)
 {
 	int ret;
 
 	ret = path_lookup(symname, LOOKUP_FOLLOW|LOOKUP_DIRECTORY, nd);
 	if (!ret) {
-		*target = usysfs_get_kobject(nd->dentry);
+		*target = usysfs_get_uobject(nd->dentry);
 		if (!*target) {
 			ret = -ENOENT;
 			path_release(nd);
@@ -116,33 +116,33 @@
 {
 	int ret;
 	struct nameidata nd;
-	struct kobject *parent_kobj;
-	struct kobject *target_kobj;
-	struct ukobj_type *uktype;
+	struct uobject *parent_uobj;
+	struct uobject *target_uobj;
+	struct uuobj_type *uktype;
 
 	ret = -EPERM;  /* What lack-of-symlink returns */
 	if (dentry->d_parent == usysfs_sb->s_root)
 		goto out;
 
-	parent_kobj = usysfs_get_kobject(dentry->d_parent);
-	uktype = to_uktype(parent_kobj->ktype);
+	parent_uobj = usysfs_get_uobject(dentry->d_parent);
+	uktype = to_uutype(parent_uobj->ktype);
 
 	if (!uktype || !uktype->allow_link)
 		goto out_put;
 
-	ret = get_target(symname, &nd, &target_kobj);
+	ret = get_target(symname, &nd, &target_uobj);
 	if (ret)
 		goto out_put;
 
-	ret = uktype->allow_link(parent_kobj, target_kobj);
+	ret = uktype->allow_link(parent_uobj, target_uobj);
 	if (!ret)
-		ret = create_link(parent_kobj, target_kobj, dentry);
+		ret = create_link(parent_uobj, target_uobj, dentry);
 
-	kobject_put(target_kobj);
+	uobject_put(target_uobj);
 	path_release(&nd);
 
 out_put:
-	kobject_put(parent_kobj);
+	uobject_put(parent_uobj);
 
 out:
 	return ret;
@@ -152,12 +152,12 @@
 {
 	struct usysfs_dirent *sd = dentry->d_fsdata;
 	struct usysfs_symlink *sl;
-	struct kobject *parent_kobj;
-	struct ukobj_type *uktype;
+	struct uobject *parent_uobj;
+	struct uuobj_type *uktype;
 	int ret;
 
 	ret = -EPERM;  /* What lack-of-symlink returns */
-	if (!(sd->s_type & USYSFS_KOBJ_LINK))
+	if (!(sd->s_type & USYSFS_UOBJ_LINK))
 		goto out;
 
 	if (dentry->d_parent == usysfs_sb->s_root)
@@ -165,8 +165,8 @@
 
 	sl = sd->s_element;
 
-	parent_kobj = usysfs_get_kobject(dentry->d_parent);
-	uktype = to_uktype(parent_kobj->ktype);
+	parent_uobj = usysfs_get_uobject(dentry->d_parent);
+	uktype = to_uutype(parent_uobj->ktype);
 
 	list_del_init(&sd->s_sibling);
 	usysfs_drop_dentry(sd, dentry->d_parent);
@@ -179,16 +179,16 @@
 	 * drop_link(this, target) and drop_object(target) is preserved.
 	 */
 	if (uktype && uktype->drop_link)
-		uktype->drop_link(parent_kobj, sl->sl_target);
+		uktype->drop_link(parent_uobj, sl->sl_target);
 
 	/* FIXME: Needs lock */
 	list_del_init(&sl->sl_list);
 
 	/* Put reference from create_link() */
-	kobject_put(sl->sl_target);
+	uobject_put(sl->sl_target);
 	kfree(sl);
 
-	kobject_put(parent_kobj);
+	uobject_put(parent_uobj);
 
 	ret = 0;
 
@@ -196,13 +196,13 @@
 	return ret;
 }
 
-static int usysfs_get_target_path(struct kobject * kobj, struct kobject * target,
+static int usysfs_get_target_path(struct uobject * uobj, struct uobject * target,
 				   char *path)
 {
 	char * s;
 	int depth, size;
 
-	depth = object_depth(kobj);
+	depth = object_depth(uobj);
 	size = object_path_length(target) + depth * 3 - 1;
 	if (size > PATH_MAX)
 		return -ENAMETOOLONG;
@@ -220,25 +220,25 @@
 
 static int usysfs_getlink(struct dentry *dentry, char * path)
 {
-	struct kobject *kobj, *target_kobj;
+	struct uobject *uobj, *target_uobj;
 	int error = 0;
 
-	kobj = usysfs_get_kobject(dentry->d_parent);
-	if (!kobj)
+	uobj = usysfs_get_uobject(dentry->d_parent);
+	if (!uobj)
 		return -EINVAL;
 
-	target_kobj = usysfs_get_kobject(dentry);
-	if (!target_kobj) {
-		kobject_put(kobj);
+	target_uobj = usysfs_get_uobject(dentry);
+	if (!target_uobj) {
+		uobject_put(uobj);
 		return -EINVAL;
 	}
 
 	down_read(&usysfs_rename_sem);
-	error = usysfs_get_target_path(kobj, target_kobj, path);
+	error = usysfs_get_target_path(uobj, target_uobj, path);
 	up_read(&usysfs_rename_sem);
 	
-	kobject_put(kobj);
-	kobject_put(target_kobj);
+	uobject_put(uobj);
+	uobject_put(target_uobj);
 	return error;
 
 }

Added: trunk/fs/usysfs/uobject.c
===================================================================
--- trunk/fs/usysfs/uobject.c	2005-03-24 04:17:32 UTC (rev 2044)
+++ trunk/fs/usysfs/uobject.c	2005-03-24 20:11:10 UTC (rev 2045)
@@ -0,0 +1,198 @@
+/* -*- mode: c; c-basic-offset: 8; -*-
+ * vim: noexpandtab sw=8 ts=8 sts=0:
+ *
+ * uobject.c - library routines for handling generic kernel objects
+ *
+ * Copyright (c) 2002-2003 Patrick Mochel <mochel at osdl.org>
+ *
+ * This file is released under the GPLv2.
+ *
+ *
+ * Please see the file Documentation/uobject.txt for critical information
+ * about using the uobject interface.
+ *
+ * 2005.01.24
+ *      Stripped down for 2.4 compat in usysfs.
+ *      Joel Becker <joel.becker at oracle.com>
+ */
+
+#include <linux/string.h>
+#include <linux/module.h>
+#include <linux/stat.h>
+#include <linux/slab.h>
+
+#include "uobject.h"
+
+static spinlock_t uset_linkage_lock = SPIN_LOCK_UNLOCKED;
+
+static inline struct uobject * to_uobj(struct list_head * entry)
+{
+	return container_of(entry,struct uobject,entry);
+}
+
+/* Evil kernel */
+static void uobject_release(struct kref *kref);
+
+/**
+ *	uobject_init - initialize object.
+ *	@uobj:	object in question.
+ */
+void uobject_init(struct uobject * uobj)
+{
+	kref_init(&uobj->kref, uobject_release);
+	INIT_LIST_HEAD(&uobj->entry);
+}
+
+/**
+ *	uobject_set_name - Set the name of an object
+ *	@uobj:	object.
+ *	@name:	name. 
+ *
+ *	If strlen(name) >= UOBJ_NAME_LEN, then use a dynamically allocated
+ *	string that @uobj->k_name points to. Otherwise, use the static 
+ *	@uobj->name array.
+ */
+
+int uobject_set_name(struct uobject * uobj, const char * fmt, ...)
+{
+	int error = 0;
+	int limit = UOBJ_NAME_LEN;
+	int need;
+	va_list args;
+	char * name;
+
+	/* 
+	 * First, try the static array 
+	 */
+	va_start(args,fmt);
+	need = vsnprintf(uobj->name,limit,fmt,args);
+	va_end(args);
+	if (need < limit) 
+		name = uobj->name;
+	else {
+		/* 
+		 * Need more space? Allocate it and try again 
+		 */
+		limit = need + 1;
+		name = kmalloc(limit,GFP_KERNEL);
+		if (!name) {
+			error = -ENOMEM;
+			goto Done;
+		}
+		va_start(args,fmt);
+		need = vsnprintf(name,limit,fmt,args);
+		va_end(args);
+
+		/* Still? Give up. */
+		if (need >= limit) {
+			kfree(name);
+			error = -EFAULT;
+			goto Done;
+		}
+	}
+
+	/* Free the old name, if necessary. */
+	if (uobj->k_name && uobj->k_name != uobj->name)
+		kfree(uobj->k_name);
+
+	/* Now, set the new name */
+	uobj->k_name = name;
+ Done:
+	return error;
+}
+
+EXPORT_SYMBOL(uobject_set_name);
+
+struct uobject * uobject_get(struct uobject * uobj)
+{
+	if (uobj)
+		kref_get(&uobj->kref);
+	return uobj;
+}
+
+/**
+ *	uobject_cleanup - free uobject resources. 
+ *	@uobj:	object.
+ */
+
+void uobject_cleanup(struct uobject * uobj)
+{
+	struct uobj_type * t = uobj->ktype;
+	struct uset * s = uobj->uset;
+	struct uobject * parent = uobj->parent;
+
+	pr_debug("uobject %s: cleaning up\n",uobject_name(uobj));
+	if (uobj->k_name != uobj->name)
+		kfree(uobj->k_name);
+	uobj->k_name = NULL;
+	if (t && t->release)
+		t->release(uobj);
+	if (s)
+		uset_put(s);
+	if (parent)
+		uobject_put(parent);
+}
+
+static void uobject_release(struct kref *kref)
+{
+	uobject_cleanup(container_of(kref, struct uobject, kref));
+}
+
+/**
+ *	uobject_put - decrement refcount for object.
+ *	@uobj:	object.
+ *
+ *	Decrement the refcount, and if 0, call uobject_cleanup().
+ */
+void uobject_put(struct uobject * uobj)
+{
+	if (uobj)
+		kref_put(&uobj->kref, uobject_release);
+}
+
+
+/**
+ *	uset_init - initialize a uset for use
+ *	@k:	uset 
+ */
+
+void uset_init(struct uset *set)
+{
+	uobject_init(&set->uobj);
+	INIT_LIST_HEAD(&set->list);
+}
+
+
+/**
+ *	uset_find_obj - search for object in uset.
+ *	@uset:	uset we're looking in.
+ *	@name:	object's name.
+ *
+ *	Lock uset via @uset->subsys, and iterate over @uset->list,
+ *	looking for a matching uobject. If matching object is found
+ *	take a reference and return the object.
+ */
+
+struct uobject * uset_find_obj(struct uset * uset, const char * name)
+{
+	struct list_head * entry;
+	struct uobject * ret = NULL;
+
+        /* XXX LOCKING! */
+	list_for_each(entry,&uset->list) {
+		struct uobject * uobj = to_uobj(entry);
+		if (uobject_name(uobj) &&
+                    !strcmp(uobject_name(uobj), name)) {
+			ret = uobject_get(uobj);
+			break;
+		}
+	}
+	return ret;
+}
+
+
+EXPORT_SYMBOL(uobject_init);
+EXPORT_SYMBOL(uset_init);
+EXPORT_SYMBOL(uobject_get);
+EXPORT_SYMBOL(uobject_put);
+

Added: trunk/fs/usysfs/uobject.h
===================================================================
--- trunk/fs/usysfs/uobject.h	2005-03-24 04:17:32 UTC (rev 2044)
+++ trunk/fs/usysfs/uobject.h	2005-03-24 20:11:10 UTC (rev 2045)
@@ -0,0 +1,107 @@
+/*
+ * uobject.h - generic user object infrastructure.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ * 
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 021110-1307, USA.
+ *
+ * Based on uobject.h:
+ *      Copyright (c) 2002-2003	Patrick Mochel
+ *      Copyright (c) 2002-2003	Open Source Development Labs
+ *
+ * Copyright (C) 2005 Oracle.  All rights reserved.
+ *
+ * Please read Documentation/usysfs.txt before using the uobject and
+ * usysfs interface, ESPECIALLY the parts about reference counts and
+ * object destructors. 
+ */
+
+#ifndef _UOBJECT_H_
+#define _UOBJECT_H_
+
+#ifdef __KERNEL__
+
+#include <linux/types.h>
+#include <linux/list.h>
+#include <linux/kref.h>
+
+#define UOBJ_NAME_LEN	20
+
+struct usysfs_attribute;
+struct usysfs_attribute_operations;
+
+struct uobject {
+	char			*k_name;
+	char			name[UOBJ_NAME_LEN];
+	struct kref		kref;
+	struct list_head	entry;
+	struct uobject		*parent;
+	struct uset		*uset;
+	struct uobj_type	*ktype;
+	struct dentry		*dentry;
+};
+
+extern int uobject_set_name(struct uobject *, const char *, ...);
+
+static inline char *uobject_name(struct uobject * uobj)
+{
+	return uobj->k_name;
+}
+
+extern void uobject_init(struct uobject *);
+extern void uobject_cleanup(struct uobject *);
+
+extern struct uobject * uobject_get(struct uobject *);
+extern void uobject_put(struct uobject *);
+
+struct uobj_type {
+	void (*release)(struct uobject *);
+	struct usysfs_attribute_operations	*sysfs_ops;
+	struct usysfs_attribute                 **default_attrs;
+};
+
+
+/**
+ *	uset - a set of uobjects of a specific type, belonging
+ *	to a specific subsystem.
+ */
+
+struct uset {
+	struct list_head	list;
+	struct uobject		uobj;
+};
+
+
+extern void uset_init(struct uset *set);
+
+static inline struct uset *to_uset(struct uobject *uobj)
+{
+	return uobj ? container_of(uobj,struct uset,uobj) : NULL;
+}
+
+static inline struct uset *uset_get(struct uset *set)
+{
+	return set ? to_uset(uobject_get(&set->uobj)) : NULL;
+}
+
+static inline void uset_put(struct uset *set)
+{
+	uobject_put(&set->uobj);
+}
+
+extern struct uobject *uset_find_obj(struct uset *, const char *);
+
+
+#endif /* __KERNEL__ */
+#endif /* _UOBJECT_H_ */

Modified: trunk/fs/usysfs/usysfs.h
===================================================================
--- trunk/fs/usysfs/usysfs.h	2005-03-24 04:17:32 UTC (rev 2044)
+++ trunk/fs/usysfs/usysfs.h	2005-03-24 20:11:10 UTC (rev 2045)
@@ -31,56 +31,50 @@
 
 #include <asm/atomic.h>
 
-struct kobject;
+#include "uobject.h"
+
 struct module;
 
-/* sysfs.h always has these */
-#if 0
-struct attribute {
+struct usysfs_attribute {
 	char			* name;
 	struct module 		* owner;
 	mode_t			mode;
 };
 
-struct attribute_group {
-	char			* name;
-	struct attribute	** attrs;
-};
-#endif
 
 /*
- * Usysfs objects must have a ->ktype of type ukobj_type.
+ * Usysfs objects must have a ->ktype of type uuobj_type.
  * If allow_link() exists, the object can symlink(2) out to other
- * objects.  If the object is a kset, it may support mkdir(2).  Kset
+ * objects.  If the object is a uset, it may support mkdir(2).  Kset
  * objects must supply one of make_set() and make_object().  If the
- * object supports make_set(), one can create kset children.  If it
- * supports make_object(), one can create kobject children.  If it has
- * default_sets on ukset->default_sets, it has automatically created
- * kset children.  default_sets may coexist alongsize make_set() or
- * make_object(), but if the kset wishes to have only default_sets 
+ * object supports make_set(), one can create uset children.  If it
+ * supports make_object(), one can create uobject children.  If it has
+ * default_sets on uuset->default_sets, it has automatically created
+ * uset children.  default_sets may coexist alongsize make_set() or
+ * make_object(), but if the uset wishes to have only default_sets 
  * children (disallowing mkdir(2)), it must provide
- * usysfs_make_no_object() as the value for make_object().  If the kset
+ * usysfs_make_no_object() as the value for make_object().  If the uset
  * has commit(), it supports pending and commited (active) objects.
  */
-struct ukobj_type {
-	struct kobj_type ktype;
+struct uuobj_type {
+	struct uobj_type ktype;
 	struct module *owner;
-	int (*allow_link)(struct kobject *src, struct kobject *target);
-	int (*drop_link)(struct kobject *src, struct kobject *target);
-	struct kobject *(*make_object)(struct kset *kset, const char *name);
-	struct kset *(*make_set)(struct kset *kset, const char *name);
-	int (*commit)(struct kobject *kobj);
-        void (*drop_object)(struct kset *kset, struct kobject *kobj);
+	int (*allow_link)(struct uobject *src, struct uobject *target);
+	int (*drop_link)(struct uobject *src, struct uobject *target);
+	struct uobject *(*make_object)(struct uset *uset, const char *name);
+	struct uset *(*make_set)(struct uset *uset, const char *name);
+	int (*commit)(struct uobject *uobj);
+        void (*drop_object)(struct uset *uset, struct uobject *uobj);
 };
 
-static inline struct ukobj_type *to_uktype(struct kobj_type *ktype)
+static inline struct uuobj_type *to_uutype(struct uobj_type *ktype)
 {
 	return ktype ?
-		container_of(ktype, struct ukobj_type, ktype) :
+		container_of(ktype, struct uuobj_type, ktype) :
 		NULL;
 }
 
-static inline struct kobject *usysfs_make_no_object(struct kset *kset,
+static inline struct uobject *usysfs_make_no_object(struct uset *uset,
 						    const char *name)
 {
 	return NULL;
@@ -88,22 +82,22 @@
 
 
 /*
- * Usysfs ksets must actually be of type ukset.  This allows default
+ * Usysfs usets must actually be of type uuset.  This allows default
  * child sets to be created.
  */
-struct ukset {
-	struct kset kset;
-	struct kset **default_sets;
+struct uuset {
+	struct uset uset;
+	struct uset **default_sets;
 };
 
-static inline struct ukset *to_ukset(struct kset *kset)
+static inline struct uuset *to_uuset(struct uset *uset)
 {
-	return kset ? container_of(kset, struct ukset, kset) : NULL;
+	return uset ? container_of(uset, struct uuset, uset) : NULL;
 }
 
-void ukset_init(struct ukset *ukset);
-void ukset_init_type_name(struct ukset *ukset, const char *name,
-			  struct kobj_type *ktype);
+void uuset_init(struct uuset *uuset);
+void uuset_init_type_name(struct uuset *uuset, const char *name,
+			  struct uobj_type *ktype);
 
 
 /**
@@ -126,20 +120,17 @@
 
 #define attr_name(_attr) (_attr).attr.name
 
-/* Again, sysfs.h has these */
-#if 0
-struct bin_attribute {
-	struct attribute	attr;
+struct usysfs_bin_attribute {
+	struct usysfs_attribute	attr;
 	size_t			size;
-	ssize_t (*read)(struct kobject *, char *, loff_t, size_t);
-	ssize_t (*write)(struct kobject *, char *, loff_t, size_t);
+	ssize_t (*read)(struct uobject *, char *, loff_t, size_t);
+	ssize_t (*write)(struct uobject *, char *, loff_t, size_t);
 };
 
-struct usysfs_ops {
-	ssize_t	(*show)(struct kobject *, struct attribute *,char *);
-	ssize_t	(*store)(struct kobject *,struct attribute *,const char *, 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);
 };
-#endif
 
 struct usysfs_dirent {
 	atomic_t		s_count;
@@ -154,13 +145,13 @@
 
 #define USYSFS_ROOT		0x0001
 #define USYSFS_DIR		0x0002
-#define USYSFS_KOBJ_ATTR 	0x0004
-#define USYSFS_KOBJ_BIN_ATTR	0x0008
-#define USYSFS_KOBJ_LINK 	0x0020
+#define USYSFS_UOBJ_ATTR 	0x0004
+#define USYSFS_UOBJ_BIN_ATTR	0x0008
+#define USYSFS_UOBJ_LINK 	0x0020
 #define USYSFS_DEFAULT_DIR	0x0040
-#define USYSFS_NOT_PINNED	(USYSFS_KOBJ_ATTR | USYSFS_KOBJ_BIN_ATTR)
+#define USYSFS_NOT_PINNED	(USYSFS_UOBJ_ATTR | USYSFS_UOBJ_BIN_ATTR)
 
-int usysfs_register_subsystem(struct kset *k);
-void usysfs_unregister_subsystem(struct kset *k);
+int usysfs_register_subsystem(struct uset *k);
+void usysfs_unregister_subsystem(struct uset *k);
 
 #endif /* _USYSFS_H_ */

Modified: trunk/fs/usysfs/usysfs_internal.h
===================================================================
--- trunk/fs/usysfs/usysfs_internal.h	2005-03-24 04:17:32 UTC (rev 2044)
+++ trunk/fs/usysfs/usysfs_internal.h	2005-03-24 20:11:10 UTC (rev 2045)
@@ -33,17 +33,17 @@
 
 extern struct vfsmount * usysfs_mount;
 
-extern int usysfs_is_root(struct kobject *kobj);
+extern int usysfs_is_root(struct uobject *uobj);
 
 extern struct inode * usysfs_new_inode(mode_t mode);
 extern int usysfs_create(struct dentry *, int mode, int (*init)(struct inode *));
 
-extern int usysfs_create_file(struct kobject *, const struct attribute *);
+extern int usysfs_create_file(struct uobject *, const struct usysfs_attribute *);
 extern int usysfs_make_dirent(struct usysfs_dirent *, struct dentry *, void *,
 				umode_t, int);
 extern struct dentry * usysfs_get_dentry(struct dentry *, const char *);
 
-extern int usysfs_add_file(struct dentry *, const struct attribute *, int);
+extern int usysfs_add_file(struct dentry *, const struct usysfs_attribute *, int);
 extern void usysfs_hash_and_remove(struct dentry * dir, const char * name);
 
 extern const unsigned char * usysfs_get_name(struct usysfs_dirent *sd);
@@ -66,47 +66,47 @@
 
 struct usysfs_symlink {
 	struct list_head sl_list;
-	struct kobject *sl_target;
+	struct uobject *sl_target;
 };
 
 extern int usysfs_create_link(struct usysfs_symlink *sl,
 			      struct dentry *parent,
 			      struct dentry *dentry);
 
-static inline struct kobject * to_kobj(struct dentry * dentry)
+static inline struct uobject * to_uobj(struct dentry * dentry)
 {
 	struct usysfs_dirent * sd = dentry->d_fsdata;
-	return ((struct kobject *) sd->s_element);
+	return ((struct uobject *) sd->s_element);
 }
 
-static inline struct attribute * to_attr(struct dentry * dentry)
+static inline struct usysfs_attribute * to_attr(struct dentry * dentry)
 {
 	struct usysfs_dirent * sd = dentry->d_fsdata;
-	return ((struct attribute *) sd->s_element);
+	return ((struct usysfs_attribute *) sd->s_element);
 }
 
-static inline struct bin_attribute * to_bin_attr(struct dentry * dentry)
+static inline struct usysfs_bin_attribute * to_bin_attr(struct dentry * dentry)
 {
 	struct usysfs_dirent * sd = dentry->d_fsdata;
-	return ((struct bin_attribute *) sd->s_element);
+	return ((struct usysfs_bin_attribute *) sd->s_element);
 }
 
-static inline struct kobject *usysfs_get_kobject(struct dentry *dentry)
+static inline struct uobject *usysfs_get_uobject(struct dentry *dentry)
 {
-	struct kobject * kobj = NULL;
+	struct uobject * uobj = NULL;
 
 	spin_lock(&dcache_lock);
 	if (!d_unhashed(dentry)) {
 		struct usysfs_dirent * sd = dentry->d_fsdata;
-		if (sd->s_type & USYSFS_KOBJ_LINK) {
+		if (sd->s_type & USYSFS_UOBJ_LINK) {
 			struct usysfs_symlink * sl = sd->s_element;
-			kobj = kobject_get(sl->sl_target);
+			uobj = uobject_get(sl->sl_target);
 		} else
-			kobj = kobject_get(sd->s_element);
+			uobj = uobject_get(sd->s_element);
 	}
 	spin_unlock(&dcache_lock);
 
-	return kobj;
+	return uobj;
 }
 
 static inline void release_usysfs_dirent(struct usysfs_dirent * sd)



More information about the Ocfs2-commits mailing list